Giter VIP home page Giter VIP logo

bra's Introduction

Hi there 👋

Thanks for visiting my GitHub profile, it's great to meet you here! 😊

Here are some quick things about me:

  • 🔭 I'm a pragmatic software engineer who is paranoid about convention, consistency, and constraints.
  • 🕵️‍♀️ I like doing quality work, and a real asshole on pull request reviews.
  • 🧸 I'm proud of who I am, what I have built, and what I am building.
  • 🧑‍💻 Coding is my passion.
  • 📫 The best way to reach me is to send me an email.
  • ⚡ Fun fact: I once drove to the Half Moon Bay for sun rise.

Last but not the least, we're hiring at Sourcegraph!

bra's People

Contributors

franciscocpg avatar gillesdemey avatar gowso avatar gummiboll avatar marblenix avatar marefr avatar replay avatar sergeyt avatar unknwon avatar zhuharev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bra's Issues

How to pass arguments to bra?

Hello,

Thanks for sharing this tool with the community.
I'm having a difficulty using bra - how may I pass arguments into bra's command handling?

For example, I want to watch the backend while developing Grafana.
To do so, they recommend doing:

bra run

This led to the creation and usage of the following contents:

[run]
init_cmds = [
  ["go", "run", "build.go", "-dev", "build-server"],
        ["./bin/grafana-server", "cfg:app_mode=development"]
]
watch_all = true
follow_symlinks = true
watch_dirs = [
        "$WORKDIR/pkg",
        "$WORKDIR/public/views",
        "$WORKDIR/conf",
]
watch_exts = [".go", ".ini", ".toml", ".template.html"]
build_delay = 1500
cmds = [
  ["go", "run", "build.go", "-dev", "build-server"],
        ["./bin/grafana-server", "cfg:app_mode=development"]
]

This works fine for starting everything with default values, but what if i wanted to run grafana-server with arguments like this:

grafana-server -config $HOME/.grafana/grafana.ini -homepath $HOME/go/src/github.com/grafana/grafana/
What would be the correct way to edit the .bra.toml file to enable argument passing like this?

Thank you very much.

doesn't detect changes in subdir?

Hello, maybe i'm missing something, but i would expect my config below to detect files getting created in subdirectories, but it doesn't. Note new directories may be created with unpredictable names so i can't put those in watch_dirs, but i would think watch_all = true does the trick.

[run]
init_cmds = [                      # Commands run in start
  ["/home/dieter/scripts/git-sync"]
]
watch_all = true                   # Watch all sub-directories
watch_dirs = []                    # Directories to watch
watch_exts = [""]                  # Extensions to watch - substr check matches everything
env_files = []                     # Load env vars from files
ignore = [".git"]                  # Directories to exclude from watching
ignore_files = []                  # Regexps for ignoring specific notifies
follow_symlinks = false            # Enable/disable following symbolic links of sub directories
build_delay = 1500                 # Minimal interval to Trigger build event
interrupt_timout = 15              # Time to wait until force kill
graceful_kill = false              # Wait for exit and before directly kill
cmds = [                           # Commands to run
  ["/home/dieter/scripts/git-sync"]
]

[sync]
#listen_addr = ":5050"
#remote_addr = ":5050"

How to deal with file without extension

I have in directories multiple files that bra is watching, captured in the .bra.toml

...
watch_exts = [".tf", ".tfvars", ".tpl", ".toml"]                # Extensions to watch
...

I would also like to add to the list of watched files a file without an extention, for example a file called Rakefile or Gemfile

Is that possible with the current bra Bra version 0.3.4.0911 ?

bra does not re-execute 'cmd' if new changes appear while 'cmd' was still executing

Hi!
I use bra to essentially run git add -A . && git push in a git repo, any time files are modified, appear, or are deleted in a certain directory

But consider that the following may happen in the directory:

rm a.jpg b.md c.md
rm: remove regular file 'a.jpg'? y
rm: remove regular file 'b.md'? y # after a fraction of a second
rm: remove regular file 'c.md'? y # after another fraction of a second

or

touch foo1.md; sleep 0.5; touch foo2.md

In both of these scenarios, what I observe is that upon the first change, the command is invoked, but as it will run for a few seconds, the subsequent changes are concurrent and are not picked up.
By the time the additional file additions or removals are finished, the command is complete, and the modifications remain in place and are not picked up by bra.

I suggest a change to bra such that if any inotify commands come in while the command is running, the command is run again after it finishes.

Couldn't install the module

$ go get -u -v github.com/Unknwon/bra

says


../../go/src/github.com/unknwon/bra/cmd/sync.go:38:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)

Dependency error

It looks like the dependencies for github.com/codegangsta/cli doesn't exists anymore and has been moved to github.com/urfave/cli

Error on install with my latest go version (go version go1.13.4 linux/amd64)

This is the error when trying to install bra as usually did with previous versions .

user@myserver:~/$ go get github.com/Unknwon/bra
# github.com/unknwon/bra/cmd
../../go/src/github.com/unknwon/bra/cmd/sync.go:38:17: cannot use cli.StringFlag literal (type cli.StringFlag) as type cli.Flag in array or slice literal:
	cli.StringFlag does not implement cli.Flag (Apply method has pointer receiver)

Passing in CLI arguments with flags

How would one pass in an argument variable to the binary in the cmd section of the TOML file?

It seems to be throwing errors. I'm trying to do with out using env vars.

