Skip to content

Commit

Permalink
add b0x
Browse files Browse the repository at this point in the history
  • Loading branch information
cxjava committed Nov 14, 2019
1 parent d47f12e commit e623527
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 15 deletions.
7 changes: 7 additions & 0 deletions assets/assets_dev.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build !release

package assets

import "net/http"

var HTTP http.FileSystem = http.Dir("./res")
124 changes: 124 additions & 0 deletions b0x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
# all folders and files are relative to the path
# where fileb0x was run at!

# default: main
pkg: assets

# destination
dest: "./assets/"

# gofmt
# type: bool
# default: false
fmt: true

# build tags for the main b0x.go file
tags: "release"

# updater allows you to update a b0x in a running server
# without having to restart it
updater:
# disabled by default
enabled: false

# empty mode creates a empty b0x file with just the
# server and the filesystem, then you'll have to upload
# the files later using the cmd:
# fileb0x -update=http://server.com:port b0x.yaml
#
# it avoids long compile time
empty: false

# amount of uploads at the same time
workers: 3

# to get a username and password from a env variable
# leave username and password blank (username: "")
# then set your username and password in the env vars
# (no caps) -> fileb0x_username and fileb0x_password
username: "user"
password: "pass"
port: 8041

# compress files
# at the moment, only supports gzip
#
# type: object
compression:
# activates the compression
#
# type: bool
# default: false
compress: true

# valid values are:
# -> "NoCompression"
# -> "BestSpeed"
# -> "BestCompression"
# -> "DefaultCompression" or ""
#
# type: string
# default: "DefaultCompression" # when: Compress == true && Method == ""
method: "DefaultCompression"

# true = do it yourself (the file is written as gzip compressed file into the memory file system)
# false = decompress files at run time (while writing file into memory file system)
#
# type: bool
# default: false
keep: false

# ---------------
# -- DANGEROUS --
# ---------------
#
# cleans the destination folder (only b0xfiles)
# you should use this when using the spread function
# type: bool
# default: false
clean: false

# default: ab0x.go
output: "assets_release.go"

# [noprefix] disables adding "a" prefix to output
# type: bool
# default: false
noprefix: true

# [unexporTed] builds non-exporTed functions, variables and types...
# type: bool
# default: false
unexporTed: false

# [spread] means it will make a file to hold all fileb0x data
# and each file into a separaTed .go file
#
# example:
# theres 2 files in the folder assets, they're: hello.json and world.txt
# when spread is activaTed, fileb0x will make a file:
# b0x.go or [output]'s data, assets_hello.json.go and assets_world.txt.go
#
#
# type: bool
# default: false
spread: false

# [lcf] log changed files when spread is active
lcf: true

# [debug] is a debug mode where the files are read directly from the file
# sytem. Useful for web dev when files change when the server is running.
# type: bool
# default: false
debug: false

# type: array of objects
custom:

# type: array of strings
- base: "./res"
files:
- "./res/"


24 changes: 9 additions & 15 deletions gosuv.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:generate go run github.com/UnnoTed/fileb0x b0x.yaml

package main

import (
Expand All @@ -16,11 +18,8 @@ import (
"github.com/urfave/cli"
)

const appID = "app_8Gji4eEAdDx"

var (
version string = "master"
cfg Configuration
cfg Configuration
)

type TagInfo struct {
Expand Down Expand Up @@ -52,10 +51,6 @@ func githubUpdate(skipConfirm bool) error {
fmt.Println("Update failed:", err)
return err
}
if tag.Version == version {
fmt.Println("No update available, already at the latest version!")
return nil
}

fmt.Println("New version available -- ", tag.Version)
fmt.Print(tag.Body)
Expand Down Expand Up @@ -110,12 +105,17 @@ func checkServerStatus() error {
return nil
}

func init() {
cli.VersionPrinter = func(c *cli.Context) {
showVersion()
}
}

func main() {
var defaultConfigPath = filepath.Join(defaultGosuvDir, "conf/config.yml")

app := cli.NewApp()
app.Name = "gosuv"
app.Version = version
app.Usage = "golang port of python-supervisor"
app.Before = func(c *cli.Context) error {
var err error
Expand Down Expand Up @@ -215,12 +215,6 @@ func main() {
Usage: "Edit config file",
Action: actionEdit,
},
{
Name: "version",
Usage: "Show version",
Aliases: []string{"v"},
Action: actionVersion,
},
}
if err := app.Run(os.Args); err != nil {
os.Exit(1)
Expand Down

0 comments on commit e623527

Please sign in to comment.