Last active
June 12, 2018 19:41
-
-
Save realvictorprm/d95bf2c45b5cb6cc3afa04465055cb94 to your computer and use it in GitHub Desktop.
A must have for your script file to ease spreading a small proof of concept with dependencies!
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
open System | |
open System.IO | |
open System.Diagnostics | |
let downloadDependencies deps = | |
Environment.CurrentDirectory <- __SOURCE_DIRECTORY__ | |
if not (File.Exists "paket.exe") then | |
async { | |
let url = "http://fsprojects.github.io/Paket/stable" | |
use wc = new Net.WebClient() | |
wc.DownloadProgressChanged.Add(fun a -> printfn "Progress downloading paket.exe: %d" a.ProgressPercentage) | |
let tmp = Path.GetTempFileName() | |
let stable = wc.DownloadString(url) | |
do! wc.AsyncDownloadFile(stable |> Uri, tmp) | |
File.Move(tmp,Path.GetFileName stable) | |
} |> Async.RunSynchronously | |
printfn "Finished downloading paket.exe!" | |
let invokePaket args = | |
use process = | |
new Process( | |
StartInfo = | |
new ProcessStartInfo( | |
FileName = "./paket.exe", | |
Arguments = args, | |
UseShellExecute = false)) | |
process.Start() |> ignore | |
process.WaitForExit() | |
if not (File.Exists "paket.dependencies") && not (File.Exists "paket.lock") then | |
invokePaket "init" | |
for dep in deps do | |
sprintf "add %s" dep | |
|> invokePaket | |
downloadDependencies [ "MathNet.Numerics"; "MathNet.Numerics.FSharp"] // Append the package names to this list! |
I get this when pasting downloadDependencies into fsi:
warning FS0046: The identifier 'process' is reserved for future use by F#
@amieres that's not about paket. GitHub has disabled TLS <= 1.2 How to enable TLS 1.2.
Might want to add:
System.Net.ServicePointManager.SecurityProtocol <- System.Net.SecurityProtocolType.Tls12 // Github uses TLS 1.2
to the top of the file after open statements.
You are right! That did the trick.
Thank you!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@amieres @NatElkins @realvictorprm
Might want to add:
System.Net.ServicePointManager.SecurityProtocol <- System.Net.SecurityProtocolType.Tls12 // Github uses TLS 1.2
to the top of the file after open statements.