Skip to content
This repository has been archived by the owner on Mar 5, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' of github.com:twitchtv/retool
Browse files Browse the repository at this point in the history
  • Loading branch information
spenczar committed Apr 11, 2017
2 parents c7c9f61 + 81cd5e8 commit 19fa97b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
15 changes: 15 additions & 0 deletions retool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,21 @@ func TestRetool(t *testing.T) {
}
})

t.Run("sync", func(t *testing.T) {
dir, cleanup := setupTempDir(t)
defer cleanup()

runRetoolCmd(t, dir, retool, "add", "github.com/twitchtv/retool", "origin/master")

// Delete existing tools directory to try and trigger out of date
_ = os.RemoveAll(filepath.Join(dir, "_tools"))

// Should be able to sync
runRetoolCmd(t, dir, retool, "sync")

assertBinInstalled(t, dir, "retool")
})

t.Run("build", func(t *testing.T) {
t.Parallel()
dir, cleanup := setupTempDir(t)
Expand Down
7 changes: 2 additions & 5 deletions sync.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package main

import "os/exec"
import "os"

func (s spec) sync() {
m := getManifest()
if m.outOfDate(s.Tools) {
log("syncing")

// Delete existing tools directory
cmd := exec.Command("rm", "-r", "-f", toolDirPath)
_, err := cmd.Output()
err := os.RemoveAll(toolDirPath)
if err != nil {
fatalExec("failed to remove _tools ", err)
}
Expand Down

0 comments on commit 19fa97b

Please sign in to comment.