Skip to content

Instantly share code, notes, and snippets.

@realvictorprm
Last active June 12, 2018 19:41
Show Gist options
  • Save realvictorprm/d95bf2c45b5cb6cc3afa04465055cb94 to your computer and use it in GitHub Desktop.
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!
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!
@vilinski
Copy link

@amieres that's not about paket. GitHub has disabled TLS <= 1.2 How to enable TLS 1.2.

@amieres
Copy link

amieres commented Jun 12, 2018

@Zagrophyte

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