Skip to content

Commit

Permalink
Add Sudoku application.
Browse files Browse the repository at this point in the history
Move applications to shared assembly.
  • Loading branch information
isaacabraham committed Apr 7, 2016
1 parent 9a590d6 commit aa9c125
Show file tree
Hide file tree
Showing 25 changed files with 498 additions and 57 deletions.
2 changes: 1 addition & 1 deletion Demonstrator.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{0C5F06
paket.lock = paket.lock
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FootballLibrary", "src\FootballLibrary\FootballLibrary.fsproj", "{1A4610CE-D30D-46E1-9D5E-0172965399BC}"
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Applications", "src\FootballLibrary\Applications.fsproj", "{1A4610CE-D30D-46E1-9D5E-0172965399BC}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "SuaveHost", "src\SuaveHost\SuaveHost.fsproj", "{8F061178-EE0A-4287-B593-2B7DF78A47DF}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<ProjectTypeGuids>{F2A71F9B-5D33-465A-A702-920D77279786}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Library1</RootNamespace>
<AssemblyName>Library1</AssemblyName>
<AssemblyName>Applications</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFSharpCoreVersion>4.4.0.0</TargetFSharpCoreVersion>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Name>FootballLibrary</Name>
<Name>Applications</Name>
<UseIISExpress>true</UseIISExpress>
<TargetFrameworkProfile />
</PropertyGroup>
Expand Down Expand Up @@ -101,16 +101,41 @@
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="Helpers.fs" />
<Compile Include="Contracts.fs" />
<Compile Include="LeagueTable.fs" />
<Compile Include="TeamStats.fs" />
<Compile Include="..\..\paket-files\isaacabraham\enigma\src\Enigma\Domain.fs">
<Paket>True</Paket>
<Link>enigma/Domain.fs</Link>
</Compile>
<Compile Include="..\..\paket-files\isaacabraham\enigma\src\Enigma\Logic.fs">
<Paket>True</Paket>
<Link>enigma/Logic.fs</Link>
</Compile>
<Compile Include="..\..\paket-files\isaacabraham\sudoku-solver\src\Api\Contracts.fs">
<Paket>True</Paket>
<Link>sudoku/Contracts.fs</Link>
</Compile>
<Compile Include="..\..\paket-files\isaacabraham\sudoku-solver\src\Api\Sudoku.fs">
<Paket>True</Paket>
<Link>sudoku/Sudoku.fs</Link>
</Compile>
<Compile Include="..\..\paket-files\isaacabraham\sudoku-solver\src\Api\DomainModel.fs">
<Paket>True</Paket>
<Link>sudoku/DomainModel.fs</Link>
</Compile>
<Compile Include="footballLeague\DataContracts.fs" />
<Compile Include="footballLeague\LeagueTable.fs" />
<Compile Include="footballLeague\TeamStats.fs" />
<None Include="Scripts\load-references-debug.fsx" />
<None Include="Scripts\load-project-debug.fsx" />
<None Include="Scripts\Scratchpad.fsx" />
<None Include="paket.references" />
<Compile Include="enigma\Api.fs" />
<Compile Include="sudoku\Api.fs" />
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="Streams">
<HintPath>..\..\packages\Streams\lib\net45\Streams.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
Expand Down
13 changes: 10 additions & 3 deletions src/FootballLibrary/Scripts/load-project-debug.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
#load "load-references-debug.fsx"
#load "../AssemblyInfo.fs"
"../Helpers.fs"
"../Contracts.fs"
"../LeagueTable.fs"
"../TeamStats.fs"
"../../../paket-files/isaacabraham/enigma/src/Enigma/Domain.fs"
"../../../paket-files/isaacabraham/enigma/src/Enigma/Logic.fs"
"../../../paket-files/isaacabraham/sudoku-solver/src/Api/Contracts.fs"
"../../../paket-files/isaacabraham/sudoku-solver/src/Api/Sudoku.fs"
"../../../paket-files/isaacabraham/sudoku-solver/src/Api/DomainModel.fs"
"../footballLeague/DataContracts.fs"
"../footballLeague/LeagueTable.fs"
"../footballLeague/TeamStats.fs"
"../enigma/Api.fs"
"../sudoku/Api.fs"
3 changes: 2 additions & 1 deletion src/FootballLibrary/Scripts/load-references-debug.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
#r "../../../packages/FSharp.Data/lib/net40/FSharp.Data.dll"
#r "../../../packages/Newtonsoft.Json/lib/net45/Newtonsoft.Json.dll"
#r "../../../packages/Microsoft.AspNet.WebApi.Client/lib/net45/System.Net.Http.Formatting.dll"
#r "../../../packages/Microsoft.AspNet.WebApi.Core/lib/net45/System.Web.Http.dll"
#r "../../../packages/Microsoft.AspNet.WebApi.Core/lib/net45/System.Web.Http.dll"
#r "../../../packages/Streams/lib/net45/Streams.dll"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 7 additions & 1 deletion src/FootballLibrary/paket.references
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
Microsoft.AspNet.WebApi.Core
FSharp.Core
FSharp.Data
Deedle
Deedle

File:Domain.fs enigma
File:Logic.fs enigma
File:Contracts.fs sudoku
File:Sudoku.fs sudoku
File:DomainModel.fs sudoku
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ open Nessos.Streams
open DomainModel
open Soduku

let processData request =
let solve request =
request.Data
|> Stream.ofArray
|> Stream.collect (Seq.collect (Seq.collect id) >> Stream.ofSeq)
Expand Down
17 changes: 11 additions & 6 deletions src/SuaveHost/Apps.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ open Suave.Operators
open Suave.Writers
open System


open FootballDemo
open FootballDemo.LeagueTable
open FootballDemo.TeamStats
open Enigma
open SudokuSolver
open Suave.Successful

/// Routes for the Football Library.
/// Routes for the Football app.
let footballApp =
GET >=> choose [
pathScan "/api/leaguetable/%d" (enum<FootballMonth> >> getLeague >> toJsonAsync)
Expand All @@ -23,15 +24,19 @@ let footballApp =
let enigmaApp =
choose [
POST >=> choose [
path "/api/enigma/translate" >=> Helpers.mapJson Enigma.Api.performTranslation
path "/api/enigma/configure" >=> Helpers.mapJson Enigma.Api.configureEnigma
path "/api/enigma/translate" >=> Helpers.mapJson Api.performTranslation
path "/api/enigma/configure" >=> Helpers.mapJson Api.configureEnigma
]
GET >=> choose [
pathScan "/api/enigma/reflector/%d" (Enigma.Api.getReflectorResponse >> optionallyWith OK)
pathScan "/api/enigma/rotor/%d" (Enigma.Api.getRotorResponse >> optionallyWith Helpers.toJson)
pathScan "/api/enigma/reflector/%d" (Api.getReflectorResponse >> optionallyWith OK)
pathScan "/api/enigma/rotor/%d" (Api.getRotorResponse >> optionallyWith Helpers.toJson)
]
]

/// Routes for the Sudoku app.
let sudokuApp =
POST >=> path "/api/sudoku/solve" >=> Helpers.mapJson Api.solve

/// Routes for non-application specific features.
let basicApp staticFileRoot =
GET >=> choose [
Expand Down
1 change: 1 addition & 0 deletions src/SuaveHost/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ let buildApp staticFilesPath : WebPart =
choose [
footballApp
enigmaApp
sudokuApp
basicApp staticFileRoot
pageNotFound staticFileRoot
] >=> log logger logFormat
Expand Down
31 changes: 4 additions & 27 deletions src/SuaveHost/SuaveHost.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,28 +65,6 @@
</Target>
-->
<ItemGroup>
<Compile Include="..\..\paket-files\isaacabraham\enigma\src\Enigma\Domain.fs">
<Paket>True</Paket>
<Link>applications/enigma/Domain.fs</Link>
</Compile>
<Compile Include="..\..\paket-files\isaacabraham\enigma\src\Enigma\Logic.fs">
<Paket>True</Paket>
<Link>applications/enigma/Logic.fs</Link>
</Compile>
<Compile Include="applications\enigma\Api.fs" />
<Compile Include="..\..\paket-files\isaacabraham\sudoku-solver\src\Api\Contracts.fs">
<Paket>True</Paket>
<Link>applications/sudoku/Contracts.fs</Link>
</Compile>
<Compile Include="..\..\paket-files\isaacabraham\sudoku-solver\src\Api\Sudoku.fs">
<Paket>True</Paket>
<Link>applications/sudoku/Sudoku.fs</Link>
</Compile>
<Compile Include="..\..\paket-files\isaacabraham\sudoku-solver\src\Api\DomainModel.fs">
<Paket>True</Paket>
<Link>applications/sudoku/DomainModel.fs</Link>
</Compile>
<Compile Include="applications\sudoku\Api.fs" />
<Compile Include="AssemblyInfo.fs" />
<Compile Include="Helpers.fs" />
<Compile Include="AppInsightsHelpers.fs" />
Expand All @@ -104,15 +82,14 @@
</ItemGroup>
<ItemGroup>
<Reference Include="mscorlib" />
<Reference Include="Streams">
<HintPath>..\..\packages\Streams\lib\net45\Streams.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Numerics" />
<ProjectReference Include="..\FootballLibrary\FootballLibrary.fsproj">
<Name>FootballLibrary</Name>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FootballLibrary\Applications.fsproj">
<Name>Applications</Name>
<Project>{1a4610ce-d30d-46e1-9d5e-0172965399bc}</Project>
<Private>True</Private>
</ProjectReference>
Expand Down
7 changes: 1 addition & 6 deletions src/SuaveHost/paket.references
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@ Suave
Newtonsoft.Json
FSharp.Data
Microsoft.ApplicationInsights.TraceListener
Microsoft.ApplicationInsights.WindowsServer
File:Domain.fs applications\enigma
File:Logic.fs applications\enigma
File:Contracts.fs applications\sudoku
File:Sudoku.fs applications\sudoku
File:DomainModel.fs applications\sudoku
Microsoft.ApplicationInsights.WindowsServer
1 change: 0 additions & 1 deletion src/WebHost/Controllers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ type LeagueTableController() =
type TeamController() =
inherit ApiController()
member __.Get id = TeamStats.loadStatsForTeam id |> Async.StartAsTask

4 changes: 2 additions & 2 deletions src/WebHost/OwinHost.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
<Reference Include="System.Xml.Linq.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FootballLibrary\FootballLibrary.fsproj">
<Name>FootballLibrary</Name>
<ProjectReference Include="..\FootballLibrary\Applications.fsproj">
<Name>Applications</Name>
<Project>{1a4610ce-d30d-46e1-9d5e-0172965399bc}</Project>
<Private>True</Private>
</ProjectReference>
Expand Down
Loading

0 comments on commit aa9c125

Please sign in to comment.