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

@@ -0,0 +1,15 @@
package commands
import (
"os"
"os/exec"
)
// Run executes an external command
func Run(command string, args []string, path string) error {
cmd := exec.Command(command, args...)
cmd.Dir = path
cmd.Stdout = os.Stderr
cmd.Stderr = os.Stderr
return cmd.Run()
}

30
utils/files/files.go Normal file
View File

@@ -0,0 +1,30 @@
package files
import (
"io"
"os"
)
// 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
}