Skip to content

Commit

Permalink
add Fig.All project and nuget bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
rofr committed Oct 3, 2019
1 parent 704937f commit c877b88
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 7 deletions.
22 changes: 22 additions & 0 deletions Fig.All/Fig.All.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<PackageVersion>1.2.0</PackageVersion>
<Title>Fig.All</Title>
<Authors>Robert Friberg et al</Authors>
<Description>All of the libraries in a single nuget package for your convenience</Description>
<Copyright>Robert Friberg et al</Copyright>
<PackageProjectUrl>https://github.com/rofr/fig</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/rofr/fig</PackageLicenseUrl>
<RepositoryUrl>https://github.com/rofr/fig</RepositoryUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Fig.AppSettingsJson\Fig.AppSettingsJson.csproj" />
<ProjectReference Include="..\Fig.AppSettingsXml\Fig.AppSettingsXml.csproj" />
<ProjectReference Include="..\Fig.Core\Fig.Core.csproj" />
</ItemGroup>

</Project>
6 changes: 6 additions & 0 deletions Fig.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fig.AppSettingsXml", "Fig.A
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fig.AppSettingsJson", "Fig.AppSettingsJson\Fig.AppSettingsJson.csproj", "{D51AF7ED-8BBA-451D-8601-B25BBB507450}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fig.All", "Fig.All\Fig.All.csproj", "{2F65DA14-1E43-4184-9D51-FBFE047788DC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -36,5 +38,9 @@ Global
{D51AF7ED-8BBA-451D-8601-B25BBB507450}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D51AF7ED-8BBA-451D-8601-B25BBB507450}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D51AF7ED-8BBA-451D-8601-B25BBB507450}.Release|Any CPU.Build.0 = Release|Any CPU
{2F65DA14-1E43-4184-9D51-FBFE047788DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F65DA14-1E43-4184-9D51-FBFE047788DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F65DA14-1E43-4184-9D51-FBFE047788DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F65DA14-1E43-4184-9D51-FBFE047788DC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ Fig can help you keep this nice and clean:
.UseAppSettingsXml()
.Build<Settings>();


//get a value by key and convert to your target type
//a KeyNotFoundException is thrown if key is missing
var key = "CoffeeRefillInterval";
var refillInterval = settings.Get<TimeSpan>(key, default: "00:10:00");
var refillInterval = settings.Get<TimeSpan>(key);


// if key is optional, provide a default
// notice how the return type is derived from the default expression
var refillInterval = settings.Get(key, () => TimeSpan.FromMinutes(10));

//if key is missing and no default is present, a KeyNotFoundException is thrown
refillInterval = settings.Get<TimeSpan>(key);
```

If you prefer a strongly typed class there are 2 options: either bind to a POCO
Expand Down Expand Up @@ -55,7 +62,7 @@ or inherit from Fig.Settings class. Here is the inheritance approach:
```

If you prefer POCO setting classes, call `Settings.Bind<T>()` or `Settings.Bind<T>(T poco)`

(not yet implemented)

That's pretty useful as it is but wait, there's more! You can modify properties
at runtime and respond to changes by subscribing to the `PropertyChanged` event.
Expand Down Expand Up @@ -109,11 +116,18 @@ got you covered:

## Install from nuget
```bash
#Everything in a single bundle
Install-Package Fig.All

# the core package with support for command line, json, ini and environment variables
Install-Package Fig -prerelease
Install-Package Fig

# web.config and app.config support is in a separate package
Install-Package Fig.AppSettingsXml -prerelease
Install-Package Fig.AppSettingsXml

#AppSettings json support
Install-Package Fig.AppSettingsJson

```

## Features
Expand Down Expand Up @@ -149,4 +163,4 @@ and then we discuss details in the comments.
* Diagnostics: which provider did a value come from?
* Dump values (INI, text)
* TOML
* YAML, hell no :)
* YAML, hell no :)
1 change: 1 addition & 0 deletions publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ echo $version
nuget push Fig.Core/bin/$configuration/Fig.$version.nupkg -Source https://api.nuget.org/v3/index.json
nuget push Fig.AppSettingsxml/bin/$configuration/Fig.AppSettingsXml.$version.nupkg -Source https://api.nuget.org/v3/index.json
nuget push Fig.AppSettingsJson/bin/$configuration/Fig.AppSettingsJson.$version.nupkg -Source https://api.nuget.org/v3/index.json
nuget push Fig.All/bin/$configuration/Fig.All.$version.nupkg -Source https://api.nuget.org/v3/index.json

0 comments on commit c877b88

Please sign in to comment.