Skip to content

Commit

Permalink
Merge pull request #12 from opalfroot/master
Browse files Browse the repository at this point in the history
Allow users to specify a build target directory - useful if for examp…
  • Loading branch information
markbates authored Jun 29, 2017
2 parents 457c415 + 9a293e4 commit 6796988
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ var initCmd = &cobra.Command{
AppRoot: ".",
IgnoredFolders: []string{"vendor", "log", "logs", "tmp", "node_modules", "bin", "templates"},
IncludedExtensions: []string{".go"},
BuildTargetPath: "",
BuildPath: os.TempDir(),
BuildDelay: 200,
BinaryName: "refresh-build",
Expand Down
1 change: 1 addition & 0 deletions refresh/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type Configuration struct {
AppRoot string `yaml:"app_root"`
IgnoredFolders []string `yaml:"ignored_folders"`
IncludedExtensions []string `yaml:"included_extensions"`
BuildTargetPath string `yaml:"build_target_path"`
BuildPath string `yaml:"build_path"`
BuildDelay time.Duration `yaml:"build_delay"`
BinaryName string `yaml:"binary_name"`
Expand Down
2 changes: 1 addition & 1 deletion refresh/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (r *Manager) build(events []fsnotify.Event) {

now := time.Now()
r.Logger.Print("Rebuild on: %s", strings.Join(eventNames, ", "))
cmd := exec.Command("go", "build", "-v", "-i", "-o", r.FullBuildPath())
cmd := exec.Command("go", "build", "-v", "-i", "-o", r.FullBuildPath(), r.Configuration.BuildTargetPath)
err := r.runAndListen(cmd)
if err != nil {
if strings.Contains(err.Error(), "no buildable Go source files") {
Expand Down

0 comments on commit 6796988

Please sign in to comment.