Skip to content

Commit

Permalink
Merge pull request #1 from Bugagazavr/cleanup
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
kzaitsev committed Mar 13, 2016
2 parents 32484cb + edc12f0 commit 08e1ffe
Show file tree
Hide file tree
Showing 10 changed files with 418 additions and 355 deletions.
5 changes: 1 addition & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@

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

all: deps crosscompile version dist
all: deps crosscompile dist

deps:
go get github.com/mitchellh/gox
go get ./...

build:
go build grvm.go

crosscompile:
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}'
Expand Down
32 changes: 32 additions & 0 deletions doctor.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package main

import (
"fmt"
"os"
"os/exec"
"strings"

"github.com/codegangsta/cli"
)

func GetDoctor(c *cli.Context) {
if _, err := os.Stat(rubyBuildDirectory); os.IsNotExist(err) {
installRubyBuild()
}

updateAvailableRubies()
}

func installRubyBuild() {
fmt.Println("Install ruby-build")
args := []string{"clone", "https://github.com/rbenv/ruby-build.git", rubyBuildDirectory}

cmd := exec.Command("git", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

if err := cmd.Run(); err != nil {
fmt.Println("something going wrong, try to clone ruby-build manually: git", strings.Join(args, " "))
os.Exit(1)
}
}
28 changes: 28 additions & 0 deletions env.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package main

import (
"fmt"

"github.com/codegangsta/cli"
)

func GetEnv(c *cli.Context) {
var currentRuby string
var err error

if len(grvmRubyEnv) == 0 {
currentRuby, err = getDefaultRuby(c)
if err != nil {
Print(c, "Cannot get default ruby:", err.Error())
}
} else {
currentRuby = grvmRubyEnv
}

switch currentRuby {
case "system":
fmt.Println("export grvm_ruby=system")
default:
printEnv(currentRuby)
}
}
Loading

0 comments on commit 08e1ffe

Please sign in to comment.