Merge pull request #142 from tockins/dev

Bug fix & improvement v2.0
This commit is contained in:
Alessio Pracchia 2017-12-16 17:58:20 +01:00 committed by GitHub
commit 005494afc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 288 additions and 220 deletions

2
.gitignore vendored
View File

@ -33,3 +33,5 @@ docker
vendor vendor
bin bin
glide.* glide.*
Dockerfile
docker-compose.yml

34
.realize.yaml Executable file
View File

@ -0,0 +1,34 @@
settings:
legacy:
force: false
interval: 0s
server:
status: true
open: true
port: 3000
host: localhost
schema:
- name: realize
path: .
commands:
generate:
status: true
install:
status: true
test:
status: true
fmt:
status: true
watcher:
paths:
- /
extensions:
- go
- html
- css
- js
ignored_paths:
- .git
- .realize
- vendor
- realize/assets

74
Gopkg.lock generated
View File

@ -1,40 +1,41 @@
memo = "26587affd3e0577e23a9c4afef3eaf279d9a013fe3d673c0dc1fd062f26d2d2e" # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/Sirupsen/logrus"
packages = ["."]
revision = "f006c2ac4710855cf0f916dd6b77acf6b048dc6e"
version = "v1.0.3"
[[projects]] [[projects]]
name = "github.com/dgrijalva/jwt-go" name = "github.com/dgrijalva/jwt-go"
packages = ["."] packages = ["."]
revision = "d2709f9f1f31ebcda9651b03077758c1f3a0018c" revision = "dbeaa9332f19a944acb5736b4456cfcc02140e29"
version = "v3.0.0" version = "v3.1.0"
[[projects]] [[projects]]
branch = "master"
name = "github.com/fatih/color" name = "github.com/fatih/color"
packages = ["."] packages = ["."]
revision = "1535ebc2637cc042c938f07fa26c6356ab8f8504" revision = "570b54cabe6b8eb0bc2dfce68d964677d63b5260"
version = "v1.5.0"
[[projects]] [[projects]]
branch = "master"
name = "github.com/fsnotify/fsnotify" name = "github.com/fsnotify/fsnotify"
packages = ["."] packages = ["."]
revision = "4da3e2cfbabc9f751898f250b49f2439785783a1" revision = "629574ca2a5df945712d3079857300b5e4da0236"
version = "v1.4.2"
[[projects]]
name = "github.com/go-siris/siris"
packages = ["core/errors"]
revision = "d6bc3df4b216199bec985043ca6c3e5c00232fd5"
version = "v7.4.0"
[[projects]] [[projects]]
branch = "master"
name = "github.com/labstack/echo" name = "github.com/labstack/echo"
packages = [".","middleware"] packages = [".","middleware"]
revision = "a625e589cffa33eac768ab98bc21518cef786e2d" revision = "0473c51f1dbd83487effce00702571d19033a6e5"
version = "3.2.5"
[[projects]] [[projects]]
name = "github.com/labstack/gommon" name = "github.com/labstack/gommon"
packages = ["bytes","color","log","random"] packages = ["bytes","color","log","random"]
revision = "779b8a8b9850a97acba6a3fe20feb628c39e17c1" revision = "57409ada9da0f2afad6664c49502f8c50fbd8476"
version = "0.2.2" version = "0.2.3"
[[projects]] [[projects]]
name = "github.com/mattn/go-colorable" name = "github.com/mattn/go-colorable"
@ -45,20 +46,26 @@ memo = "26587affd3e0577e23a9c4afef3eaf279d9a013fe3d673c0dc1fd062f26d2d2e"
[[projects]] [[projects]]
name = "github.com/mattn/go-isatty" name = "github.com/mattn/go-isatty"
packages = ["."] packages = ["."]
revision = "fc9e8d8ef48496124e79ae0df75490096eccf6fe" revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39"
version = "v0.0.2" version = "v0.0.3"
[[projects]]
name = "github.com/moby/moby"
packages = ["pkg/filenotify"]
revision = "092cba3727bb9b4a2f0e922cd6c0f93ea270e363"
version = "v1.13.1"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "github.com/satori/go.uuid"
packages = ["."]
revision = "5bf94b69c6b68ee1b541973bb8e1144db23a194b"
[[projects]]
name = "github.com/sirupsen/logrus"
packages = ["."]
revision = "d682213848ed68c0a260ca37d6dd5ace8423f5ba"
version = "v1.0.4"
[[projects]]
name = "github.com/tockins/interact" name = "github.com/tockins/interact"
packages = ["."] packages = ["."]
revision = "620e305cb360fbbaaec15504caada4303f65a370" revision = "f8fb5795b5d713c41dab6771ffe1fdfdfd0c3285"
version = "1.1.1"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -76,28 +83,35 @@ memo = "26587affd3e0577e23a9c4afef3eaf279d9a013fe3d673c0dc1fd062f26d2d2e"
branch = "master" branch = "master"
name = "golang.org/x/crypto" name = "golang.org/x/crypto"
packages = ["acme","acme/autocert","ssh/terminal"] packages = ["acme","acme/autocert","ssh/terminal"]
revision = "7d9177d70076375b9a59c8fde23d52d9c4a7ecd5" revision = "94eea52f7b742c7cbe0b03b22f0c4c8631ece122"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "golang.org/x/net" name = "golang.org/x/net"
packages = ["websocket"] packages = ["websocket"]
revision = "0744d001aa8470aaa53df28d32e5ceeb8af9bd70" revision = "d866cfc389cec985d6fda2859936a575a55a3ab6"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "golang.org/x/sys" name = "golang.org/x/sys"
packages = ["unix","windows"] packages = ["unix","windows"]
revision = "429f518978ab01db8bb6f44b66785088e7fba58b" revision = "d5840adf789d732bc8b00f37b26ca956a7cc8e79"
[[projects]] [[projects]]
branch = "v2" branch = "v2"
name = "gopkg.in/urfave/cli.v2" name = "gopkg.in/urfave/cli.v2"
packages = ["."] packages = ["."]
revision = "50a0fdeea6330854c7b05371cce1fac8c7e636d2" revision = "b2bf3c5abeb90da407891aecd1df2c5a1f6170c1"
[[projects]] [[projects]]
branch = "v2" branch = "v2"
name = "gopkg.in/yaml.v2" name = "gopkg.in/yaml.v2"
packages = ["."] packages = ["."]
revision = "eb3733d160e74a9c7e442f435eb3bea458e1d19f" revision = "287cf08546ab5e7e37d55a84f7ed3fd1db036de5"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "9a809196ffa8ff716d9be9eb2bc0342d0358b334fa50937a69a5c96bf60826f8"
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -1,28 +1,57 @@
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
[[dependencies]]
branch = "master" [[constraint]]
name = "github.com/fatih/color" name = "github.com/fatih/color"
version = "1.5.0"
[[dependencies]] [[constraint]]
branch = "master"
name = "github.com/fsnotify/fsnotify" name = "github.com/fsnotify/fsnotify"
version = "1.4.2"
[[dependencies]] [[constraint]]
branch = "master" name = "github.com/go-siris/siris"
version = "7.4.0"
[[constraint]]
name = "github.com/labstack/echo" name = "github.com/labstack/echo"
version = "3.2.5"
[[dependencies]] [[constraint]]
branch = "master" name = "github.com/sirupsen/logrus"
version = "1.0.4"
[[constraint]]
name = "github.com/tockins/interact" name = "github.com/tockins/interact"
version = "1.1.1"
[[dependencies]] [[constraint]]
branch = "master" branch = "master"
name = "golang.org/x/net" name = "golang.org/x/net"
[[dependencies]] [[constraint]]
branch = "v2" branch = "v2"
name = "gopkg.in/urfave/cli.v2" name = "gopkg.in/urfave/cli.v2"
[[dependencies]] [[constraint]]
branch = "v2" branch = "v2"
name = "gopkg.in/yaml.v2" name = "gopkg.in/yaml.v2"

