Skip to content

Commit

Permalink
makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
shrey agarwal committed Sep 13, 2016
1 parent 3d4ba46 commit 3f04cfb
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Folders
_obj
_test
_release

# Architecture specific extensions/prefixes
*.[568vq]
Expand Down
70 changes: 70 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
.PHONY: build doc fmt lint run test buildall buildlinux

# Prepend our _vendor directory to the system GOPATH
# so that import path resolution will prioritize
# our third party snapshots.

default: build

build:
goimports -v -w ./*.go
go build -v -o _release/elasty

buildall:
goimports -v -w ./*.go
gox -verbose -output="_release/{{.Dir}}_{{.OS}}_{{.Arch}}"

buildlinux:
goimports -v -w ./*.go
gox -osarch="linux/amd64" -verbose -parallel=1 -output="_release/{{.Dir}}_{{.OS}}_{{.Arch}}"

githubrelease:
goimports -v -w ./*.go

# clean
rm -rf ./_release/*

# create for darwin/amd64
mkdir -p ./_release/elasty_darwin_amd64
go build -v -o _release/elasty_darwin_amd64/elasty_darwin_amd64
# copy config files
cp -r ./config _release/elasty_darwin_amd64/
# create Tar to release
tar cvfz _release/elasty_darwin_amd64.tar.gz -C _release/elasty_darwin_amd64 .
# delete directory
rm -rf _release/elasty_darwin_amd64

# create for linux/amd64
mkdir -p ./_release/elasty_linux_amd64
gox -osarch="linux/amd64" -verbose -parallel=1 -output="_release/elasty_linux_amd64/{{.Dir}}_{{.OS}}_{{.Arch}}"
# copy config files
cp -r ./config _release/elasty_linux_amd64/
# create Tar to release
tar cvfz _release/elasty_linux_amd64.tar.gz -C _release/elasty_linux_amd64 .
# delete directory
rm -rf _release/elasty_linux_amd64



clean:
rm -r _release/*

#doc:
# godoc -http=:6060 -index

# http://golang.org/cmd/go/#hdr-Run_gofmt_on_package_sources
#fmt:
# go fmt ./src/...

# https://github.com/golang/lint
# go get github.com/golang/lint/golint
#lint:
# golint ./src

#run: build
# ./bin/main_app

#test:
# go test ./src/...


14 changes: 4 additions & 10 deletions elasty.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ func cliArgsParse() {
}

func setDefaultConfigs() {
prefetch_count = 1
prefetch_size = 0
prefetch_global = false
}

func readConfig() {
Expand All @@ -193,31 +196,22 @@ func readConfig() {

err := viper.ReadInConfig()
if err != nil {
fmt.Println("Config file not found...")
fmt.Println("Config file not found... at config/app.toml")
} else {

// Rmq Prefetch count
if viper.IsSet("rmq2es.prefetch_count") {
prefetch_count = viper.GetInt("rmq2es.prefetch_count")
} else {
// Default 1 ( safe )
prefetch_count = 1
}

// Rmq Prefetch count
if viper.IsSet("rmq2es.prefetch_size") {
prefetch_size = viper.GetInt("rmq2es.prefetch_size")
} else {
// Default 0
prefetch_size = 0
}

// Rmq Prefetch count
if viper.IsSet("rmq2es.prefetch_global") {
prefetch_global = viper.GetBool("rmq2es.prefetch_global")
} else {
// Default 0
prefetch_global = false
}
}

Expand Down

0 comments on commit 3f04cfb

Please sign in to comment.