One example would be..

./main -t $(cat token)

求助:sync命令

你好,安装bra之后发现比文档多了一个bra sync 子命令,请问这个是干什么用的?

[feature reequest] Set environment variable

Sometimes it needs to set environment variables for executing command. For example: cross compilation:

init_cmds = [
    ["GOOS=windows", "GOARCH=amd64", "go", "build", "-o", "target_win.exe", "./src"],
    ["GOOS=linux", "GOARCH=arm", "go", "build", "-o", "target_arm", "./src"],
    ["go", "build", "-o", "target", "./src"],
    ["echo", "answer=42"],
    ["./target"]
]

Does not compile against current github.com/codegangsta/cli

❯ go install github.com/Unknwon/bra
# github.com/Unknwon/bra/cmd
../../Unknwon/bra/cmd/init.go:36: cannot use runInit (type func(*cli.Context) error) as type func(*cli.Context) in field value
../../Unknwon/bra/cmd/run.go:49: cannot use runRun (type func(*cli.Context) error) as type func(*cli.Context) in field value
../../Unknwon/bra/cmd/sync.go:36: cannot use runSync (type func(*cli.Context) error) as type func(*cli.Context) in field value

https://gopkg.in/fsnotify.v1no longer exist on this url

Hi,
when trying to install your tool to build backend of Grafana,
go get github.com/Unknwon/bra/ is trying to download from this url https://gopkg.in/fsnotify.v1 and it return a 404.

go get -v -u github.com/Unknwon/bra
github.com/Unknwon/bra (download)
github.com/BurntSushi/toml (download)
github.com/Unknwon/com (download)
github.com/Unknwon/log (download)
github.com/urfave/cli (download)
Fetching https://gopkg.in/fsnotify.v1?go-get=1
Parsing meta tags from https://gopkg.in/fsnotify.v1?go-get=1 (status code 404)
package gopkg.in/fsnotify.v1: unrecognized import path "gopkg.in/fsnotify.v1" (parse https://gopkg.in/fsnotify.v1?go-get=1: no go-import meta tags ())

Any idea how to fix it ?

thx

Run multiple sets of commands at in parallelize

My project (https://github.com/toni-moreno/resistor) needs compile 2 different binaries, I would like handle code changes with bra for both binaries.

But when configuring with this config it doens't work

$ cat .bra.toml 
[run]
init_cmds = [
  ["go", "build","-o", "./bin/resistor", "./pkg/"],
  ["go", "build","-o", "./bin/resinjector", "./pkg/udf" ],
  ["./bin/resistor", "&", "./bin/resinjector"],
]
watch_all = true
watch_dirs = [
	"$WORKDIR/pkg",
]

There is any way to do this?

can't install on apple m1 (arm)

Hey folks, we have a make command which installs and runs bra, but the usual installation method doesn't seem to be working:

env GO111MODULE=on go get github.com/unknwon/bra
go: downloading github.com/BurntSushi/toml v1.2.0
go: added github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d
go: added github.com/unknwon/bra v0.0.0-20200517080246-1e3013ecaff8
go: added github.com/unknwon/com v1.0.1
go: added github.com/unknwon/log v0.0.0-20150304194804-e617c87089d3
go: added github.com/urfave/cli v1.22.1
go: added gopkg.in/fsnotify/fsnotify.v1 v1.4.7
/Users/erica/go/bin/bra run
make: /Users/erica/go/bin/bra: No such file or directory
make: *** [bra] Error 1

workarounds?

Deprecated action signature used (codegangsta/cli)

The bra init command complains about the use of a deprecated action signature from codegangsta/cli:

$ bra init
DEPRECATED Action signature.  Must be `cli.ActionFunc`.  This is an error
in the application.  Please contact the distributor of this application if this is not you.  See https://github.com/codegangsta/cli/blob/master/CHANGELOG.md#deprecated-cli-app-action-signature

The .bra.toml file is yet correctly created.

Inject env variables from file

Hi,
i'm currently trying to get env variables injected from a file..
Like source .env or calling a script with an export.. but it seems that this is not possible?
Or how can this be done? Maybe anyone has an idea?

Thx

the only solution for now i found is to use a command like this
source .env && bra run

bra closes stdout/stderr before finishing stopping child process

when bra runs a program, in this case grafana (https://github.com/raintank/grafana)
and then you kill bra with sigterm, then grafana dies like so:

epoll_wait(10, {}, 128, 0)              = 0
futex(0xc2081ea7d8, FUTEX_WAKE, 1)      = 1
write(2, "2015/08/16 21:50:10 \33[1;32m[I] s"..., 69) = -1 EPIPE (Broken pipe)
--- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=919, si_uid=0} ---
rt_sigreturn({mask=[]})                 = -1 EPIPE (Broken pipe)
rt_sigaction(SIGPIPE, {SIG_DFL, ~[], SA_RESTORER|SA_STACK|SA_SIGINFO, 0x4d3810}, NULL, 8) = 0
gettid()                                = 919
tkill(919, SIGPIPE)                     = 0
--- SIGPIPE {si_signo=SIGPIPE, si_code=SI_TKILL, si_pid=919, si_uid=0} ---
+++ killed by SIGPIPE +++

a child process (such as grafana here) when asked to terminate (via sigterm, sigint) should be able to write some final messages to stdout/stderr before it calls exit()
but bra closes the file descriptors prematurely, resulting in the sigpipe error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.