Skip to content

Commit

Permalink
Added versions
Browse files Browse the repository at this point in the history
  • Loading branch information
kzaitsev committed Mar 12, 2016
1 parent 43671b0 commit 5b27942
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
14 changes: 8 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.PHONY: all clean dist
.PHONY: all clean dist version

all: deps crosscompile dist
VERSION := $(shell if [ -z "$$TRAVIS_TAG" ]; then echo "dev"; else echo "$$TRAVIS_TAG" | tail -c +2; fi)

all: deps crosscompile version dist

deps:
go get github.com/mitchellh/gox
Expand All @@ -10,10 +12,10 @@ build:
go build grvm.go

crosscompile:
gox --osarch="linux/amd64" --output="crosscompile/linux_amd64_grvm"
gox --osarch="linux/386" --output="crosscompile/linux_386_grvm"
gox --osarch="linux/arm" --output="crosscompile/linux_arm_grvm"
gox --osarch="darwin/amd64" --output="crosscompile/darwin_amd64_grvm"
gox --osarch="linux/amd64" --output="crosscompile/linux_amd64_grvm" --ldflags='-X main.version=${VERSION}'
gox --osarch="linux/386" --output="crosscompile/linux_386_grvm" --ldflags='-X main.version=${VERSION}'
gox --osarch="linux/arm" --output="crosscompile/linux_arm_grvm" --ldflags='-X main.version=${VERSION}'
gox --osarch="darwin/amd64" --output="crosscompile/darwin_amd64_grvm" --ldflags='-X main.version=${VERSION}'

dist:
@for target in crosscompile/*_grvm; do \
Expand Down
3 changes: 3 additions & 0 deletions grvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const (
rubyBuildRepo = "https://github.com/rbenv/ruby-build.git"
)

var version = ""

var currentHome = os.Getenv("HOME")
var grvmRuby = os.Getenv("grvm_ruby")
var grvmDirectory = fmt.Sprintf("%s/.grvm", currentHome)
Expand All @@ -39,6 +41,7 @@ func main() {
app := cli.NewApp()
app.Name = "GRVM"
app.Usage = "GRVM"
app.Version = version
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "shell, s",
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function tmpCleanup {

case $1 in
"devinstall")
go build grvm.go
go build --ldflags '-X main.version=dev' grvm.go
rm -rf $HOME/.grvm/bin
rm -rf $HOME/.grvm/scripts
mkdir -p $HOME/.grvm/bin
Expand Down

0 comments on commit 5b27942

Please sign in to comment.