Skip to content

Commit

Permalink
prepare for homebrew formula build
Browse files Browse the repository at this point in the history
  • Loading branch information
alexei-led committed Apr 28, 2021
1 parent 2bab106 commit 59e314b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@ export CGO_ENABLED=0
export GOPROXY=https://proxy.golang.org

.PHONY: all
all: update-data update_price fmt lint test-verbose ; $(info $(M) building $(TARGETOS)/$(TARGETARCH) binary...) @ ## Build program binary
all: update-data update-price fmt lint test-verbose ; $(info $(M) building $(TARGETOS)/$(TARGETARCH) binary...) @ ## Build program binary
$Q env GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) $(GO) build \
-tags release \
-ldflags "$(LDFLAGS_VERSION)" \
-o $(BIN)/$(basename $(MODULE)) ./cmd/main.go

.PHONY: build
build: update-data update-price ; $(info $(M) building $(TARGETOS)/$(TARGETARCH) binary...) @ ## Build program binary
$Q env GOOS=$(TARGETOS) GOARCH=$(TARGETARCH) $(GO) build \
-tags release \
-ldflags "$(LDFLAGS_VERSION)" \
Expand Down Expand Up @@ -98,8 +105,8 @@ update-data: check-deps; @ ## Update Spot Advisor data file
@wget -nv $(SPOT_ADVISOR_DATA_URL) -O - > public/spot/data/spot-advisor-data.json
@echo "spot advisor data updated"

.PHONY: update_price
update_price: check-deps; @ ## Update Spot pricing data file
.PHONY: update-price
update-price: check-deps; @ ## Update Spot pricing data file
@mkdir -p public/spot/data
@wget -nv $(SPOT_PRICE_DATA_URL) -O - > public/spot/data/spot-price-data.json
@sed -i'' -e "s/callback(//g" public/spot/data/spot-price-data.json
Expand Down
12 changes: 9 additions & 3 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,15 @@ func main() {
}
cli.VersionPrinter = func(c *cli.Context) {
fmt.Printf("spotinfo %s\n", Version)
fmt.Printf(" Build date: %s\n", BuildDate)
fmt.Printf(" Git commit: %s\n", GitCommit)
fmt.Printf(" Git branch: %s\n", GitBranch)
if BuildDate != "" && BuildDate != "unknown" {
fmt.Printf(" Build date: %s\n", BuildDate)
}
if GitCommit != "" {
fmt.Printf(" Git commit: %s\n", GitCommit)
}
if GitBranch != "" {
fmt.Printf(" Git branch: %s\n", GitBranch)
}
fmt.Printf(" Built with: %s\n", runtime.Version())
}

Expand Down

0 comments on commit 59e314b

Please sign in to comment.