Skip to content

Commit

Permalink
Change 'remoting' to 'communication' - references SAFE-Stack#110
Browse files Browse the repository at this point in the history
  • Loading branch information
theimowski committed Aug 16, 2018
1 parent 2eaf4db commit a98b29f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 21 deletions.
35 changes: 24 additions & 11 deletions Content/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,35 +48,48 @@
},
{
"choice": "fulma-basic",
"description": "adds Fulma basic template"
"description": "add Fulma basic template"
},
{
"choice": "fulma-admin",
"description": "adds Fulma with 'Admin' Bulma template from https://dansup.github.io/bulma-templates/"
"description": "add Fulma with 'Admin' Bulma template from https://dansup.github.io/bulma-templates/"
},
{
"choice": "fulma-cover",
"description": "adds Fulma with 'Cover' Bulma template from https://dansup.github.io/bulma-templates/"
"description": "add Fulma with 'Cover' Bulma template from https://dansup.github.io/bulma-templates/"
},
{
"choice": "fulma-hero",
"description": "adds Fulma with 'Hero' Bulma template from https://dansup.github.io/bulma-templates/"
"description": "add Fulma with 'Hero' Bulma template from https://dansup.github.io/bulma-templates/"
},
{
"choice": "fulma-landing",
"description": "adds Fulma with 'Landing' Bulma template from https://dansup.github.io/bulma-templates/"
"description": "add Fulma with 'Landing' Bulma template from https://dansup.github.io/bulma-templates/"
},
{
"choice": "fulma-login",
"description": "adds Fulma with 'Login' Bulma template from https://dansup.github.io/bulma-templates/"
"description": "add Fulma with 'Login' Bulma template from https://dansup.github.io/bulma-templates/"
}
]
},
"remoting": {
"communication": {
"type": "parameter",
"dataType": "bool",
"defaultValue": "false",
"description": "adds Fable.Remoting to server and client"
"dataType": "choice",
"defaultValue": "none",
"choices": [
{
"choice": "none",
"description": "don't add any additional libraries for client-server communication"
},
{
"choice": "remoting",
"description": "add Fable.Remoting (https://zaid-ajaj.github.io/Fable.Remoting/) to server and client"
}
]
},
"remoting":{
"type": "computed",
"value": "(communication == \"remoting\")"
},
"js-deps": {
"type": "parameter",
Expand Down Expand Up @@ -104,7 +117,7 @@
},
{
"choice": "azure",
"description": "additional FAKE targets to deploy to Azure"
"description": "additional FAKE targets to deploy to Azure App Service"
},
{
"choice": "docker",
Expand Down
2 changes: 1 addition & 1 deletion build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ type CombinedPaketDependencies =
Azure = x.Azure }

override x.ToString () =
let remoting = if x.Remoting then Some "--remoting" else None
let remoting = if x.Remoting then Some "--communication remoting" else None
let azure = if x.Azure then Some "--deploy azure" else None
let fulma = if not x.Fulma then Some "--layout none" else None
let server = if x.Server <> Saturn then Some (sprintf "--server %O" x.Server) else None
Expand Down
23 changes: 14 additions & 9 deletions tests/Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,19 @@ type TemplateArgs =
Deploy : string option
Layout : string option
JsDeps : string option
Remoting : bool }
Communication : string option }

override args.ToString () =
let optArg (name, value) =
value
|> Option.map (sprintf "--%s %s" name)

let remoting = if args.Remoting then Some "--remoting" else None

[ "server", args.Server
"deploy", args.Deploy
"layout", args.Layout
"js-deps", args.JsDeps ]
"js-deps", args.JsDeps
"communication", args.Communication ]
|> List.map optArg
|> fun x -> List.append x [remoting]
|> List.choose id
|> String.concat " "

Expand Down Expand Up @@ -85,6 +83,12 @@ let jsDepsGen =
Some "npm"
]

let communicationGen =
Gen.elements [
None
Some "remoting"
]

type TemplateArgsArb () =
static member Arb () : Arbitrary<TemplateArgs> =
let generator : Gen<TemplateArgs> =
Expand All @@ -93,13 +97,13 @@ type TemplateArgsArb () =
let! deploy = deployGen
let! layout = layoutGen
let! jsDeps = jsDepsGen
let! remoting = Gen.elements [false; true]
let! communication = communicationGen
return
{ Server = server
Deploy = deploy
Layout = layout
JsDeps = jsDeps
Remoting = remoting }
Communication = communication }
}

let shrinker (x : TemplateArgs) : seq<TemplateArgs> =
Expand All @@ -116,8 +120,9 @@ type TemplateArgsArb () =
match x.JsDeps with
| Some _ -> yield { x with JsDeps = None }
| _ -> ()
if x.Remoting then
yield { x with Remoting = false }
match x.Communication with
| Some _ -> yield { x with Communication = None }
| _ -> ()
}

Arb.fromGenShrink (generator, shrinker)
Expand Down

0 comments on commit a98b29f

Please sign in to comment.