Skip to content

Commit

Permalink
realize dev
Browse files Browse the repository at this point in the history
  • Loading branch information
asoseil committed Jul 12, 2016
0 parents commit 03ca26b
Show file tree
Hide file tree
Showing 7 changed files with 827 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .gitignore
@@ -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
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions README.md
@@ -0,0 +1,4 @@
# Realize

### Overview
Run, build and watch file changes with custom paths
9 changes: 9 additions & 0 deletions glide.yaml
@@ -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
55 changes: 55 additions & 0 deletions main.go
@@ -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"))
}
47 changes: 47 additions & 0 deletions realize/config.go
@@ -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
}


0 comments on commit 03ca26b

Please sign in to comment.