-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathGulp.fsx
More file actions
57 lines (42 loc) · 1.58 KB
/
Gulp.fsx
File metadata and controls
57 lines (42 loc) · 1.58 KB
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
#r @"../../../packages/FAKE/tools/FakeLib.dll"
#load "./Utils.fsx"
#load "./Npm.fsx"
open Fake
open Utils
open System
open System.IO
let gulp = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "npm\\node_modules\\gulp\\bin\\gulp.js")
let run (config : Map<string, string>) _ =
let env =
match config |> Map.tryFind "gulp:env" with
| Some x -> x
| _ -> "dev"
let build =
match config |> Map.tryFind "gulp:build" with
| Some x -> x
| _ -> "0.0.0"
let workingdir =
match config.TryFind "gulp:dir" with
| Some x when String.IsNullOrEmpty x = false -> x
| _ -> ".\\build"
let args = sprintf "\"%s\" --env=%s --build=%s" gulp env build
let result =
ExecProcess (fun info ->
info.FileName <- Npm.node
info.WorkingDirectory <- workingdir
info.Arguments <- args) (TimeSpan.FromMinutes 5.)
if result <> 0 then failwith (sprintf "Gulp has exited with a non-zero error code: %d" result)
()
let target (config : Map<string, string>) name _ =
let args = "\"" + gulp + "\" " + name
let workingdir =
match config.TryFind "gulp:dir" with
| Some x when String.IsNullOrEmpty x = false -> x
| _ -> ".\\build"
let result =
ExecProcess(fun info ->
info.FileName <- Npm.node
info.WorkingDirectory <- workingdir
info.Arguments <- args) (TimeSpan.FromMinutes 15.)
if result <> 0 then failwith (sprintf "Gulp has exited with a non-zero error code: %d" result)
()