Skip to content

Commit

Permalink
Merge pull request #9 from Clever/add-basepath-option
Browse files Browse the repository at this point in the history
Add basepath option
  • Loading branch information
Christian Griset committed Oct 23, 2015
2 parents 224ae87 + 9536079 commit 1085b15
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ repos:
# - it either
# (a) makes changes to files within the repo, outputs a commit message to stdout, and exits with code 0
# (b) exits with a nonzero exit code

# Basepath to prepend temp directories. Not including this option is okay and the program will assume ""
base_path: "path/to/prepend/tmpdir"
change_cmds:
# command paths can either be absolute paths, or paths relative to the configuration file.
- path: "/path/to/the/program"
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.0.1
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func (c Command) Validate() error {
// Config for gitbot.
type Config struct {
Repos []string `yaml:"repos"`
BasePath string `yaml:"base_path"`
ChangeCmds []Command `yaml:"change_cmds"`
PostCmds []Command `yaml:"post_cmds"`
}
Expand Down Expand Up @@ -104,9 +105,11 @@ func main() {
log.Fatal(err)
}

base_path := cfg.BasePath

for _, repo := range cfg.Repos {
// clone repo to temp directory
tempdir, err := ioutil.TempDir(os.TempDir(), "")
tempdir, err := ioutil.TempDir(base_path+os.TempDir(), "")
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 1085b15

Please sign in to comment.