Merge pull request #179 from noomz/master
Replace Tool.Dir with new property Tool.Path
This commit is contained in:
commit
17b324d363
|
@ -5,7 +5,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/fsnotify/fsnotify"
|
|
||||||
"log"
|
"log"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
|
@ -17,6 +16,8 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/fsnotify/fsnotify"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -586,13 +587,13 @@ func (p *Project) run(path string, stream chan Response, stop <-chan bool) (err
|
||||||
args = append(args, a...)
|
args = append(args, a...)
|
||||||
}
|
}
|
||||||
dirPath := os.Getenv("GOBIN")
|
dirPath := os.Getenv("GOBIN")
|
||||||
if p.Tools.Run.Dir != "" {
|
if p.Tools.Run.Path != "" {
|
||||||
dirPath, _ = filepath.Abs(p.Tools.Run.Dir)
|
dirPath, _ = filepath.Abs(p.Tools.Run.Path)
|
||||||
}
|
}
|
||||||
name := filepath.Base(path)
|
name := filepath.Base(path)
|
||||||
if path == "." && p.Tools.Run.Dir == "" {
|
if path == "." && p.Tools.Run.Path == "" {
|
||||||
name = filepath.Base(Wdir())
|
name = filepath.Base(Wdir())
|
||||||
} else if p.Tools.Run.Dir != "" {
|
} else if p.Tools.Run.Path != "" {
|
||||||
name = filepath.Base(dirPath)
|
name = filepath.Base(dirPath)
|
||||||
}
|
}
|
||||||
path = filepath.Join(dirPath, name)
|
path = filepath.Join(dirPath, name)
|
||||||
|
@ -618,6 +619,9 @@ func (p *Project) run(path string, stream chan Response, stop <-chan bool) (err
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if p.Tools.Run.Dir != "" {
|
||||||
|
build.Dir = p.Tools.Run.Dir
|
||||||
|
}
|
||||||
if err := build.Start(); err != nil {
|
if err := build.Start(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ package realize
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/labstack/echo"
|
"github.com/labstack/echo"
|
||||||
"github.com/labstack/echo/middleware"
|
"github.com/labstack/echo/middleware"
|
||||||
|
@ -14,7 +15,6 @@ import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Dafault host and port
|
// Dafault host and port
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
type Tool struct {
|
type Tool struct {
|
||||||
Args []string `yaml:"args,omitempty" json:"args,omitempty"`
|
Args []string `yaml:"args,omitempty" json:"args,omitempty"`
|
||||||
Method string `yaml:"method,omitempty" json:"method,omitempty"`
|
Method string `yaml:"method,omitempty" json:"method,omitempty"`
|
||||||
|
Path string `yaml:"path,omitempty" json:"dir,omitempty"`
|
||||||
Dir string `yaml:"dir,omitempty" json:"dir,omitempty"` //wdir of the command
|
Dir string `yaml:"dir,omitempty" json:"dir,omitempty"` //wdir of the command
|
||||||
Status bool `yaml:"status,omitempty" json:"status,omitempty"`
|
Status bool `yaml:"status,omitempty" json:"status,omitempty"`
|
||||||
Output bool `yaml:"output,omitempty" json:"output,omitempty"`
|
Output bool `yaml:"output,omitempty" json:"output,omitempty"`
|
||||||
|
|
Loading…
Reference in New Issue