-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdev.sh
executable file
·79 lines (67 loc) · 2.32 KB
/
dev.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
############################## DEV_SCRIPT_MARKER ##############################
# This script is used to document and run recurring tasks in development. #
# #
# You can run your tasks using the script `./dev some-task`. #
# You can install the Sandstorm Dev Script Runner and run your tasks from any #
# nested folder using `dev some-task`. #
# https://github.com/sandstorm/Sandstorm.DevScriptRunner #
###############################################################################
source ./dev_utilities.sh
set -e
######### TASKS #########
# Starts the project from source
function run() {
go run . $@
}
# Compiles the project into a local binary
function build() {
go build .
_log_green "done"
}
# Auto-formats all source files
function format() {
go fmt main.go
go fmt ./analysis
go fmt ./cmd
go fmt ./dataStructures
go fmt ./parsing
go fmt ./rendering
}
# runs all tests
function test() {
go test ./analysis
go test ./cmd
go test ./dataStructures
go test ./parsing
go test ./rendering
self_check
}
# runs the dependency analysis against this project
function self_check() {
go run . validate .
go run . visualize --show-image=false .
}
# Builds the project locall and creates a release
function release() {
test
docker build -t sandstormmedia/dependency-analysis:latest .
goreleaser release --clean
_log_green "done"
_log_yellow "Manual steps:"
_log_yellow " - docker tag sandstormmedia/dependency-analysis:latest sandstormmedia/dependency-analysis:version-goes-here"
_log_yellow " - docker push sandstormmedia/dependency-analysis:latest"
_log_yellow " - docker push sandstormmedia/dependency-analysis:the-version"
_log_yellow " - adjust release notes: https://github.com/sandstorm/dependency-analysis/releases"
}
# Docs in the browser at localhost:8080
function docs() {
which godoc || go install golang.org/x/tools/cmd/godoc@latest
_log_green "Please open http://localhost:8080/pkg/github.com/sandstorm/dependency-analysis/"
_log_green "Terminate with Ctrl + C"
godoc -http=:8080
}
_log_green "---------------------------- RUNNING TASK: $1 ----------------------------"
# THIS NEEDS TO BE LAST!!!
# this will run your tasks
"$@"