Skip to content

Commit

Permalink
fixed: AppSettingsProvider infers URLs as ints
Browse files Browse the repository at this point in the history
  • Loading branch information
vasily-kirichenko committed Dec 6, 2014
1 parent bcaac08 commit 13877af
Show file tree
Hide file tree
Showing 11 changed files with 93 additions and 26 deletions.
13 changes: 12 additions & 1 deletion FSharp.Configuration.sln
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}"
ProjectSection(SolutionItems) = preProject
docs\content\app.config = docs\content\app.config
docs\content\AppSettingsProvider.fsx = docs\content\AppSettingsProvider.fsx
docs\content\Config.yaml = docs\content\Config.yaml
docs\content\index.fsx = docs\content\index.fsx
docs\content\IniTypeProvider.fsx = docs\content\IniTypeProvider.fsx
docs\content\Resource1.resx = docs\content\Resource1.resx
docs\content\ResXProvider.fsx = docs\content\ResXProvider.fsx
docs\content\Sample.ini = docs\content\Sample.ini
docs\content\YamlConfigProvider.fsx = docs\content\YamlConfigProvider.fsx
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Configuration", "src\FSharp.Configuration\FSharp.Configuration.fsproj", "{7E90D6CE-A10B-4858-A5BC-41DF7250CBCA}"
EndProject
Expand Down
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 0.4.5 - 06.12.2014
* Fixed: AppSettingsProvider infers URLs as ints

#### 0.4.4 - 22.10.2014
* Add support for connection strings to AppSettings TP

