-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Bugagazavr/cleanup
Cleanup
- Loading branch information
Showing
10 changed files
with
418 additions
and
355 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
Oops, something went wrong.