Last active
November 16, 2020 12:35
-
-
Save MiloszKrajewski/140a0b6da12b8c987a3ac343e4f2506a to your computer and use it in GitHub Desktop.
Self bootstrapping F# script
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.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 () |
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
{ | |
"version": 1, | |
"isRoot": true, | |
"tools": { | |
"paket": { | |
"version": "5.255.0", | |
"commands": [ | |
"paket" | |
] | |
} | |
} | |
} |
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
source https://nuget.org/api/v2 | |
storage none | |
framework netcoreapp31 | |
nuget Newtonsoft.Json |
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
@dotnet fsi "%~dp0\test.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
#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