Expand Down
1 change: 1 addition & 0 deletions docs/content/AppSettingsProvider.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Create a config file called `app.config` like this:
<add key="TestDouble" value="10.01"/>
<add key="TestDateTime" value="2014-05-18 11:14:28Z"/>
<add key="TestTimeSpan" value="00:12:30"/>
<add key="TestUri" value="http://fsharp.org" />
</appSettings>
<connectionStrings>
<add name="Test" connectionString="Server=.;Database=SomeDatabase;Integrated Security=true"/>
Expand Down
15 changes: 9 additions & 6 deletions docs/content/app.config
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="test2" value="Some Test Value 5"/>
<add key="TestInt" value="102"/>
<add key="TestBool" value="True"/>
<add key="TestDouble" value="10.01"/>
<add key="test2" value="Some Test Value 5" />
<add key="TestInt" value="102" />
<add key="TestBool" value="True" />
<add key="TestDouble" value="10.01" />
<add key="TestDateTime" value="2014-05-18 11:14:28Z" />
<add key="TestTimeSpan" value="00:12:30" />
<add key="TestUri" value="http://fsharp.org" />
</appSettings>
<connectionStrings>
<add name="Test" connectionString="Server=.;Database=SomeDatabase;Integrated Security=true"/>
<add name="Test" connectionString="Server=.;Database=SomeDatabase;Integrated Security=true" />
</connectionStrings>
</configuration>
Binary file modified docs/files/img/AppSettingsProvider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions paket.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
NUGET
remote: http://nuget.org/api/v2
specs:
FAKE (3.8.3)
FAKE (3.11.3)
FSharp.Compiler.Service (0.0.59)
FSharp.Formatting (2.4.24)
FSharp.Compiler.Service (0.0.59)
Expand All @@ -21,9 +21,9 @@ NUGET
Microsoft.Net.Http (>= 0)
RazorEngine (3.3.0)
Microsoft.AspNet.Razor (>= 2.0.30506.0)
SourceLink.Fake (0.4.0)
SourceLink.Fake (0.4.2)
GITHUB
remote: fsharp/FAKE
specs:
modules/Octokit/Octokit.fsx (217f34087728301d0aac3754ae5f14ec1bc508a4)
modules/Octokit/Octokit.fsx (0a5a284350252b22075e096e6906681ece6bda1f)
Octokit (>= 0)
2 changes: 1 addition & 1 deletion src/FSharp.Configuration/AppSettingsProvider.fs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ let internal typedAppSettings (context: Context) =
let prop =
match (appSettings.Item key).Value with
| ValueParser.Uri _ ->
ProvidedProperty(name, typeof<int>,
ProvidedProperty(name, typeof<Uri>,
GetterCode = (fun _ -> <@@ Uri (getConfigValue key) @@>),
SetterCode = fun args -> <@@ setConfigValue(key, string ((%%args.[0]):Uri)) @@>)
| ValueParser.Int _ ->
Expand Down
6 changes: 3 additions & 3 deletions src/FSharp.Configuration/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ open System.Reflection
[<assembly: AssemblyTitleAttribute("FSharp.Configuration")>]
[<assembly: AssemblyProductAttribute("FSharp.Configuration")>]
[<assembly: AssemblyDescriptionAttribute("The FSharp.Configuration project contains type providers for the configuration of .NET projects.")>]
[<assembly: AssemblyVersionAttribute("0.4.4")>]
[<assembly: AssemblyFileVersionAttribute("0.4.4")>]
[<assembly: AssemblyVersionAttribute("0.4.5")>]
[<assembly: AssemblyFileVersionAttribute("0.4.5")>]
do ()

module internal AssemblyVersionInformation =
let [<Literal>] Version = "0.4.4"
let [<Literal>] Version = "0.4.5"
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,15 @@ let ``Can return a TimeSpan from the config file``() =
Settings.TestTimeSpan |> should equal (TimeSpan.Parse "2.01:02:03.444")

[<Test>]
let ``Cat return a DateTime from the config file``() =
let ``Can return a DateTime from the config file``() =
Settings.TestDateTime.GetType() |> should equal typeof<DateTime>
Settings.TestDateTime.ToUniversalTime() |> should equal (DateTime (2014, 2, 1, 3, 4, 5, 777))

[<Test>]
let ``Can return a Uri from the config file``() =
Settings.TestUri.GetType() |> should equal typeof<Uri>
Settings.TestUri |> should equal (Uri "http://fsharp.org")

[<Test>]
let ``Can return a connection string from the config file``() =
Settings.ConnectionStrings.Test1 |> should equal "Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;"
Expand Down
64 changes: 54 additions & 10 deletions tests/FSharp.Configuration.Tests/app.config
Original file line number Diff line number Diff line change
@@ -1,16 +1,60 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="test2" value="Some Test Value 5"/>
<add key="TestInt" value="102"/>
<add key="TestBool" value="True"/>
<add key="TestDouble" value="10.01"/>
<add key="TestTimeSpan" value="2.01:02:03.444"/>
<add key="TestDateTime" value="02/01/2014 03:04:05.777"/>
<add key="test2" value="Some Test Value 5" />
<add key="TestInt" value="102" />
<add key="TestBool" value="True" />
<add key="TestDouble" value="10.01" />
<add key="TestTimeSpan" value="2.01:02:03.444" />
<add key="TestDateTime" value="02/01/2014 03:04:05.777" />
<add key="TestUri" value="http://fsharp.org" />
</appSettings>

<connectionStrings>
<add name="Test1" connectionString="Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;"/>
<add name="Test2" connectionString="Server=myServerAddress;Database=myDataBase2;Trusted_Connection=True;"/>
<add name="Test1" connectionString="Server=myServerAddress;Database=myDataBase;Trusted_Connection=True;" />
<add name="Test2" connectionString="Server=myServerAddress;Database=myDataBase2;Trusted_Connection=True;" />
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.9.0" newVersion="2.6.9.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Extensions" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.28.0" newVersion="2.2.28.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.2.28.0" newVersion="4.2.28.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.WebRequest" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.28.0" newVersion="2.2.28.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.28.0" newVersion="2.2.28.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.13283" newVersion="2.6.3.13283" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="RazorEngine" publicKeyToken="9ee697374c7e744a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.3.0.0" newVersion="3.3.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
2 changes: 1 addition & 1 deletion tests/FSharp.Configuration.Tests/paket.references
Original file line number Diff line number Diff line change
@@ -1 +1 @@
NUnit
NUnit

0 comments on commit 13877af

Please sign in to comment.