From 39e1169426c9549a75794a3606063a112f42eb9c Mon Sep 17 00:00:00 2001 From: Robert Lin Date: Tue, 20 Oct 2020 14:33:31 +0800 Subject: [PATCH] contrib(publish): fix shasum generation --- contrib/inertia-publish/main.go | 4 ++-- contrib/inertia-publish/templates/compiled.go | 24 ++++++++++++++++--- contrib/inertia-publish/templates/homebrew.rb | 4 ++-- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/contrib/inertia-publish/main.go b/contrib/inertia-publish/main.go index 1e7b96f2..0779077d 100644 --- a/contrib/inertia-publish/main.go +++ b/contrib/inertia-publish/main.go @@ -17,7 +17,7 @@ package main import ( "bytes" "crypto/sha256" - "encoding/base64" + "encoding/hex" "fmt" "io/ioutil" "os" @@ -52,7 +52,7 @@ func generateSums(buildDir string) map[string]string { } sum := sha256.Sum256(data) build := strings.Join(parts[len(parts)-2:], ".") - sums[build] = base64.URLEncoding.EncodeToString(sum[:]) + sums[build] = hex.EncodeToString(sum[:]) return nil }); err != nil { out.Fatal(err) diff --git a/contrib/inertia-publish/templates/compiled.go b/contrib/inertia-publish/templates/compiled.go index 19e92de8..bdb002f1 100644 --- a/contrib/inertia-publish/templates/compiled.go +++ b/contrib/inertia-publish/templates/compiled.go @@ -1,5 +1,5 @@ -// Code generated by fileb0x at "2020-10-19 17:39:03.884122 +0800 CST m=+0.002221724" from config file "b0x.yml" DO NOT EDIT. -// modification hash(22f0164af37face494499c8db451927c.8b5bd901918aaafa516694945edbbd75) +// Code generated by fileb0x at "2020-10-20 14:28:43.578405 +0800 CST m=+0.001866638" from config file "b0x.yml" DO NOT EDIT. +// modification hash(c5133d8dda0b111dd76ed258ac5eda8a.8b5bd901918aaafa516694945edbbd75) package templates @@ -35,8 +35,11 @@ type HTTPFS struct { Prefix string } +// FileTemplatesDocGo is "templates/doc.go" +var FileTemplatesDocGo = []byte("\x2f\x2f\x20\x50\x61\x63\x6b\x61\x67\x65\x20\x74\x65\x6d\x70\x6c\x61\x74\x65\x73\x20\x70\x72\x6f\x76\x69\x64\x65\x73\x20\x74\x65\x6d\x70\x6c\x61\x74\x65\x20\x73\x63\x72\x69\x70\x74\x73\x20\x66\x6f\x72\x20\x64\x69\x73\x74\x72\x69\x62\x75\x74\x69\x6f\x6e\x20\x63\x68\x61\x6e\x6e\x65\x6c\x73\x0a\x70\x61\x63\x6b\x61\x67\x65\x20\x74\x65\x6d\x70\x6c\x61\x74\x65\x73\x0a") + // FileTemplatesHomebrewRb is "templates/homebrew.rb" -var FileTemplatesHomebrewRb = []byte("\x63\x6c\x61\x73\x73\x20\x49\x6e\x65\x72\x74\x69\x61\x20\x3c\x20\x46\x6f\x72\x6d\x75\x6c\x61\x0a\x20\x20\x64\x65\x73\x63\x20\x22\x53\x69\x6d\x70\x6c\x65\x2c\x20\x73\x65\x6c\x66\x2d\x68\x6f\x73\x74\x65\x64\x20\x63\x6f\x6e\x74\x69\x6e\x75\x6f\x75\x73\x20\x64\x65\x70\x6c\x6f\x79\x6d\x65\x6e\x74\x22\x0a\x20\x20\x68\x6f\x6d\x65\x70\x61\x67\x65\x20\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x75\x62\x63\x6c\x61\x75\x6e\x63\x68\x70\x61\x64\x2f\x69\x6e\x65\x72\x74\x69\x61\x22\x0a\x20\x20\x62\x6f\x74\x74\x6c\x65\x20\x3a\x75\x6e\x6e\x65\x65\x64\x65\x64\x0a\x0a\x20\x20\x23\x20\x53\x74\x61\x62\x6c\x65\x0a\x20\x20\x76\x65\x72\x73\x69\x6f\x6e\x20\x22\x7b\x7b\x20\x2e\x56\x65\x72\x73\x69\x6f\x6e\x20\x7d\x7d\x22\x0a\x20\x20\x73\x68\x61\x32\x35\x36\x20\x22\x7b\x7b\x20\x69\x6e\x64\x65\x78\x20\x2e\x53\x68\x61\x32\x35\x36\x20\x22\x64\x61\x72\x77\x69\x6e\x2e\x61\x6d\x64\x36\x34\x22\x20\x7d\x7d\x22\x0a\x20\x20\x75\x72\x6c\x20\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x75\x62\x63\x6c\x61\x75\x6e\x63\x68\x70\x61\x64\x2f\x69\x6e\x65\x72\x74\x69\x61\x2f\x72\x65\x6c\x65\x61\x73\x65\x73\x2f\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x2f\x76\x23\x7b\x76\x65\x72\x73\x69\x6f\x6e\x7d\x2f\x69\x6e\x65\x72\x74\x69\x61\x2e\x76\x23\x7b\x76\x65\x72\x73\x69\x6f\x6e\x7d\x2e\x64\x61\x72\x77\x69\x6e\x2e\x61\x6d\x64\x36\x34\x22\x0a\x0a\x20\x20\x23\x20\x42\x75\x69\x6c\x64\x20\x66\x72\x6f\x6d\x20\x6c\x61\x74\x65\x73\x74\x20\x63\x6f\x6d\x6d\x69\x74\x0a\x20\x20\x68\x65\x61\x64\x20\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x75\x62\x63\x6c\x61\x75\x6e\x63\x68\x70\x61\x64\x2f\x69\x6e\x65\x72\x74\x69\x61\x2e\x67\x69\x74\x22\x0a\x20\x20\x68\x65\x61\x64\x20\x64\x6f\x0a\x20\x20\x20\x20\x76\x65\x72\x73\x69\x6f\x6e\x20\x22\x6c\x61\x74\x65\x73\x74\x22\x0a\x20\x20\x20\x20\x64\x65\x70\x65\x6e\x64\x73\x5f\x6f\x6e\x20\x22\x67\x6f\x22\x20\x3d\x3e\x20\x3a\x62\x75\x69\x6c\x64\x0a\x20\x20\x65\x6e\x64\x0a\x0a\x20\x20\x64\x65\x66\x20\x69\x6e\x73\x74\x61\x6c\x6c\x0a\x20\x20\x20\x20\x69\x66\x20\x62\x75\x69\x6c\x64\x2e\x68\x65\x61\x64\x3f\x0a\x20\x20\x20\x20\x20\x20\x73\x79\x73\x74\x65\x6d\x20\x22\x67\x6f\x22\x2c\x20\x22\x6d\x6f\x64\x22\x2c\x20\x22\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x22\x0a\x20\x20\x20\x20\x20\x20\x73\x79\x73\x74\x65\x6d\x20\x22\x67\x6f\x22\x2c\x20\x22\x62\x75\x69\x6c\x64\x22\x2c\x20\x22\x2d\x6f\x22\x2c\x20\x22\x23\x7b\x62\x69\x6e\x7d\x2f\x69\x6e\x65\x72\x74\x69\x61\x22\x0a\x20\x20\x20\x20\x65\x6c\x73\x65\x0a\x20\x20\x20\x20\x20\x20\x6d\x76\x20\x22\x69\x6e\x65\x72\x74\x69\x61\x2e\x76\x23\x7b\x76\x65\x72\x73\x69\x6f\x6e\x7d\x2e\x64\x61\x72\x77\x69\x6e\x2e\x61\x6d\x64\x36\x34\x22\x2c\x20\x22\x69\x6e\x65\x72\x74\x69\x61\x22\x0a\x20\x20\x20\x20\x20\x20\x62\x69\x6e\x2e\x69\x6e\x73\x74\x61\x6c\x6c\x20\x22\x69\x6e\x65\x72\x74\x69\x61\x22\x0a\x20\x20\x20\x20\x65\x6e\x64\x0a\x20\x20\x65\x6e\x64\x0a\x0a\x20\x20\x74\x65\x73\x74\x20\x64\x6f\x0a\x20\x20\x20\x20\x61\x73\x73\x65\x72\x74\x5f\x6d\x61\x74\x63\x68\x20\x76\x65\x72\x73\x69\x6f\x6e\x2e\x74\x6f\x5f\x73\x2c\x20\x73\x68\x65\x6c\x6c\x5f\x6f\x75\x74\x70\x75\x74\x28\x22\x23\x7b\x62\x69\x6e\x7d\x2f\x69\x6e\x65\x72\x74\x69\x61\x20\x2d\x2d\x76\x65\x72\x73\x69\x6f\x6e\x22\x29\x0a\x20\x20\x65\x6e\x64\x0a\x65\x6e\x64\x0a") +var FileTemplatesHomebrewRb = []byte("\x63\x6c\x61\x73\x73\x20\x49\x6e\x65\x72\x74\x69\x61\x20\x3c\x20\x46\x6f\x72\x6d\x75\x6c\x61\x0a\x20\x20\x64\x65\x73\x63\x20\x22\x53\x69\x6d\x70\x6c\x65\x2c\x20\x73\x65\x6c\x66\x2d\x68\x6f\x73\x74\x65\x64\x20\x63\x6f\x6e\x74\x69\x6e\x75\x6f\x75\x73\x20\x64\x65\x70\x6c\x6f\x79\x6d\x65\x6e\x74\x22\x0a\x20\x20\x68\x6f\x6d\x65\x70\x61\x67\x65\x20\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x75\x62\x63\x6c\x61\x75\x6e\x63\x68\x70\x61\x64\x2f\x69\x6e\x65\x72\x74\x69\x61\x22\x0a\x20\x20\x62\x6f\x74\x74\x6c\x65\x20\x3a\x75\x6e\x6e\x65\x65\x64\x65\x64\x0a\x0a\x20\x20\x23\x20\x53\x74\x61\x62\x6c\x65\x0a\x20\x20\x76\x65\x72\x73\x69\x6f\x6e\x20\x22\x7b\x7b\x20\x2e\x56\x65\x72\x73\x69\x6f\x6e\x20\x7d\x7d\x22\x0a\x20\x20\x73\x68\x61\x32\x35\x36\x20\x22\x7b\x7b\x20\x69\x6e\x64\x65\x78\x20\x2e\x53\x68\x61\x32\x35\x36\x20\x22\x64\x61\x72\x77\x69\x6e\x2e\x61\x6d\x64\x36\x34\x22\x20\x7d\x7d\x22\x0a\x20\x20\x75\x72\x6c\x20\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x75\x62\x63\x6c\x61\x75\x6e\x63\x68\x70\x61\x64\x2f\x69\x6e\x65\x72\x74\x69\x61\x2f\x72\x65\x6c\x65\x61\x73\x65\x73\x2f\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x2f\x23\x7b\x76\x65\x72\x73\x69\x6f\x6e\x7d\x2f\x69\x6e\x65\x72\x74\x69\x61\x2e\x23\x7b\x76\x65\x72\x73\x69\x6f\x6e\x7d\x2e\x64\x61\x72\x77\x69\x6e\x2e\x61\x6d\x64\x36\x34\x22\x0a\x0a\x20\x20\x23\x20\x42\x75\x69\x6c\x64\x20\x66\x72\x6f\x6d\x20\x6c\x61\x74\x65\x73\x74\x20\x63\x6f\x6d\x6d\x69\x74\x0a\x20\x20\x68\x65\x61\x64\x20\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x75\x62\x63\x6c\x61\x75\x6e\x63\x68\x70\x61\x64\x2f\x69\x6e\x65\x72\x74\x69\x61\x2e\x67\x69\x74\x22\x0a\x20\x20\x68\x65\x61\x64\x20\x64\x6f\x0a\x20\x20\x20\x20\x76\x65\x72\x73\x69\x6f\x6e\x20\x22\x6c\x61\x74\x65\x73\x74\x22\x0a\x20\x20\x20\x20\x64\x65\x70\x65\x6e\x64\x73\x5f\x6f\x6e\x20\x22\x67\x6f\x22\x20\x3d\x3e\x20\x3a\x62\x75\x69\x6c\x64\x0a\x20\x20\x65\x6e\x64\x0a\x0a\x20\x20\x64\x65\x66\x20\x69\x6e\x73\x74\x61\x6c\x6c\x0a\x20\x20\x20\x20\x69\x66\x20\x62\x75\x69\x6c\x64\x2e\x68\x65\x61\x64\x3f\x0a\x20\x20\x20\x20\x20\x20\x73\x79\x73\x74\x65\x6d\x20\x22\x67\x6f\x22\x2c\x20\x22\x6d\x6f\x64\x22\x2c\x20\x22\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x22\x0a\x20\x20\x20\x20\x20\x20\x73\x79\x73\x74\x65\x6d\x20\x22\x67\x6f\x22\x2c\x20\x22\x62\x75\x69\x6c\x64\x22\x2c\x20\x22\x2d\x6f\x22\x2c\x20\x22\x23\x7b\x62\x69\x6e\x7d\x2f\x69\x6e\x65\x72\x74\x69\x61\x22\x0a\x20\x20\x20\x20\x65\x6c\x73\x65\x0a\x20\x20\x20\x20\x20\x20\x6d\x76\x20\x22\x69\x6e\x65\x72\x74\x69\x61\x2e\x23\x7b\x76\x65\x72\x73\x69\x6f\x6e\x7d\x2e\x64\x61\x72\x77\x69\x6e\x2e\x61\x6d\x64\x36\x34\x22\x2c\x20\x22\x69\x6e\x65\x72\x74\x69\x61\x22\x0a\x20\x20\x20\x20\x20\x20\x62\x69\x6e\x2e\x69\x6e\x73\x74\x61\x6c\x6c\x20\x22\x69\x6e\x65\x72\x74\x69\x61\x22\x0a\x20\x20\x20\x20\x65\x6e\x64\x0a\x20\x20\x65\x6e\x64\x0a\x0a\x20\x20\x74\x65\x73\x74\x20\x64\x6f\x0a\x20\x20\x20\x20\x61\x73\x73\x65\x72\x74\x5f\x6d\x61\x74\x63\x68\x20\x76\x65\x72\x73\x69\x6f\x6e\x2e\x74\x6f\x5f\x73\x2c\x20\x73\x68\x65\x6c\x6c\x5f\x6f\x75\x74\x70\x75\x74\x28\x22\x23\x7b\x62\x69\x6e\x7d\x2f\x69\x6e\x65\x72\x74\x69\x61\x20\x2d\x2d\x76\x65\x72\x73\x69\x6f\x6e\x22\x29\x0a\x20\x20\x65\x6e\x64\x0a\x65\x6e\x64\x0a") // FileTemplatesScoopJSON is "templates/scoop.json" var FileTemplatesScoopJSON = []byte("\x7b\x0a\x20\x20\x20\x20\x22\x76\x65\x72\x73\x69\x6f\x6e\x22\x3a\x20\x22\x7b\x7b\x20\x2e\x56\x65\x72\x73\x69\x6f\x6e\x20\x7d\x7d\x22\x2c\x0a\x20\x20\x20\x20\x22\x75\x72\x6c\x22\x3a\x20\x22\x68\x74\x74\x70\x73\x3a\x2f\x2f\x67\x69\x74\x68\x75\x62\x2e\x63\x6f\x6d\x2f\x75\x62\x63\x6c\x61\x75\x6e\x63\x68\x70\x61\x64\x2f\x69\x6e\x65\x72\x74\x69\x61\x2f\x72\x65\x6c\x65\x61\x73\x65\x73\x2f\x64\x6f\x77\x6e\x6c\x6f\x61\x64\x2f\x7b\x7b\x20\x2e\x56\x65\x72\x73\x69\x6f\x6e\x20\x7d\x7d\x2f\x69\x6e\x65\x72\x74\x69\x61\x2e\x7b\x7b\x20\x2e\x56\x65\x72\x73\x69\x6f\x6e\x20\x7d\x7d\x2e\x77\x69\x6e\x64\x6f\x77\x73\x2e\x33\x38\x36\x2e\x65\x78\x65\x22\x2c\x0a\x20\x20\x20\x20\x22\x62\x69\x6e\x22\x3a\x20\x22\x69\x6e\x65\x72\x74\x69\x61\x2e\x65\x78\x65\x22\x0a\x7d\x0a") @@ -54,6 +57,21 @@ func init() { var f webdav.File + f, err = FS.OpenFile(CTX, "templates/doc.go", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777) + if err != nil { + panic(err) + } + + _, err = f.Write(FileTemplatesDocGo) + if err != nil { + panic(err) + } + + err = f.Close() + if err != nil { + panic(err) + } + f, err = FS.OpenFile(CTX, "templates/homebrew.rb", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0777) if err != nil { panic(err) diff --git a/contrib/inertia-publish/templates/homebrew.rb b/contrib/inertia-publish/templates/homebrew.rb index 9b71a37b..d512b732 100644 --- a/contrib/inertia-publish/templates/homebrew.rb +++ b/contrib/inertia-publish/templates/homebrew.rb @@ -6,7 +6,7 @@ class Inertia < Formula # Stable version "{{ .Version }}" sha256 "{{ index .Sha256 "darwin.amd64" }}" - url "https://github.com/ubclaunchpad/inertia/releases/download/v#{version}/inertia.v#{version}.darwin.amd64" + url "https://github.com/ubclaunchpad/inertia/releases/download/#{version}/inertia.#{version}.darwin.amd64" # Build from latest commit head "https://github.com/ubclaunchpad/inertia.git" @@ -20,7 +20,7 @@ def install system "go", "mod", "download" system "go", "build", "-o", "#{bin}/inertia" else - mv "inertia.v#{version}.darwin.amd64", "inertia" + mv "inertia.#{version}.darwin.amd64", "inertia" bin.install "inertia" end end