View File

@ -1,5 +1,3 @@
//go:generate go-bindata -pkg=realize -o=realize/bindata.go realize/assets/...
package main package main
import ( import (

File diff suppressed because one or more lines are too long

View File

@ -190,14 +190,6 @@ func (p *Project) Reload(path string, stop <-chan bool) {
if err != nil { if err != nil {
p.Err(err) p.Err(err)
} }
// path dir
if !fi.IsDir() {
path := filepath.Dir(path)
fi, err = os.Stat(path)
if err != nil {
p.Err(err)
}
}
p.tools(stop, path, fi) p.tools(stop, path, fi)
} }
// Prevent fake events on polling startup // Prevent fake events on polling startup
@ -355,7 +347,7 @@ func (p *Project) Validate(path string, fiche bool) bool {
if !array(e, p.Watcher.Exts) { if !array(e, p.Watcher.Exts) {
return false return false
} }
} else { }
separator := string(os.PathSeparator) separator := string(os.PathSeparator)
// supported paths // supported paths
for _, v := range p.Watcher.Ignore { for _, v := range p.Watcher.Ignore {
@ -365,7 +357,6 @@ func (p *Project) Validate(path string, fiche bool) bool {
return false return false
} }
} }
}
// file check // file check
if fiche { if fiche {
fi, err := os.Stat(path) fi, err := os.Stat(path)

View File

@ -1,3 +1,5 @@
//go:generate go-bindata -pkg=realize -o=bindata.go assets/...
package realize package realize
import ( import (
@ -106,40 +108,40 @@ func (s *Server) Start() (err error) {
// web panel // web panel
e.GET("/", func(c echo.Context) error { e.GET("/", func(c echo.Context) error {
return s.render(c, "realize/assets/index.html", 1) return s.render(c, "assets/index.html", 1)
}) })
e.GET("/assets/js/all.min.js", func(c echo.Context) error { e.GET("/assets/js/all.min.js", func(c echo.Context) error {
return s.render(c, "realize/assets/assets/js/all.min.js", 2) return s.render(c, "assets/assets/js/all.min.js", 2)
}) })
e.GET("/assets/css/app.css", func(c echo.Context) error { e.GET("/assets/css/app.css", func(c echo.Context) error {
return s.render(c, "realize/assets/assets/css/app.css", 3) return s.render(c, "assets/assets/css/app.css", 3)
}) })
e.GET("/app/components/settings/index.html", func(c echo.Context) error { e.GET("/app/components/settings/index.html", func(c echo.Context) error {
return s.render(c, "realize/assets/app/components/settings/index.html", 1) return s.render(c, "assets/app/components/settings/index.html", 1)
}) })
e.GET("/app/components/project/index.html", func(c echo.Context) error { e.GET("/app/components/project/index.html", func(c echo.Context) error {
return s.render(c, "realize/assets/app/components/project/index.html", 1) return s.render(c, "assets/app/components/project/index.html", 1)
}) })
e.GET("/app/components/index.html", func(c echo.Context) error { e.GET("/app/components/index.html", func(c echo.Context) error {
return s.render(c, "realize/assets/app/components/index.html", 1) return s.render(c, "assets/app/components/index.html", 1)
}) })
e.GET("/assets/img/logo.png", func(c echo.Context) error { e.GET("/assets/img/logo.png", func(c echo.Context) error {
return s.render(c, "realize/assets/assets/img/logo.png", 5) return s.render(c, "assets/assets/img/logo.png", 5)
}) })
e.GET("/assets/img/svg/github-logo.svg", func(c echo.Context) error { e.GET("/assets/img/svg/github-logo.svg", func(c echo.Context) error {
return s.render(c, "realize/assets/assets/img/svg/github-logo.svg", 4) return s.render(c, "assets/assets/img/svg/github-logo.svg", 4)
}) })
e.GET("/assets/img/svg/ic_arrow_back_black_48px.svg", func(c echo.Context) error { e.GET("/assets/img/svg/ic_arrow_back_black_48px.svg", func(c echo.Context) error {
return s.render(c, "realize/assets/assets/img/svg/ic_arrow_back_black_48px.svg", 4) return s.render(c, "assets/assets/img/svg/ic_arrow_back_black_48px.svg", 4)
}) })
e.GET("/assets/img/svg/ic_clear_white_48px.svg", func(c echo.Context) error { e.GET("/assets/img/svg/ic_clear_white_48px.svg", func(c echo.Context) error {
return s.render(c, "realize/assets/assets/img/svg/ic_clear_white_48px.svg", 4) return s.render(c, "assets/assets/img/svg/ic_clear_white_48px.svg", 4)
}) })
e.GET("/assets/img/svg/ic_menu_white_48px.svg", func(c echo.Context) error { e.GET("/assets/img/svg/ic_menu_white_48px.svg", func(c echo.Context) error {
return s.render(c, "assets/assets/img/svg/ic_menu_white_48px.svg", 4) return s.render(c, "assets/assets/img/svg/ic_menu_white_48px.svg", 4)
}) })
e.GET("/assets/img/svg/ic_settings_black_48px.svg", func(c echo.Context) error { e.GET("/assets/img/svg/ic_settings_black_48px.svg", func(c echo.Context) error {
return s.render(c, "realize/assets/assets/img/svg/ic_settings_black_48px.svg", 4) return s.render(c, "assets/assets/img/svg/ic_settings_black_48px.svg", 4)
}) })
//websocket //websocket

View File

@ -156,13 +156,13 @@ func (t *Tool) Compile(path string, stop <-chan bool) (response Response) {
cmd.Start() cmd.Start()
go func() { done <- cmd.Wait() }() go func() { done <- cmd.Wait() }()
// Wait a result // Wait a result
response.Name = t.name
select { select {
case <-stop: case <-stop:
// Stop running command // Stop running command
cmd.Process.Kill() cmd.Process.Kill()
case err := <-done: case err := <-done:
// Command completed // Command completed
response.Name = t.name
if err != nil { if err != nil {
response.Err = errors.New(stderr.String() + err.Error()) response.Err = errors.New(stderr.String() + err.Error())
} }