From 5648147f50adefb3bc9cc492bbca68f2671e00c9 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 3 Mar 2016 21:15:54 +0000 Subject: [PATCH] fix #62# --- .travis.yml | 1 + config/config.go | 2 +- insthugo/insthugo.go => hugo/hugo.go | 9 +++++---- 3 files changed, 7 insertions(+), 5 deletions(-) rename insthugo/insthugo.go => hugo/hugo.go (98%) diff --git a/.travis.yml b/.travis.yml index ab3274af..a0868c0d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ install: - go get github.com/mholt/caddy - go get github.com/spf13/hugo - go get github.com/robfig/cron +- go get github.com/mitchellh/go-homedir - go get github.com/caddyserver/caddydev - go get github.com/caddyserver/caddyext - go install github.com/caddyserver/caddydev diff --git a/config/config.go b/config/config.go index 45a2906e..80fd950e 100644 --- a/config/config.go +++ b/config/config.go @@ -23,7 +23,7 @@ func ParseHugo(c *setup.Controller) (*Config, error) { Path: "./", } - conf.Hugo = insthugo.GetPath() + conf.Hugo = hugo.GetPath() for c.Next() { args := c.RemainingArgs() diff --git a/insthugo/insthugo.go b/hugo/hugo.go similarity index 98% rename from insthugo/insthugo.go rename to hugo/hugo.go index 6babbffe..57299817 100644 --- a/insthugo/insthugo.go +++ b/hugo/hugo.go @@ -1,4 +1,4 @@ -package insthugo +package hugo import ( "archive/zip" @@ -12,9 +12,10 @@ import ( "net/http" "os" "os/exec" - "os/user" "path/filepath" "runtime" + + "github.com/mitchellh/go-homedir" ) const ( @@ -117,13 +118,13 @@ func initializeVariables() { exename = "hugo_" + version + "_" + runtime.GOOS + "_" + runtime.GOARCH zipname = exename - usr, err := user.Current() + homedir, err := homedir.Dir() if err != nil { fmt.Println(err) os.Exit(-1) } - caddy = filepath.Join(usr.HomeDir, ".caddy") + caddy = filepath.Join(homedir, ".caddy") bin = filepath.Join(caddy, "bin") hugo = filepath.Join(bin, "hugo")