Skip to content

Instantly share code, notes, and snippets.

@MiloszKrajewski
Last active November 16, 2020 12:35
Show Gist options
  • Save MiloszKrajewski/140a0b6da12b8c987a3ac343e4f2506a to your computer and use it in GitHub Desktop.
Save MiloszKrajewski/140a0b6da12b8c987a3ac343e4f2506a to your computer and use it in GitHub Desktop.
Self bootstrapping F# script
open System.Diagnostics
let root = __SOURCE_DIRECTORY__
let debug = false
let exec directory executable arguments =
let info =
ProcessStartInfo(
executable, arguments,
UseShellExecute = false, CreateNoWindow = not debug, WorkingDirectory = directory)
let proc = Process.Start(info)
proc.WaitForExit()
match proc.ExitCode with | 0 -> () | c -> failwithf "Execution failed with error code %d" c
let dotnet arguments = exec root "dotnet" arguments
let restore () =
dotnet "tool restore"
dotnet "tool run paket install"
dotnet "tool run paket generate-load-scripts"
restore ()
{
"version": 1,
"isRoot": true,
"tools": {
"paket": {
"version": "5.255.0",
"commands": [
"paket"
]
}
}
}
source https://nuget.org/api/v2
storage none
framework netcoreapp31
nuget Newtonsoft.Json
@dotnet fsi "%~dp0\test.fsx" %*
#load "bootstrap.fsx"
#load "./.paket/load/main.group.fsx"
open System
open Newtonsoft.Json
printfn "%A" fsi.CommandLineArgs
{|
Text = "Greetings from paket powered fsx bootstrapper"
Timestamp = DateTime.Now
|}
|> JsonConvert.SerializeObject
|> printfn "%s"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment