main file field removed, no longer necessary
This commit is contained in:
parent
6f6175e7dd
commit
8a62b64729
|
@ -7,7 +7,7 @@
|
|||
|
||||
![Logo](http://i.imgur.com/8nr2s1b.jpg)
|
||||
|
||||
A Golang build system with file watchers and live reload. Run, build and watch file changes with custom paths
|
||||
A Golang build system with file watchers, output streams and live reload. Run, build and watch file changes with custom paths
|
||||
|
||||
![Preview](http://i.imgur.com/XljkxAA.png)
|
||||
|
||||
|
@ -38,7 +38,6 @@ A Golang build system with file watchers and live reload. Run, build and watch f
|
|||
|
||||
```
|
||||
--name="Project Name" -> Name, if not specified sect "Sample App"
|
||||
--main="test.go" -> Main file, if not specified sect "main.go"
|
||||
--base="server" -> Base Path, if not specified sect "/"
|
||||
--build="true" -> Go build, if not specified sect "false"
|
||||
--bin="false" -> Base Path, if not specified sect "true"
|
||||
|
@ -46,7 +45,7 @@ A Golang build system with file watchers and live reload. Run, build and watch f
|
|||
```
|
||||
|
||||
```
|
||||
$ realize start --name="Web Server" --main="test.go" --base="server"
|
||||
$ realize start --name="Web Server" --base="server"
|
||||
```
|
||||
|
||||
- Add another project whenever you want
|
||||
|
@ -57,7 +56,7 @@ A Golang build system with file watchers and live reload. Run, build and watch f
|
|||
Or
|
||||
|
||||
```
|
||||
$ realize add --name="Project Name" --main="main.go" --build="true"
|
||||
$ realize add --name="Project Name" --build="true"
|
||||
```
|
||||
- Remove a project by his name
|
||||
|
||||
|
|
2
main.go
2
main.go
|
@ -52,7 +52,6 @@ func main() {
|
|||
Usage: "Create the initial config",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{Name: "name", Aliases: []string{"n"}, Value: "Sample App", Usage: "Project name \t"},
|
||||
&cli.StringFlag{Name: "main", Aliases: []string{"m"}, Value: "main.go", Usage: "Project main file \t"},
|
||||
&cli.StringFlag{Name: "base", Aliases: []string{"b"}, Value: "/", Usage: "Project base path \t"},
|
||||
&cli.BoolFlag{Name: "build", Value: false},
|
||||
&cli.BoolFlag{Name: "run", Value: true},
|
||||
|
@ -74,7 +73,6 @@ func main() {
|
|||
Usage: "Add another project",
|
||||
Flags: []cli.Flag{
|
||||
&cli.StringFlag{Name: "name", Aliases: []string{"n"}, Value: "Sample App", Usage: "Project name \t"},
|
||||
&cli.StringFlag{Name: "main", Aliases: []string{"m"}, Value: "main.go", Usage: "Project main file \t"},
|
||||
&cli.StringFlag{Name: "base", Aliases: []string{"b"}, Value: "/", Usage: "Project base path \t"},
|
||||
&cli.BoolFlag{Name: "build", Value: false},
|
||||
&cli.BoolFlag{Name: "run", Value: true},
|
||||
|
|
|
@ -24,7 +24,6 @@ func New(params *cli.Context) *Config {
|
|||
Projects: []Project{
|
||||
{
|
||||
Name: params.String("name"),
|
||||
Main: params.String("main"),
|
||||
Path: params.String("base"),
|
||||
Run: params.Bool("run"),
|
||||
Build: params.Bool("build"),
|
||||
|
@ -42,7 +41,7 @@ func New(params *cli.Context) *Config {
|
|||
// Duplicates check projects with same name or same combinations of main/path
|
||||
func Duplicates(value Project, arr []Project) bool {
|
||||
for _, val := range arr {
|
||||
if value.Main == val.Main && value.Path == val.Path || value.Name == val.Name {
|
||||
if value.Path == val.Path || value.Name == val.Name {
|
||||
Fail("There is a duplicate of '"+val.Name+"'. Check your config file!")
|
||||
return true
|
||||
}
|
||||
|
@ -106,7 +105,6 @@ func (h *Config) Add(params *cli.Context) error {
|
|||
if err == nil {
|
||||
new := Project{
|
||||
Name: params.String("name"),
|
||||
Main: params.String("main"),
|
||||
Path: params.String("base"),
|
||||
Run: params.Bool("run"),
|
||||
Build: params.Bool("build"),
|
||||
|
@ -154,7 +152,6 @@ func (h *Config) List() error {
|
|||
if err == nil {
|
||||
for _, val := range h.Projects {
|
||||
fmt.Println(green("|"), green(val.Name))
|
||||
fmt.Println(greenl("|"), "\t", green("Main File:"), red(val.Main))
|
||||
fmt.Println(greenl("|"), "\t", green("Base Path:"), red(val.Path))
|
||||
fmt.Println(greenl("|"), "\t", green("Run:"), red(val.Run))
|
||||
fmt.Println(greenl("|"), "\t", green("Build:"), red(val.Build))
|
||||
|
|
|
@ -18,7 +18,6 @@ type Project struct {
|
|||
base string
|
||||
Name string `yaml:"app_name,omitempty"`
|
||||
Path string `yaml:"app_path,omitempty"`
|
||||
Main string `yaml:"app_main,omitempty"`
|
||||
Run bool `yaml:"app_run,omitempty"`
|
||||
Bin bool `yaml:"app_bin,omitempty"`
|
||||
Build bool `yaml:"app_build,omitempty"`
|
||||
|
|
|
@ -78,16 +78,11 @@ func (p *Project) Watching() {
|
|||
}
|
||||
defer end()
|
||||
|
||||
p.Main = slash(p.Main)
|
||||
p.base = base + p.Path
|
||||
|
||||
for _, dir := range p.Watcher.Paths {
|
||||
// check main existence
|
||||
dir = slash(dir)
|
||||
if _, err := os.Stat(p.base + dir + p.Main); err != nil {
|
||||
Fail(p.Name + ": \t" + p.base + dir + p.Main + " doesn't exist. Main is required")
|
||||
return
|
||||
}
|
||||
|
||||
base = p.base + dir
|
||||
if _, err := os.Stat(base); err == nil {
|
||||
|
|
Loading…
Reference in New Issue