This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// include Fake libs | |
#r @"c:\Project\FAKE.Deploy\bin\FAKE\tools\FakeLib.dll" | |
open Fake | |
open System | |
open System.IO | |
let targetDirectory = @"c:\Project\Service.MSO" | |
let runScript file = | |
if File.Exists file then | |
let result, messages = | |
ExecProcessRedirected | |
(fun info -> | |
info.FileName <- file | |
info.WorkingDirectory <- targetDirectory) | |
(TimeSpan.FromMinutes 10.0) | |
for msg in messages do | |
(if msg.IsError then traceError else traceImportant) msg.Message | |
if not result then | |
failwithf "MyProc.exe returned with a non-zero exit code" | |
else | |
traceImportant <| sprintf "File %s is not found" file | |
// *** Define Targets *** | |
Target "EnsureDirectory" (fun () -> | |
trace <| sprintf " --- Ensure that directory '%s' is exist --- " targetDirectory | |
CreateDir targetDirectory | |
) | |
Target "UninstallService" (fun () -> | |
trace " --- Uninstall service --- " | |
targetDirectory @@ "uninstall.bat" | |
|> runScript | |
) | |
Target "CleanDirectory" (fun () -> | |
trace " --- Clean target directory --- " | |
CleanDir targetDirectory | |
) | |
Target "CopyFiles" (fun () -> | |
trace " --- Copy new files --- " | |
XCopy (__SOURCE_DIRECTORY__ @@ "content") targetDirectory | |
) | |
Target "InstallService" (fun () -> | |
trace " --- Install service --- " | |
targetDirectory @@ "install.bat" | |
|> runScript | |
) | |
Target "Deploy" DoNothing | |
// *** Define Dependencies *** | |
"EnsureDirectory" | |
==> "UninstallService" | |
==> "CleanDirectory" | |
==> "CopyFiles" | |
==> "InstallService" | |
==> "Deploy" | |
// *** Start Build *** | |
RunParameterTargetOrDefault "target" "Deploy" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment