Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

Commit

Permalink
update hofmod-cli, make local changes
Browse files Browse the repository at this point in the history
  • Loading branch information
verdverm committed Apr 12, 2020
1 parent 1e0bf02 commit faa35d8
Show file tree
Hide file tree
Showing 17 changed files with 166 additions and 48 deletions.
106 changes: 79 additions & 27 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,97 @@
build:
project_name: "mvs"

before:
hooks:
- go mod vendor

builds:
- binary: "mvs"
main: main.go
binary: mvs
ldflags: -s -w -X github.com/hofstadter-io/mvs/commands.Version={{.Version}} -X github.com/hofstadter-io/mvs/commands.Commit={{.ShortCommit}} -X github.com/hofstadter-io/mvs/commands.BuildDate={{.Date}}

ldflags:
- -s -w
- -X github.com/hofstadter-io/mvs/commands.Version={{.Version}}
- -X github.com/hofstadter-io/mvs/commands.Commit={{.FullCommit}}
- -X github.com/hofstadter-io/mvs/commands.BuildDate={{.Date}}
- -X github.com/hofstadter-io/mvs/commands.GoVersion=go1.14
- -X github.com/hofstadter-io/mvs/commands.BuildOS={{.Os}}
- -X github.com/hofstadter-io/mvs/commands.BuildArch={{.Arch}}
- -X github.com/hofstadter-io/mvs/commands.BuildArm={{.Arm}}

env:
- CGO_ENABLED=0
- CGO_ENABLED=0

goos:
- darwin
- linux
- windows
goarch:
- amd64
- arm64
- arm

archive:
format: tar.gz
format_overrides:
- goos: windows
format: zip
name_template: "{{.Binary}}_{{.Version}}_{{.Os}}-{{.Arch}}"
ignore:
- goos: linux
goarch: arm


snapshot:
name_template: "{{ .Tag }}-SNAPSHOT-{{.ShortCommit}}"

archives:
- format: binary
replacements:
amd64: 64bit
arm: ARM
arm64: ARM64
darwin: MacOS
darwin: Darwin
linux: Linux
windows: Windows
amd64: x86_64
# Needed hack for binary only uploads
# For more information, check #602
files:
- README.md
- LICENSE
- "thisfiledoesnotexist*"


checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_checksums.txt'

changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'

brew:
name: mvs
github:
owner: hofstadter-io
name: homebrew-tap
folder: Formula
commit_author:
name: verdverm
email: tony@hofstadter.io
homepage: https://github.com/hofstadter-io/mvs
description: 'MVS is a polyglot dependency management tool based on go mods'

release:
disable: true
draft: true
github:
owner: hofstadter-io
name: hof

dockers:
- binaries:
- mvs
skip_push: true
dockerfile: ci/docker/Dockerfile.jessie
image_templates:
- "hofstadter/{{.ProjectName}}:{{.Tag}}"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}"
- "hofstadter/{{.ProjectName}}:latest"

- "hofstadter/{{.ProjectName}}:{{.Tag}}-debian"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}-debian"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}-debian"
- "hofstadter/{{.ProjectName}}:latest-debian"


- binaries:
- mvs
skip_push: true
dockerfile: ci/docker/Dockerfile.scratch
image_templates:
- "hofstadter/{{.ProjectName}}:{{.Tag}}-scratch"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}.{{ .Minor }}-scratch"
- "hofstadter/{{.ProjectName}}:v{{ .Major }}-scratch"
- "hofstadter/{{.ProjectName}}:latest-scratch"
8 changes: 8 additions & 0 deletions ci/docker/Dockerfile.jessie
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM debian:jessie
MAINTAINER Hofstadter, Inc <open-source@hofstadter.io>

COPY mvs /usr/bin/local
ENTRYPOINT ["mvs"]

VOLUME ["/work"]
WORKDIR /work
8 changes: 8 additions & 0 deletions ci/docker/Dockerfile.scratch
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM scratch
MAINTAINER Hofstadter, Inc <open-source@hofstadter.io>

COPY mvs /
ENTRYPOINT ["/mvs"]

