Skip to content
This repository was archived by the owner on Nov 17, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ If you want to bundle specified tag, branch or commit

If you want to bundle a repository that `go get` can't access

gom 'github.com/username/repository', :command => 'git clone http://example.com/repository.git'
gom 'github.com/username/repository', :command => 'git clone http://example.com/repository.git', :update => 'git fetch'

Todo
----
Expand Down
24 changes: 17 additions & 7 deletions install.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,25 @@ func (gom *Gom) Clone(args []string) error {
target = gom.name
}

var customCmd []string
srcdir := filepath.Join(vendor, "src", target)
customCmd := strings.Split(command, " ")
customCmd = append(customCmd, srcdir)

fmt.Printf("fetching %s (%v)\n", gom.name, customCmd)
err = run(customCmd, Blue)
if err != nil {
return err
if _, err := os.Stat(srcdir); err == nil || os.IsExist(err) {
if update, ok := gom.options["update"].(string); ok {
customCmd = strings.Split(update, " ")
customCmd = append(customCmd)
fmt.Printf("updating %s (%v)\n", gom.name, customCmd)
vcsExec(srcdir, customCmd...)
}
} else {
customCmd := strings.Split(command, " ")
customCmd = append(customCmd, srcdir)
fmt.Printf("fetching %s (%v)\n", gom.name, customCmd)
err = run(customCmd, Blue)
if err != nil {
return err
}
}

} else if private, ok := gom.options["private"].(string); ok {
if private == "true" {
target, ok := gom.options["target"].(string)
Expand Down