added revision number to drone binary, per issue #230

This commit is contained in:
Brad Rydzewski 2014-03-28 12:36:38 -07:00
parent e6f2ba05a9
commit 7184da9ca4
2 changed files with 9 additions and 1 deletions

View file

@ -56,7 +56,7 @@ js:
cd cmd/droned/assets && find js -name "*.js" ! -name '.*' ! -name "main.js" -exec cat {} \; > js/main.js
build:
cd cmd/drone && go build -o ../../bin/drone
cd cmd/drone && go build -ldflags "-X main.version $(SHA)" -o ../../bin/drone
cd cmd/droned && go build -ldflags "-X main.version $(SHA)" -o ../../bin/droned
test: $(PKGS)

View file

@ -39,6 +39,10 @@ var (
// displays the help / usage if True
help = flag.Bool("h", false, "")
// version number, currently deterined by the
// git revision number (sha)
version string
)
func init() {
@ -103,6 +107,10 @@ func main() {
path = filepath.Join(path, ".drone.yml")
vet(path)
// print the version / revision number
case args[0] == "version" && len(args) == 1:
println(version)
// print the help message
case args[0] == "help" && len(args) == 1:
flag.Usage()