VOLUME ["/work"]
WORKDIR /work
21 changes: 12 additions & 9 deletions cli.cue
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,18 @@ CLI :: schema.Cli & {
"""

Releases: schema.GoReleaser & {
Author: "Tony Worm"
Homepage: "https://github.com/hofstadter-io/mvs"

Brew: {
GitHubOwner: "hofstadter-io"
GitHubRepoName: "homebrew-tap"
GitHubUsername: "verdverm"
GitHubEmail: "tony@hofstadter.io"
}
Author: "Tony Worm"
Homepage: "https://github.com/hofstadter-io/mvs"

GitHub: {
Owner: "hofstadter-io"
Repo: "hof"
}

Docker: {
Maintainer: "Hofstadter, Inc <open-source@hofstadter.io>"
Repo: "hofstadter"
}
}

OmitRun: true
Expand Down
3 changes: 3 additions & 0 deletions commands/convert.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package commands

import (

// hello... something might need to go here

"os"

"github.com/spf13/cobra"
Expand Down
3 changes: 3 additions & 0 deletions commands/graph.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package commands

import (

// hello... something might need to go here

"github.com/spf13/cobra"

"fmt"
Expand Down
3 changes: 3 additions & 0 deletions commands/hack.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package commands

import (

// hello... something might need to go here

"github.com/spf13/cobra"

"fmt"
Expand Down
3 changes: 3 additions & 0 deletions commands/info.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package commands

import (

// hello... something might need to go here

"github.com/spf13/cobra"

"fmt"
Expand Down
3 changes: 3 additions & 0 deletions commands/init.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package commands

import (

// hello... something might need to go here

"os"

"github.com/spf13/cobra"
Expand Down
3 changes: 3 additions & 0 deletions commands/status.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package commands

import (

// hello... something might need to go here

"github.com/spf13/cobra"

"fmt"
Expand Down
3 changes: 3 additions & 0 deletions commands/tidy.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package commands

import (

// hello... something might need to go here

"github.com/spf13/cobra"

"fmt"
Expand Down
3 changes: 3 additions & 0 deletions commands/vendor.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package commands

import (

// hello... something might need to go here

"github.com/spf13/cobra"

"fmt"
Expand Down
3 changes: 3 additions & 0 deletions commands/verify.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package commands

import (

// hello... something might need to go here

"github.com/spf13/cobra"

"fmt"
Expand Down
32 changes: 25 additions & 7 deletions commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,29 @@ package commands

import (
"fmt"
"os"
"time"

"github.com/spf13/cobra"
)

var (
Version = "dev"
Commit = "dirty"
BuiltBy = os.Getenv("USER")
BuildDate = time.Now().String()
Version = "Local"
Commit = "Dirty"

BuildDate = "Unknown"
GoVersion = "Unknown"
BuildOS = "Unknown"
BuildArch = "Unknown"
)

const versionMessage = `
Version: v%s
Commit: %s
BuildDate: %s
GoVersion: %s
OS / Arch: %s %s
`

var VersionLong = `Print the build version for mvs`

var VersionCmd = &cobra.Command{
Expand All @@ -30,7 +40,15 @@ var VersionCmd = &cobra.Command{
Long: VersionLong,

Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("Version: %v\nCommit: %v\nBuiltBy: %v\nBuildDate: %v\n", Version, Commit, BuiltBy, BuildDate)
fmt.Printf(
versionMessage,
Version,
Commit,
BuildDate,
GoVersion,
BuildOS,
BuildArch,
)
},
}

Expand Down
2 changes: 1 addition & 1 deletion cue.mods
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ cue 0.1.1

require (
github.com/hofstadter-io/cuelib v0.0.5
github.com/hofstadter-io/hofmod-cli v0.3.0
github.com/hofstadter-io/hofmod-cli v0.3.4
)
6 changes: 6 additions & 0 deletions cue.sums
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ github.com/hofstadter-io/cuetest v0.0.2 h1:UAzHAbZYF1dPck2qQAJ4FwhVC1op7F7s+4UC0
github.com/hofstadter-io/cuetest v0.0.2/cue.mods h1:KE5GytNGpbuRzzNWR5Lq7KAy04uu3fQ3hCClpF7+olE=
github.com/hofstadter-io/hof v0.2.5 h1:yvK+OFV6lOaTm9lEuo8PWXB9B0XoAqzF1Pdgoyd3VSE=
github.com/hofstadter-io/hof v0.2.5/cue.mods h1:swmc9Mr85o+M/oWXTPH+SebEQp3ptVAT0AoKlrLNEVo=
github.com/hofstadter-io/hof v0.2.9 h1:gL18XFCUmWzg+COh51fNlS0PD+X1pyr0cq0HSP1tE/8=
github.com/hofstadter-io/hof v0.2.9/cue.mods h1:dKBlrnHECy4JCN+Dsy7W0djaHgh241bRCUgClo2i6LU=
github.com/hofstadter-io/hofmod-cli v0.3.0 h1:+wCqHV08voZyt87uKKFpNOst6wON+OFOEqTViIF4Enk=
github.com/hofstadter-io/hofmod-cli v0.3.0/cue.mods h1:hvuTtdDNMFf5D9Jv0SfQfg2qRBOkFGb+EVOwkVtYKQI=
github.com/hofstadter-io/hofmod-cli v0.3.3 h1:JSuT+8Bm8b7CqSMZqtXuzSWt8bFCuGIsbd5UEmOKCSg=
github.com/hofstadter-io/hofmod-cli v0.3.3/cue.mods h1:YmxImIIBaXUl/P54xJqbLzLTFvpYCNQBhoyVCCfmad0=
github.com/hofstadter-io/hofmod-cli v0.3.4 h1:cpq6IIm9B3X8v8bIhxOLBRnhRSEcsrgK/nLbt29ChKY=
github.com/hofstadter-io/hofmod-cli v0.3.4/cue.mods h1:YmxImIIBaXUl/P54xJqbLzLTFvpYCNQBhoyVCCfmad0=
4 changes: 0 additions & 4 deletions lib/modder/modder_write.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ func (mdr *Modder) WriteVendor() error {
mdr.module.SumFile.Add(mver, modhash)

baseDir := path.Join(mdr.ModsDir, m.Module)
// TODO make billy FS here

if m.ReplaceVersion == "" {
m.ReplaceVersion = "latest"
}
fmt.Printf("Writing %-48s => %s\n", m.ReplaceModule + "@" + m.ReplaceVersion, baseDir)

// copy definite files always
Expand Down

0 comments on commit faa35d8

Please sign in to comment.