diff --git a/code/FsComposite/Composite.Test/.gitignore b/code/FsComposite/Composite.Test/.gitignore new file mode 100644 index 0000000..491b209 --- /dev/null +++ b/code/FsComposite/Composite.Test/.gitignore @@ -0,0 +1 @@ +DataSourceConfigs/*.json \ No newline at end of file diff --git a/code/FsComposite/Composite.Test/App.config b/code/FsComposite/Composite.Test/App.config index 5744095..7c6b932 100644 --- a/code/FsComposite/Composite.Test/App.config +++ b/code/FsComposite/Composite.Test/App.config @@ -1,6 +1,10 @@ - + + - - - + + + + + + \ No newline at end of file diff --git a/code/FsComposite/Composite.Test/Composite.Test.fsproj b/code/FsComposite/Composite.Test/Composite.Test.fsproj index b3912bb..a142688 100644 --- a/code/FsComposite/Composite.Test/Composite.Test.fsproj +++ b/code/FsComposite/Composite.Test/Composite.Test.fsproj @@ -57,6 +57,7 @@ + @@ -70,7 +71,12 @@ FSharp.Core.dll $(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\$(TargetFSharpCoreVersion)\FSharp.Core.dll + + ..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll + True + + diff --git a/code/FsComposite/Composite.Test/DataSourceConfigs/github_config.template b/code/FsComposite/Composite.Test/DataSourceConfigs/github_config.template new file mode 100644 index 0000000..195b63e --- /dev/null +++ b/code/FsComposite/Composite.Test/DataSourceConfigs/github_config.template @@ -0,0 +1,5 @@ +{ + "user": "[username]", + "password": "[password]", + "repository": "[name]" +} diff --git a/code/FsComposite/Composite.Test/DataSourceConfigurationManager.fs b/code/FsComposite/Composite.Test/DataSourceConfigurationManager.fs new file mode 100644 index 0000000..31d0ca1 --- /dev/null +++ b/code/FsComposite/Composite.Test/DataSourceConfigurationManager.fs @@ -0,0 +1,23 @@ +namespace Composite.Test + +open System.IO +open System.Configuration + +open Newtonsoft.Json.Linq + +module DataSourceConfigurationManager = + + let getJsonValue (config: JObject) key = + config.SelectToken(sprintf "$.%s" key) |> string + + module Github = + + let config_path = ConfigurationManager.AppSettings.["GithubConfigPath"] + + type Config () = + let config = JObject.Parse(File.ReadAllText(config_path)) + let getJsonValueFromConfig = getJsonValue config + + member this.Username = getJsonValueFromConfig "user" + member this.Password = getJsonValueFromConfig "password" + member this.Repository = getJsonValueFromConfig "repository" diff --git a/code/FsComposite/Composite.Test/Program.fs b/code/FsComposite/Composite.Test/Program.fs index a6366f4..214c2e0 100644 --- a/code/FsComposite/Composite.Test/Program.fs +++ b/code/FsComposite/Composite.Test/Program.fs @@ -22,12 +22,14 @@ module Program = [] let main argv = + let github_config = DataSourceConfigurationManager.Github.Config () let inputSimple = Composite ([Value C; Value D] |> LazyList.ofList) printfn "Input seq: %A" (inputSimple |> toString) let expanded = ana [v expandSimple] inputSimple printfn "Expanded seq: %A" (expanded |> toString) + let collapseScn = [find_and_transform_BC ()] let transformed = cata collapseScn (expanded |> flat) diff --git a/code/FsComposite/Composite.Test/packages.config b/code/FsComposite/Composite.Test/packages.config index e12e4c8..a050230 100644 --- a/code/FsComposite/Composite.Test/packages.config +++ b/code/FsComposite/Composite.Test/packages.config @@ -1,5 +1,6 @@  + \ No newline at end of file