aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE12
-rw-r--r--build.sh18
-rw-r--r--cmd/cli/main.go2
-rw-r--r--cmd/web/index.go6
-rw-r--r--cmd/web/main.go1
5 files changed, 33 insertions, 6 deletions
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..8030f15
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,12 @@
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
+REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
+INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+
diff --git a/build.sh b/build.sh
index 90ce8b1..7b515b5 100644
--- a/build.sh
+++ b/build.sh
@@ -2,9 +2,15 @@
set -e
set -x
-if ! [ -d bin ] ; then
- mkdir bin
-fi
+rm -rf bin
+mkdir bin
+
+LICENSE="$(cat LICENSE)"
+version="$(git log --format="%h %d" -1)
+$(go version)
+Build Date: $(date +%m.%d.%Y)
+
+$LICENSE"
commands="cli web"
@@ -12,10 +18,12 @@ for cmd in $commands ; do
export GOOS=windows
export GOARCH=amd64
-go build -o bin/steam-export-$cmd-$GOOS-$GOARCH.exe ./cmd/$cmd
+go build -ldflags="-X 'main.Version=$version'"\
+ -o bin/steam-export-$cmd-$GOOS-$GOARCH.exe ./cmd/$cmd
export GOOS=linux
export GOARCH=amd64
-go build -o bin/steam-export-$cmd-$GOOS-$GOARCH ./cmd/$cmd
+go build -ldflags="-X 'main.Version=$version'"\
+ -o bin/steam-export-$cmd-$GOOS-$GOARCH ./cmd/$cmd
done
diff --git a/cmd/cli/main.go b/cmd/cli/main.go
index 989592a..8bb9a24 100644
--- a/cmd/cli/main.go
+++ b/cmd/cli/main.go
@@ -9,6 +9,8 @@ import (
"riedstra.dev/mitch/steam-export/steam"
)
+var Version = "Development"
+
func parseArgs(args []string) error {
if len(args) < 2 {
return errors.New("Not enough arguments")
diff --git a/cmd/web/index.go b/cmd/web/index.go
index 2eb3695..a4a91c2 100644
--- a/cmd/web/index.go
+++ b/cmd/web/index.go
@@ -82,6 +82,9 @@ Change library path
</form>
+<h3>Version information</h3>
+<pre><code>{{.Version}}</pre></code>
+
</body>
`))
)
@@ -96,7 +99,8 @@ func index(w http.ResponseWriter, r *http.Request) {
struct {
Lib *steam.Library
Info *statusInfo
- }{Lib, status.s})
+ Version string
+ }{Lib, status.s, Version})
if err != nil {
Logger.Printf("While Rendering template: %s", err)
}
diff --git a/cmd/web/main.go b/cmd/web/main.go
index 6bf0a5d..ec0704d 100644
--- a/cmd/web/main.go
+++ b/cmd/web/main.go
@@ -15,6 +15,7 @@ import (
)
var (
+ Version = "Development"
Logger = log.New(os.Stderr, "", log.LstdFlags)
Listen = ":8899"