diff --git a/common.go b/common.go index 463b18b..f00d93c 100644 --- a/common.go +++ b/common.go @@ -11,7 +11,7 @@ import ( const ( // TASK_PREFIX is a marker for scripts that don't produce content. - TASK_PREFIX = '@' + TASK_PREFIX = '_' // REDO_DIR names the hidden directory used for data and configuration. REDO_DIR = ".redo" diff --git a/dofile.go b/dofile.go index a1e0c34..7d7766b 100644 --- a/dofile.go +++ b/dofile.go @@ -34,7 +34,7 @@ extension removed. */ func (f *File) findDoFile() (*DoInfo, error) { - candidates := []string{f.Name + ".do"} + candidates := []string{f.Name + ".cmd"} ext := strings.Split(f.Name, ".") for i := 0; i < len(ext); i++ { candidates = append(candidates, strings.Join(append(append([]string{"default"}, ext[i+1:]...), "do"), ".")) @@ -70,7 +70,7 @@ TOP: return &DoInfo{Missing: missing}, nil } -const shell = "/bin/sh" +const shell = "cmd.exe" // RunDoFile executes the do file script, records the metadata for the resulting output, then // saves the resulting output to the target file, if applicable. @@ -156,6 +156,7 @@ func (target *File) RunDoFile(doInfo *DoInfo) (err error) { return target.Errorf(".do file %s wrote to stdout and to file $3", target.DoFile) } + os.Remove(target.Fullpath()) //LOC err = os.Rename(out.Name(), target.Fullpath()) if err != nil && strings.Index(err.Error(), "cross-device") > -1 { @@ -180,12 +181,12 @@ func (target *File) RunDoFile(doInfo *DoInfo) (err error) { func (target *File) runCmd(outputs [2]*Output, doInfo *DoInfo) error { - args := []string{"-e"} + args := []string{"/c"} if ShellArgs != "" { - if ShellArgs[0] != '-' { - ShellArgs = "-" + ShellArgs - } + //if ShellArgs[0] != '-' { + // ShellArgs = "-" + ShellArgs + //} args = append(args, ShellArgs) } diff --git a/redux/ifx.go b/redux/ifx.go index 259d407..2357ab1 100644 --- a/redux/ifx.go +++ b/redux/ifx.go @@ -8,7 +8,7 @@ import ( "fmt" "os" - "github.com/gyepisam/redux" + "github.com/maqroll/redux" ) var cmdIfCreate = &Command{ @@ -56,7 +56,7 @@ func redoIfX(args []string, fn func(*redux.File, *redux.File) error) error { } wd := os.Getenv("REDO_PARENT_DIR") - + // The action is triggered by dependent. dependent, err := redux.NewFile(wd, dependentPath) if err != nil { diff --git a/redux/init.go b/redux/init.go index 8042dd3..ea2172b 100644 --- a/redux/init.go +++ b/redux/init.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "github.com/gyepisam/redux" + "github.com/maqroll/redux" ) var cmdInit = &Command{ diff --git a/redux/install.go b/redux/install.go index 732638e..92cde31 100644 --- a/redux/install.go +++ b/redux/install.go @@ -13,7 +13,7 @@ import ( "strings" ) -const docPkg = "github.com/gyepisam/redux" +const docPkg = "github.com/maqroll/redux" var cmdInstall = &Command{ UsageLine: "redux install [OPTIONS] [component, ...]", diff --git a/redux/redo.go b/redux/redo.go index c204d85..e15ade4 100644 --- a/redux/redo.go +++ b/redux/redo.go @@ -8,12 +8,12 @@ import ( "github.com/gyepisam/fileutils" "github.com/gyepisam/multiflag" - "github.com/gyepisam/redux" + "github.com/maqroll/redux" ) const ( DEFAULT_TARGET = string(redux.TASK_PREFIX) + "all" - DEFAULT_DO = DEFAULT_TARGET + ".do" + DEFAULT_DO = DEFAULT_TARGET + ".cmd" ) var cmdRedo = &Command{ @@ -77,11 +77,10 @@ func runRedo(targets []string) error { redux.ShellArgs = s } - // if shell args are set, ensure that at least minimal verbosity is also set. - if redux.ShellArgs != "" && (verbosity.NArg() == 0) { - verbosity.Set("true") - } - + // if shell args are set, ensure that at least minimal verbosity is also set. + if redux.ShellArgs != "" && (verbosity.NArg() == 0) { + verbosity.Set("true") + } // Set explicit options to avoid clobbering environment inherited options. if n := verbosity.NArg(); n > 0 { @@ -94,7 +93,6 @@ func runRedo(targets []string) error { redux.Debug = true } - // If no arguments are specified, use run default target if its .do file exists. // Otherwise, print usage and exit. if len(targets) == 0 { diff --git a/z_test.go b/z_test.go index 7ad89e5..eb6dabf 100644 --- a/z_test.go +++ b/z_test.go @@ -28,7 +28,7 @@ func init() { bin := filepath.Join(binDir, "/redux") - err = exec.Command("go", "build", "-o", bin, "github.com/gyepisam/redux/redux").Run() + err = exec.Command("go", "build", "-o", bin, "github.com/maqroll/redux/redux").Run() if err != nil { panic(err) }