Skip to content

Commit

Permalink
cleanup code a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
whyrusleeping committed Jun 29, 2016
1 parent eb3cea7 commit bd39fdf
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion install.go
Expand Up @@ -139,7 +139,7 @@ func (i *Install) MaybeStash() error {
if err != nil {
if strings.Contains(err.Error(), "could not find old") {
stump.Log("stash failed, no binary found.")
stump.Log("this could be because you have a daemon running, but no ipfs binary in your path.")
stump.Log(util.BoldText("this could be because you have a daemon running, but no ipfs binary in your path."))
stump.Log("continuing anyways, but skipping stash")
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion migrations.go
Expand Up @@ -157,7 +157,7 @@ func verifyMigrationSupportsVersion(fsrbin, v string) error {
return nil
}

stump.VLog(" - migrations doesnt support version %s, attempting to update")
stump.VLog(" - migrations doesnt support version %s, attempting to update", v)
_, err = GetMigrations()
if err != nil {
return err
Expand Down
9 changes: 5 additions & 4 deletions test-dist/testnew.go
Expand Up @@ -20,6 +20,7 @@ import (
func runCmd(p, bin string, args ...string) (string, error) {
cmd := exec.Command(bin, args...)
cmd.Env = []string{"IPFS_PATH=" + p}
stump.VLog(" - running: %s", cmd.Args)
out, err := cmd.CombinedOutput()
if err != nil {
return "", fmt.Errorf("%s: %s", err, string(out))
Expand Down Expand Up @@ -247,12 +248,12 @@ func TestBinary(bin, version string) error {
// test some basic things against the daemon
err = testFileAdd(tdir, bin)
if err != nil {
return err
return fmt.Errorf("test file add: %s", err)
}

err = testRefsList(tdir, bin)
if err != nil {
return err
return fmt.Errorf("test refs list: %s", err)
}

return nil
Expand All @@ -262,7 +263,7 @@ func testFileAdd(tdir, bin string) error {
stump.VLog(" - checking that we can add and cat a file")
text := "hello world! This node should work"
data := bytes.NewBufferString(text)
c := exec.Command(bin, "add", "-q")
c := exec.Command(bin, "add", "-q", "--progress=false")
c.Env = []string{"IPFS_PATH=" + tdir}
c.Stdin = data
out, err := c.CombinedOutput()
Expand All @@ -272,7 +273,7 @@ func testFileAdd(tdir, bin string) error {
return err
}

hash := strings.Trim(string(out), "\n \t")
hash := strings.Trim(string(out), "\n \t\r")
fiout, err := runCmd(tdir, bin, "cat", hash)
if err != nil {
return err
Expand Down
4 changes: 4 additions & 0 deletions util/utils.go
Expand Up @@ -192,3 +192,7 @@ func BeforeVersion(check, cur string) bool {
}
return false
}

func BoldText(s string) string {
return fmt.Sprintf("\033[1m%s\033[0m")
}

0 comments on commit bd39fdf

Please sign in to comment.