Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
131 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
_site | ||
.sass-cache | ||
packages | ||
.fake |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: 1.0.{build} | ||
branches: | ||
only: | ||
- master | ||
skip_tags: true | ||
environment: | ||
password: | ||
secure: SHp3N2vcWjhD8xFFopC4ufWnsSbyDowKSa+gCLRrIFA= | ||
install: | ||
- cmd: set PATH=C:\Ruby22-x64\bin;C:\Python27-x64;%PATH% | ||
build_script: | ||
- cmd: >- | ||
build.cmd CI -ev password | ||
artifacts: | ||
- path: _site | ||
name: Site |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@echo off | ||
|
||
paket.exe restore | ||
if errorlevel 1 ( | ||
exit /b %errorlevel% | ||
) | ||
|
||
packages\FAKE\tools\FAKE.exe build.fsx %* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#r "packages/FAKE/tools/FakeLib.dll" | ||
#r "packages/WinSCP/lib/WinSCPnet.dll" | ||
|
||
open Fake | ||
open WinSCP | ||
open System | ||
open System.IO | ||
open System.Diagnostics | ||
|
||
module WindowsPath = | ||
open System | ||
open System.IO | ||
|
||
let path = lazy (Environment.GetEnvironmentVariable("PATH").Split(';') |> List.ofArray) | ||
let pathExt = lazy (Environment.GetEnvironmentVariable("PATHEXT").Split(';') |> List.ofArray) | ||
|
||
let find names = | ||
path.Value | ||
|> Seq.collect (fun dir -> names |> List.map (fun name -> Path.Combine(dir, name))) | ||
|> Seq.tryFind(File.Exists) | ||
|
||
let findProgram name = | ||
pathExt.Value | ||
|> List.map ((+) name) | ||
|> find | ||
|
||
let rootDir = Path.GetFullPath(__SOURCE_DIRECTORY__) | ||
|
||
let getBundlePath() = | ||
match WindowsPath.findProgram "bundle" with | ||
| Some(p) -> p | ||
| None -> failwith "Bundle not found" | ||
|
||
let execBundle args = | ||
let config (psi:ProcessStartInfo) = | ||
psi.FileName <- getBundlePath() | ||
psi.Arguments <- args | ||
ExecProcess config (TimeSpan.FromMinutes(5.)) |> ignore | ||
|
||
Target "Install" <| fun _ -> | ||
execBundle "" | ||
|
||
Target "Build" <| fun _ -> | ||
execBundle "exec jekyll build" | ||
|
||
Target "Serve" <| fun _ -> | ||
execBundle "exec jekyll serve --future --watch" | ||
|
||
let private winScpPath = | ||
lazy ( | ||
let assemblyDir = Path.GetDirectoryName(typedefof<Session>.Assembly.Location) | ||
Path.Combine(assemblyDir, "..", "content", "WinSCP.exe") | ||
) | ||
|
||
let uploadFolder localDir remoteDir (options: SessionOptions) = | ||
use session = new Session() | ||
session.ExecutablePath <- winScpPath.Value | ||
session.Open options | ||
|
||
let localPath = Path.Combine(localDir, "*") | ||
printfn "Uploading the content of '%s' to '%s' on '%s'" localPath remoteDir options.HostName | ||
let result = session.PutFiles(localPath, remoteDir) | ||
|
||
if not result.IsSuccess then | ||
let exceptions = result.Failures |> Seq.map (fun e -> e :> Exception) | ||
raise (new AggregateException(exceptions)) | ||
|
||
let envVarOrAskUser name question = | ||
match environVarOrNone name with | ||
| Some x -> x | ||
| None -> getUserPassword question | ||
|
||
Target "Upload" <| fun _ -> | ||
let options = new SessionOptions() | ||
options.Protocol <- Protocol.Ftp | ||
options.FtpSecure <- FtpSecure.Explicit | ||
options.FtpMode <- FtpMode.Active | ||
options.HostName <- "vbfox.net" | ||
options.UserName <- "blog_upload" | ||
options.Password <- envVarOrAskUser "password" "FTP Password: " | ||
uploadFolder (rootDir </> "_site") "/" options | ||
|
||
Target "CI" DoNothing | ||
|
||
"Install" ?=> "Build" | ||
"Install" ?=> "Serve" | ||
"Build" ==> "Upload" | ||
|
||
"CI" ==> "Install" | ||
"CI" ==> "Upload" | ||
|
||
RunTargetOrDefault "Build" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source https://api.nuget.org/v3/index.json | ||
nuget FAKE | ||
nuget WinSCP |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
NUGET | ||
remote: http://api.nuget.org/v3/index.json | ||
FAKE (4.41.6) | ||
WinSCP (5.9.2) |