Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 03ca26b
Showing
7 changed files
with
827 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Compiled Object files, Static and Dynamic libs (Shared Objects) | ||
*.o | ||
*.a | ||
*.so | ||
|
||
# Folders | ||
_obj | ||
_test | ||
|
||
# Architecture specific extensions/prefixes | ||
*.[568vq] | ||
[568vq].out | ||
|
||
*.cgo1.go | ||
*.cgo2.c | ||
_cgo_defun.c | ||
_cgo_gotypes.go | ||
_cgo_export.* | ||
|
||
_testmain.go | ||
|
||
*.exe | ||
*.test | ||
*.prof | ||
|
||
|
||
.idea | ||
.glide | ||
.DS_Store | ||
|
||
docker | ||
vendor |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Realize | ||
|
||
### Overview | ||
Run, build and watch file changes with custom paths |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package: project | ||
import: | ||
- package: github.com/labstack/echo | ||
version: ^2.0.2 | ||
subpackages: | ||
- engine/standard | ||
- package: gopkg.in/urfave/cli.v2 | ||
version: ^1.18.0 | ||
- package: gopkg.in/yaml.v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package main | ||
|
||
import ( | ||
"os" | ||
"gopkg.in/urfave/cli.v2" | ||
"fmt" | ||
"github.com/labstack/echo" | ||
"net/http" | ||
"gopkg.in/yaml.v2" | ||
"github.com/labstack/echo/engine/standard" | ||
"realize" | ||
) | ||
|
||
func main() { | ||
|
||
t := realize.Config{App_file:"realize.config.yml"} | ||
t.Create() | ||
|
||
app := &cli.App{ | ||
Name: "realize", | ||
Version: "1.0", | ||
Usage: "A sort of Webpack for Go. Run, build and watch file changes with custom paths", | ||
Commands: []*cli.Command{ | ||
{ | ||
Name: "run", | ||
Usage: "Build and watch file changes", | ||
Action: func(c *cli.Context) error { | ||
fmt.Printf("Hello %q", c.String("run")) | ||
return nil | ||
}, | ||
}, | ||
{ | ||
Name: "start", | ||
Category: "config", | ||
Usage: "create the initial config file", | ||
}, | ||
}, | ||
Flags: []cli.Flag { | ||
&cli.StringFlag{ | ||
Name: "run", | ||
Value: "main.go", | ||
Usage: "main file of your project", | ||
}, | ||
}, | ||
} | ||
|
||
app.Run(os.Args) | ||
|
||
// web server | ||
e := echo.New() | ||
e.GET("/", func(c echo.Context) error { | ||
return c.String(http.StatusOK, "Hello, World!") | ||
}) | ||
e.Run(standard.New("0.0.0.0:8080")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package realize | ||
|
||
import ( | ||
"os" | ||
) | ||
|
||
type Config struct { | ||
App_file string | ||
app_main []string | ||
app_version string | ||
app_build bool | ||
app_run struct { | ||
before, after, paths, ext []string | ||
} | ||
} | ||
|
||
// Create config yaml file | ||
func (h *Config) Create() bool{ | ||
var config = Check(h.App_file) | ||
if config[0] == false { | ||
if _, err := os.Create("realize.config.yml"); err == nil { | ||
return true | ||
}else{ | ||
panic(err) | ||
} | ||
} | ||
return false | ||
} | ||
|
||
// Read config file | ||
func (h *Config) Read(field string) bool { | ||
return true | ||
} | ||
|
||
// Check files exists | ||
func Check(files ...string) []bool{ | ||
var result []bool | ||
for _, val := range files { | ||
if _, err := os.Stat(val); err == nil { | ||
result = append(result,true) | ||
} | ||
result = append(result, false) | ||
} | ||
return result | ||
} | ||
|
||
|