This repository has been archived by the owner on Mar 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 34
/
install.fsx
54 lines (44 loc) · 1.93 KB
/
install.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
// include Fake lib
#r "packages/FAKE/tools/FakeLib.dll"
open Fake
open System
open System.IO
open System.Net
open System.Text.RegularExpressions
let homeVimPath =
if Environment.OSVersion.Platform = PlatformID.Unix || Environment.OSVersion.Platform = PlatformID.MacOSX then
Environment.GetEnvironmentVariable("HOME") @@ ".vim"
else Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%") @@ "vimfiles"
let vimInstallDir = homeVimPath @@ "bundle/fsharpbinding-vim"
let vimBinDir = __SOURCE_DIRECTORY__ @@ "ftplugin/bin"
let ftpluginDir = __SOURCE_DIRECTORY__ @@ "ftplugin"
let autoloadDir = __SOURCE_DIRECTORY__ @@ "autoload"
let syntaxDir = __SOURCE_DIRECTORY__ @@ "syntax"
let ftdetectDir = __SOURCE_DIRECTORY__ @@ "ftdetect"
let syntaxCheckersDir = __SOURCE_DIRECTORY__ @@ "syntax_checkers"
let acArchive = "fsautocomplete.zip"
let acVersion = "0.34.0"
Target "FSharp.AutoComplete" (fun _ ->
CreateDir vimBinDir
use client = new WebClient()
Net.ServicePointManager.SecurityProtocol <- Net.SecurityProtocolType.Tls12
tracefn "Downloading version %s of FSharp.AutoComplete" acVersion
client.DownloadFile(sprintf "https://github.com/fsharp/FSharp.AutoComplete/releases/download/%s/%s" acVersion acArchive, vimBinDir @@ acArchive)
tracefn "Download complete"
tracefn "Unzipping"
Unzip vimBinDir (vimBinDir @@ acArchive))
Target "Install" (fun _ ->
DeleteDir vimInstallDir
CreateDir vimInstallDir
CopyDir (vimInstallDir @@ "ftplugin") ftpluginDir (fun _ -> true)
CopyDir (vimInstallDir @@ "autoload") autoloadDir (fun _ -> true)
CopyDir (vimInstallDir @@ "syntax") syntaxDir (fun _ -> true)
CopyDir (vimInstallDir @@ "syntax_checkers") syntaxCheckersDir (fun _ -> true)
CopyDir (vimInstallDir @@ "ftdetect") ftdetectDir (fun _ -> true))
Target "Clean" (fun _ ->
CleanDirs [ vimBinDir; vimInstallDir ])
Target "All" id
"FSharp.AutoComplete"
==> "Install"
==> "All"
RunTargetOrDefault "All"