diff --git a/realize.go b/realize.go index a876490..6dbef9f 100644 --- a/realize.go +++ b/realize.go @@ -130,6 +130,7 @@ func main() { &cli.BoolFlag{Name: "no-server", Usage: "Disables the web panel"}, &cli.BoolFlag{Name: "no-config", Value: false, Usage: "Uses the config settings"}, &cli.BoolFlag{Name: "open", Usage: "Automatically opens the web panel"}, + &cli.IntFlag{Name: "port", Usage: "Sets the web panel port"}, &cli.BoolFlag{Name: "test", Value: false, Usage: "Enables the tests"}, }, Action: func(p *cli.Context) error { diff --git a/server/bindata.go b/server/bindata.go index 6fc3c52..d456b4c 100644 --- a/server/bindata.go +++ b/server/bindata.go @@ -413,20 +413,20 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "assets/app/components/index.html": assetsAppComponentsIndexHtml, - "assets/app/components/project/index.html": assetsAppComponentsProjectIndexHtml, - "assets/app/components/projects/index.html": assetsAppComponentsProjectsIndexHtml, - "assets/assets/css/app.css": assetsAssetsCssAppCss, - "assets/assets/img/svg/github-logo.svg": assetsAssetsImgSvgGithubLogoSvg, - "assets/assets/img/svg/ic_cached_black_48px.svg": assetsAssetsImgSvgIc_cached_black_48pxSvg, - "assets/assets/img/svg/ic_delete_sweep_black_48px.svg": assetsAssetsImgSvgIc_delete_sweep_black_48pxSvg, - "assets/assets/img/svg/ic_error_black_48px.svg": assetsAssetsImgSvgIc_error_black_48pxSvg, - "assets/assets/img/svg/ic_file_download_black_48px.svg": assetsAssetsImgSvgIc_file_download_black_48pxSvg, - "assets/assets/img/svg/ic_more_vert_black_48px.svg": assetsAssetsImgSvgIc_more_vert_black_48pxSvg, + "assets/app/components/index.html": assetsAppComponentsIndexHtml, + "assets/app/components/project/index.html": assetsAppComponentsProjectIndexHtml, + "assets/app/components/projects/index.html": assetsAppComponentsProjectsIndexHtml, + "assets/assets/css/app.css": assetsAssetsCssAppCss, + "assets/assets/img/svg/github-logo.svg": assetsAssetsImgSvgGithubLogoSvg, + "assets/assets/img/svg/ic_cached_black_48px.svg": assetsAssetsImgSvgIc_cached_black_48pxSvg, + "assets/assets/img/svg/ic_delete_sweep_black_48px.svg": assetsAssetsImgSvgIc_delete_sweep_black_48pxSvg, + "assets/assets/img/svg/ic_error_black_48px.svg": assetsAssetsImgSvgIc_error_black_48pxSvg, + "assets/assets/img/svg/ic_file_download_black_48px.svg": assetsAssetsImgSvgIc_file_download_black_48pxSvg, + "assets/assets/img/svg/ic_more_vert_black_48px.svg": assetsAssetsImgSvgIc_more_vert_black_48pxSvg, "assets/assets/img/svg/ic_swap_vertical_circle_black_48px.svg": assetsAssetsImgSvgIc_swap_vertical_circle_black_48pxSvg, - "assets/assets/js/all.js": assetsAssetsJsAllJs, - "assets/assets/js/all.min.js": assetsAssetsJsAllMinJs, - "assets/index.html": assetsIndexHtml, + "assets/assets/js/all.js": assetsAssetsJsAllJs, + "assets/assets/js/all.min.js": assetsAssetsJsAllMinJs, + "assets/index.html": assetsIndexHtml, } // AssetDir returns the file names below a certain @@ -468,40 +468,41 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } + var _bintree = &bintree{nil, map[string]*bintree{ - "assets": &bintree{nil, map[string]*bintree{ - "app": &bintree{nil, map[string]*bintree{ - "components": &bintree{nil, map[string]*bintree{ - "index.html": &bintree{assetsAppComponentsIndexHtml, map[string]*bintree{}}, - "project": &bintree{nil, map[string]*bintree{ - "index.html": &bintree{assetsAppComponentsProjectIndexHtml, map[string]*bintree{}}, + "assets": {nil, map[string]*bintree{ + "app": {nil, map[string]*bintree{ + "components": {nil, map[string]*bintree{ + "index.html": {assetsAppComponentsIndexHtml, map[string]*bintree{}}, + "project": {nil, map[string]*bintree{ + "index.html": {assetsAppComponentsProjectIndexHtml, map[string]*bintree{}}, }}, - "projects": &bintree{nil, map[string]*bintree{ - "index.html": &bintree{assetsAppComponentsProjectsIndexHtml, map[string]*bintree{}}, + "projects": {nil, map[string]*bintree{ + "index.html": {assetsAppComponentsProjectsIndexHtml, map[string]*bintree{}}, }}, }}, }}, - "assets": &bintree{nil, map[string]*bintree{ - "css": &bintree{nil, map[string]*bintree{ - "app.css": &bintree{assetsAssetsCssAppCss, map[string]*bintree{}}, + "assets": {nil, map[string]*bintree{ + "css": {nil, map[string]*bintree{ + "app.css": {assetsAssetsCssAppCss, map[string]*bintree{}}, }}, - "img": &bintree{nil, map[string]*bintree{ - "svg": &bintree{nil, map[string]*bintree{ - "github-logo.svg": &bintree{assetsAssetsImgSvgGithubLogoSvg, map[string]*bintree{}}, - "ic_cached_black_48px.svg": &bintree{assetsAssetsImgSvgIc_cached_black_48pxSvg, map[string]*bintree{}}, - "ic_delete_sweep_black_48px.svg": &bintree{assetsAssetsImgSvgIc_delete_sweep_black_48pxSvg, map[string]*bintree{}}, - "ic_error_black_48px.svg": &bintree{assetsAssetsImgSvgIc_error_black_48pxSvg, map[string]*bintree{}}, - "ic_file_download_black_48px.svg": &bintree{assetsAssetsImgSvgIc_file_download_black_48pxSvg, map[string]*bintree{}}, - "ic_more_vert_black_48px.svg": &bintree{assetsAssetsImgSvgIc_more_vert_black_48pxSvg, map[string]*bintree{}}, - "ic_swap_vertical_circle_black_48px.svg": &bintree{assetsAssetsImgSvgIc_swap_vertical_circle_black_48pxSvg, map[string]*bintree{}}, + "img": {nil, map[string]*bintree{ + "svg": {nil, map[string]*bintree{ + "github-logo.svg": {assetsAssetsImgSvgGithubLogoSvg, map[string]*bintree{}}, + "ic_cached_black_48px.svg": {assetsAssetsImgSvgIc_cached_black_48pxSvg, map[string]*bintree{}}, + "ic_delete_sweep_black_48px.svg": {assetsAssetsImgSvgIc_delete_sweep_black_48pxSvg, map[string]*bintree{}}, + "ic_error_black_48px.svg": {assetsAssetsImgSvgIc_error_black_48pxSvg, map[string]*bintree{}}, + "ic_file_download_black_48px.svg": {assetsAssetsImgSvgIc_file_download_black_48pxSvg, map[string]*bintree{}}, + "ic_more_vert_black_48px.svg": {assetsAssetsImgSvgIc_more_vert_black_48pxSvg, map[string]*bintree{}}, + "ic_swap_vertical_circle_black_48px.svg": {assetsAssetsImgSvgIc_swap_vertical_circle_black_48pxSvg, map[string]*bintree{}}, }}, }}, - "js": &bintree{nil, map[string]*bintree{ - "all.js": &bintree{assetsAssetsJsAllJs, map[string]*bintree{}}, - "all.min.js": &bintree{assetsAssetsJsAllMinJs, map[string]*bintree{}}, + "js": {nil, map[string]*bintree{ + "all.js": {assetsAssetsJsAllJs, map[string]*bintree{}}, + "all.min.js": {assetsAssetsJsAllMinJs, map[string]*bintree{}}, }}, }}, - "index.html": &bintree{assetsIndexHtml, map[string]*bintree{}}, + "index.html": {assetsIndexHtml, map[string]*bintree{}}, }}, }} @@ -551,4 +552,3 @@ func _filePath(dir, name string) string { cannonicalName := strings.Replace(name, "\\", "/", -1) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } - diff --git a/server/main.go b/server/main.go index 76e1280..1c8476b 100644 --- a/server/main.go +++ b/server/main.go @@ -48,6 +48,9 @@ func render(c echo.Context, path string, mime int) error { // Start the web server func (s *Server) Start(p *cli.Context) (err error) { + if p.Int("port") != 0 { + s.Settings.Server.Port = p.Int("port") + } if !p.Bool("no-server") && s.Enabled { e := echo.New() e.Use(middleware.Gzip()) diff --git a/watcher/watcher.go b/watcher/watcher.go index 4144ab9..7a6451e 100644 --- a/watcher/watcher.go +++ b/watcher/watcher.go @@ -3,6 +3,7 @@ package cli import ( "errors" "fmt" + "github.com/fsnotify/fsnotify" "log" "math/big" "os" @@ -13,8 +14,6 @@ import ( "sync" "syscall" "time" - - "github.com/fsnotify/fsnotify" ) // Watching method is the main core. It manages the livereload and the watching