-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
186 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
This project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## [0.2.0](https://github.com/shyiko/mysql-binlog-connector-java/compare/0.1.0...0.2.0) - 2016-03-24 | ||
|
||
### Added | ||
* `alias default`/`unalias default`, `which`, `deactivate` commands. | ||
|
||
## 0.1.0 - 2016-03-23 |
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,29 @@ | ||
package command | ||
|
||
import ( | ||
"errors" | ||
"io/ioutil" | ||
"github.com/shyiko/jabba/cfg" | ||
"path" | ||
"os" | ||
) | ||
|
||
func SetAlias(name string, ver string) (err error) { | ||
if name != "default" { | ||
return errors.New("At this point only 'default' alias is allowed") | ||
} | ||
if ver == "" { | ||
err = os.Remove(path.Join(cfg.Dir(), name + ".alias")) | ||
} else { | ||
err = ioutil.WriteFile(path.Join(cfg.Dir(), name + ".alias"), []byte(ver), 0666) | ||
} | ||
return | ||
} | ||
|
||
func GetAlias(name string) string { | ||
b, err := ioutil.ReadFile(path.Join(cfg.Dir(), name + ".alias")) | ||
if err != nil { | ||
return "" | ||
} | ||
return string(b) | ||
} |
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,24 @@ | ||
package command | ||
|
||
import ( | ||
"os" | ||
"github.com/shyiko/jabba/cfg" | ||
"path" | ||
"regexp" | ||
) | ||
|
||
func Deactivate() ([]string, error) { | ||
pth, _ := os.LookupEnv("PATH") | ||
rgxp := regexp.MustCompile(regexp.QuoteMeta(path.Join(cfg.Dir(), "jdk")) + "[^:]+[:]") | ||
// strip references to ~/.jabba/jdk/*, otherwise leave unchanged | ||
pth = rgxp.ReplaceAllString(pth, "") | ||
javaHome, overrideWasSet := os.LookupEnv("JAVA_HOME_BEFORE_JABBA") | ||
if !overrideWasSet { | ||
javaHome, _ = os.LookupEnv("JAVA_HOME") | ||
} | ||
return []string{ | ||
"export PATH=" + pth, | ||
"export JAVA_HOME=" + javaHome, | ||
"unset JAVA_HOME_BEFORE_JABBA", | ||
}, nil | ||
} |
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,14 @@ | ||
package command | ||
|
||
import ( | ||
"path" | ||
"github.com/shyiko/jabba/cfg" | ||
) | ||
|
||
func Which(ver string) (string, error) { | ||
resolved, err := resolveLocal(ver) | ||
if err != nil { | ||
return "", err | ||
} | ||
return path.Join(cfg.Dir(), "jdk", resolved), nil | ||
} |
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
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