diff --git a/.gitignore b/.gitignore index e847409..6047bbd 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ # Paket package manager /.paket/paket.exe +/paket-files/ # NCrunch unit test runner *.ncrunchsolution diff --git a/paket-files/fsharp/FAKE/modules/Octokit/Octokit.fsx b/paket-files/fsharp/FAKE/modules/Octokit/Octokit.fsx deleted file mode 100644 index d951836..0000000 --- a/paket-files/fsharp/FAKE/modules/Octokit/Octokit.fsx +++ /dev/null @@ -1,82 +0,0 @@ -#I __SOURCE_DIRECTORY__ -#I @"../../../../../packages/Octokit/lib/net45" -#I @"../../../../../../packages/build/Octokit/lib/net45" -#r "Octokit.dll" - -open Octokit -open System -open System.IO - -type Draft = - { Client : GitHubClient - Owner : string - Project : string - DraftRelease : Release } - -let private isRunningOnMono = System.Type.GetType ("Mono.Runtime") <> null - -let rec private retry count asyncF = - // This retry logic causes an exception on Mono: - // https://github.com/fsharp/fsharp/issues/440 - if isRunningOnMono then - asyncF - else - async { - try - return! asyncF - with _ when count > 0 -> return! retry (count - 1) asyncF - } - -let createClient user password = - async { - let github = new GitHubClient(new ProductHeaderValue("FAKE")) - github.Credentials <- Credentials(user, password) - return github - } - -let createClientWithToken token = - async { - let github = new GitHubClient(new ProductHeaderValue("FAKE")) - github.Credentials <- Credentials(token) - return github - } - -let private makeRelease draft owner project version prerelease (notes:seq) (client : Async) = - async { - let data = new NewRelease(version) - data.Name <- version - data.Body <- String.Join(Environment.NewLine, notes) - data.Draft <- draft - data.Prerelease <- prerelease - let! client' = client - let! draft = Async.AwaitTask <| client'.Release.Create(owner, project, data) - let draftWord = if data.Draft then " draft" else "" - printfn "Created%s release id %d" draftWord draft.Id - return { Client = client' - Owner = owner - Project = project - DraftRelease = draft } - } |> retry 5 - -let createDraft owner project version prerelease notes client = makeRelease true owner project version prerelease notes client -let createRelease owner project version prerelease notes client = makeRelease false owner project version prerelease notes client - -let uploadFile fileName (draft : Async) = - async { - let fi = FileInfo(fileName) - let archiveContents = File.OpenRead(fi.FullName) - let assetUpload = new ReleaseAssetUpload(fi.Name,"application/octet-stream",archiveContents,Nullable()) - let! draft' = draft - let! asset = Async.AwaitTask <| draft'.Client.Release.UploadAsset(draft'.DraftRelease, assetUpload) - printfn "Uploaded %s" asset.Name - return draft' - } |> retry 5 - -let releaseDraft (draft : Async) = - async { - let! draft' = draft - let update = draft'.DraftRelease.ToUpdate() - update.Draft <- Nullable(false) - let! released = Async.AwaitTask <| draft'.Client.Release.Edit(draft'.Owner, draft'.Project, draft'.DraftRelease.Id, update) - printfn "Released %d on github" released.Id - } |> retry 5 diff --git a/paket-files/fsharp/FAKE/modules/Octokit/paket.version b/paket-files/fsharp/FAKE/modules/Octokit/paket.version deleted file mode 100644 index 75d0225..0000000 --- a/paket-files/fsharp/FAKE/modules/Octokit/paket.version +++ /dev/null @@ -1 +0,0 @@ -7d9f555b03d2d73dc615841ad3e49bd6cda07a81 diff --git a/stidgen.sln b/stidgen.sln index 556b1e3..5de050c 100644 --- a/stidgen.sln +++ b/stidgen.sln @@ -5,6 +5,7 @@ VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8D5C639B-3DFC-4CA4-8C3B-5CC939D3D8E8}" ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore build.cmd = build.cmd build.fsx = build.fsx paket.cmd = paket.cmd