-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathGrunt.fsx
66 lines (47 loc) · 1.83 KB
/
Grunt.fsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#r @"../../../packages/FAKE/tools/FakeLib.dll"
#load "./Utils.fsx"
#load "./Npm.fsx"
open Fake
open Utils
open Npm
open System
open System.IO
let grunt = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "npm\\node_modules\\grunt-cli\\bin\\grunt")
let install = Npm.install
let run (config : Map<string, string>) _ =
let env = match config.TryFind "grunt:environment" with
| Some x -> x
| _ -> "dev"
let verbose =
match config.TryFind "grunt:verbose" with
| Some x ->
match x with
|"true" -> "--verbose"
| _ -> ""
| _ -> ""
let args = "\"" + grunt + "\" --env=\"" + env + "\" " + verbose
let result =
ExecProcess (fun info ->
info.FileName <- Npm.node
info.WorkingDirectory <- ".\\build"
info.Arguments <- args) (TimeSpan.FromMinutes 5.)
if result <> 0 then failwith (sprintf "Grunt has exited with a non-zero error level: %d" result)
()
let karma (config : Map<string, string>) _ =
let args = "\"" + grunt + "\" karma"
let result =
ExecProcess (fun info ->
info.FileName <- Npm.node
info.WorkingDirectory <- ".\\build"
info.Arguments <- args) (TimeSpan.FromMinutes 5.)
if result <> 0 then failwith (sprintf "Karma reporting failure - at least one test has failed: %d" result)
()
let protractor (config : Map<string, string>) _ =
let args = "\"" + grunt + "\" protractor"
let result =
ExecProcess (fun info ->
info.FileName <- Npm.node
info.WorkingDirectory <- ".\\build"
info.Arguments <- args) (TimeSpan.FromMinutes 20.)
if result <> 0 then failwith (sprintf "Protractor reporting failure - at least one test has failed: %d" result)
()