give our appearence on windows some love (#429)

This commit is contained in:
Matt Robinson 2018-10-16 14:48:17 -04:00 committed by GitHub
parent 00358fc368
commit bcd18a44bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 87 additions and 3 deletions

3
.gitignore vendored
View File

@ -50,4 +50,5 @@ big-upload-testfile
big-download-testfile big-download-testfile
small-upload-testfile small-upload-testfile
small-download-testfile small-download-testfile
/bin /bin
resource.syso

View File

@ -2,7 +2,7 @@ GO_VERSION ?= 1.11
GOOS ?= linux GOOS ?= linux
GOARCH ?= amd64 GOARCH ?= amd64
COMPOSE_PROJECT_NAME := ${TAG}-$(shell git rev-parse --abbrev-ref HEAD) COMPOSE_PROJECT_NAME := ${TAG}-$(shell git rev-parse --abbrev-ref HEAD)
BRANCH := $(shell git rev-parse --abbrev-ref HEAD) BRANCH := $(shell git rev-parse --abbrev-ref HEAD | sed "s!/!-!g")
ifeq (${BRANCH},master) ifeq (${BRANCH},master)
TAG := $(shell git rev-parse --short HEAD)-go${GO_VERSION} TAG := $(shell git rev-parse --short HEAD)-go${GO_VERSION}
else else
@ -109,6 +109,14 @@ binary:
@if [ -z "${COMPONENT}" ]; then echo "Try one of the following targets instead:" \ @if [ -z "${COMPONENT}" ]; then echo "Try one of the following targets instead:" \
&& for b in binaries ${BINARIES}; do echo "- $$b"; done && exit 1; fi && for b in binaries ${BINARIES}; do echo "- $$b"; done && exit 1; fi
mkdir -p release/${TAG} mkdir -p release/${TAG}
rm -f cmd/${COMPONENT}/resource.syso
if [ "${GOARCH}" = "amd64" ]; then sixtyfour="-64"; fi; \
goversioninfo $$sixtyfour -o cmd/${COMPONENT}/resource.syso \
-original-name ${COMPONENT}_${GOOS}_${GOARCH}${FILEEXT} \
-description "${COMPONENT} program for Storj" \
-product-ver-build 2 -ver-build 2 \
-product-version "alpha2" \
resources/versioninfo.json || echo "goversioninfo is not installed, metadata will not be created"
tar -c . | docker run --rm -i -e TAR=1 -e GO111MODULE=on \ tar -c . | docker run --rm -i -e TAR=1 -e GO111MODULE=on \
-e GOOS=${GOOS} -e GOARCH=${GOARCH} -e CGO_ENABLED=1 \ -e GOOS=${GOOS} -e GOARCH=${GOARCH} -e CGO_ENABLED=1 \
-w /go/src/storj.io/storj storjlabs/golang \ -w /go/src/storj.io/storj storjlabs/golang \

View File

@ -33,7 +33,6 @@ var (
func main() { func main() {
go dumpHandler() go dumpHandler()
// process.Exec will load this for this command. // process.Exec will load this for this command.
runCmd.Flags().String("config", runCmd.Flags().String("config",
filepath.Join(defaultConfDir, "config.yaml"), "path to configuration") filepath.Join(defaultConfDir, "config.yaml"), "path to configuration")

View File

@ -4,10 +4,26 @@
package process package process
import ( import (
"fmt"
"log" "log"
"os" "os"
"github.com/spf13/cobra"
) )
func init() {
cobra.MousetrapHelpText = "This is a command line tool.\n\n" +
"This needs to be run from a Command Prompt.\n"
// Figure out the executable name.
exe, err := os.Executable()
if err == nil {
cobra.MousetrapHelpText += fmt.Sprintf(
"Try running \"%s help\" for more information\n", exe)
}
}
// check if file exists, handle error correctly if it doesn't // check if file exists, handle error correctly if it doesn't
func fileExists(path string) bool { func fileExists(path string) bool {
_, err := os.Stat(path) _, err := os.Stat(path)

View File

@ -31,6 +31,11 @@ func ExecuteWithConfig(cmd *cobra.Command, defaultConfig string) {
// Exec runs a Cobra command. If a "config" flag is defined it will be parsed // Exec runs a Cobra command. If a "config" flag is defined it will be parsed
// and loaded using viper. // and loaded using viper.
func Exec(cmd *cobra.Command) { func Exec(cmd *cobra.Command) {
exe, err := os.Executable()
if err == nil {
cmd.Use = exe
}
pflag.CommandLine.AddGoFlagSet(flag.CommandLine) pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
cleanup(cmd) cleanup(cmd)
_ = cmd.Execute() _ = cmd.Execute()

12
resources/README.md Normal file
View File

@ -0,0 +1,12 @@
Resources
=========
* icon.ico: compiled icon from icon.png
To recreate:
```
convert icon.png -resize 256x256 -define icon:auto-resize="16,32,48,64,96,128,256" icon.ico
```
* icon.png: icon stolen from storjshare-gui
* logo.png: logo previously in logo/
* versioninfo.json: template file needed for goversioninfo, to add to windows
binaries.

BIN
resources/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

BIN
resources/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@ -0,0 +1,43 @@
{
"FixedFileInfo": {
"FileVersion": {
"Major": 0,
"Minor": 0,
"Patch": 0,
"Build": 0
},
"ProductVersion": {
"Major": 0,
"Minor": 0,
"Patch": 0,
"Build": 0
},
"FileFlagsMask": "3f",
"FileFlags ": "00",
"FileOS": "040004",
"FileType": "01",
"FileSubType": "00"
},
"StringFileInfo": {
"Comments": "",
"CompanyName": "Storj Labs, Inc",
"FileDescription": "OVERWRITE",
"FileVersion": "",
"InternalName": "",
"LegalCopyright": "© Storj Labs, Inc",
"LegalTrademarks": "Storj is a trademark of Storj Labs Inc.\nTardigrade is a trademark of Storj Labs Inc.",
"OriginalFilename": "OVERWRITE",
"PrivateBuild": "OVERWRITE",
"ProductName": "Storj",
"ProductVersion": "OVERWRITE",
"SpecialBuild": ""
},
"VarFileInfo": {
"Translation": {
"LangID": "0409",
"CharsetID": "04B0"
}
},
"IconPath": "resources/icon.ico",
"ManifestPath": ""
}