bootstrap new version

This commit is contained in:
Henrique Dias
2016-06-28 14:59:33 +01:00
parent 1675403010
commit 83d9462ca1
16 changed files with 93 additions and 1111 deletions

View File

@@ -14,6 +14,7 @@ import (
"regexp"
"runtime"
"github.com/hacdias/caddy-hugo/utils/files"
"github.com/mitchellh/go-homedir"
"github.com/pivotal-golang/archiver/extractor"
)
@@ -90,7 +91,7 @@ func GetPath() string {
// Copy the file
fmt.Print("Moving Hugo executable... ")
err = CopyFile(exetorename, hugo)
err = files.CopyFile(exetorename, hugo)
if err != nil {
fmt.Println(err)
os.Exit(-1)
@@ -213,27 +214,3 @@ func checkSHA256() {
fmt.Println("checked!")
}
// CopyFile is used to copy a file
func CopyFile(old, new string) error {
// Open the file and create a new one
r, err := os.Open(old)
if err != nil {
return err
}
defer r.Close()
w, err := os.Create(new)
if err != nil {
return err
}
defer w.Close()
// Copy the content
_, err = io.Copy(w, r)
if err != nil {
return err
}
return nil
}