Skip to content

Commit

Permalink
Merge pull request #23 from Ilyes512/feature/use-goreleaser
Browse files Browse the repository at this point in the history
Feature/use goreleaser
  • Loading branch information
Ilyes512 authored Nov 13, 2018
2 parents fd7ae9f + 0c3c33e commit 43b29db
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 169 deletions.
22 changes: 22 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
archive:
replacements:
darwin: macOS
linux: Linux
windows: Windows
386: 32-bit
amd64: 64-bit
snapshot:
name_template: "{{ .Tag }}-next"
brew:
github:
owner: Ilyes512
name: homebrew-boilr
commit_author:
name: goreleaserbot
email: [email protected]
folder: Formula
homepage: https://github.com/Ilyes512/boilr
description: "Boilerplate template manager that generates files or directories from template repositories"
builds:
- ldflags:
- -s -w -X 'github.com/Ilyes512/boilr/pkg/boilr.Version={{.Version}}' -X 'github.com/Ilyes512/boilr/pkg/boilr.BuildDate={{.Date}}' -X 'github.com/Ilyes512/boilr/pkg/boilr.Commit={{.Commit}}'
29 changes: 8 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,17 @@ env:
global:
- CGO_ENABLED=0
- GO111MODULE=on
- VERSION=0.4.4

script:
- go test
- GOARCH=amd64 GOOS=linux go build boilr.go && tar czvf boilr-$VERSION-linux_amd64.tgz boilr
- GOARCH=386 GOOS=linux go build boilr.go && tar czvf boilr-$VERSION-linux_386.tgz boilr
- GOARCH=amd64 GOOS=darwin go build boilr.go && tar czvf boilr-$VERSION-darwin_amd64.tgz boilr
- GOARCH=386 GOOS=darwin go build boilr.go && tar czvf boilr-$VERSION-darwin_386.tgz boilr
install:
- go mod download

deploy:
provider: releases
skip_cleanup: true
api_key:
secure: eAteyECZcUu3twjlO50Zvz2tU//9j3OOXYh6FQEAyF8R1BqtsyojoFm3hj6RqjaehNn/w4aA+icXn+vCp5fp4c3waodOqOgy5zUH+c/mca6XYOX1LOGKVfNvdn1500t33YVNL/df0VcpZRDDWggJEeoyF15EE4rx6tVQEsQ3ffeWO3gGgD28373JSxXuZf+cuYtrL3H2DYTWc2D58jI6W3PnrbHACcEd4ULvGxNc0TeciJiRTQADTYzxxmr4C2DlVbtQaUGgMImQ/S1woOGmePquwkH8MihnWeIA9+GlmZhrXi807x7SbaR2Hqkz7jWJhtdS0cicXotdRoVGNYsOgCuH4oJDedEVQK1CdmQgJWhxToWkBua6Jkvukx7HpVBp/4Ggv4eCskjF2A55tC1MBX3BglwZAPXdwtck2J5nb4BVXUrYEIk+KLBficm3FiCLiLnpqC4h4btlprK+4qfrS0/KSgcRefskBh4WPRe4Xw+8OaJILGPxw4WVbSMFOvSZqorxv89aek+QCukQZC6VIR9trrAKUa0smtKLsxq9tr+AgY5gSirum4fu/OcdvangF3JxO5E5d1eSBDg1W1/vXySkpmHQsr46/i49pHoKINOkhgxOtHIKJF7Zg5PQNkYKDqfr2Egmi1EWId5Nv3DVAp+igI8gXbrNy0G0a9+nLhQ=
file:
- install
- boilr-$VERSION-darwin_386.tgz
- boilr-$VERSION-darwin_amd64.tgz
- boilr-$VERSION-linux_386.tgz
- boilr-$VERSION-linux_amd64.tgz
on:
repo: Ilyes512/boilr
branch: master
tags: true
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash
on:
tags: true
condition: $TRAVIS_OS_NAME = linux

notifications:
email:
Expand Down
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<h1 align=center>
Boilr
<br>
<img src="/assets/logo.png" height="360">
<br>
<p align="center">
<img alt="Boilr Logo" src="/assets/logo.png" height="200" />
<h3 align="center">Boilr</h3>
</p>

---

<p align="center">
<a href="https://travis-ci.com/Ilyes512/boilr"><img alt="Build Status" src="https://img.shields.io/travis/com/Ilyes512/boilr.svg?style=flat-square" /></a>
<a href="https://github.com/Ilyes512/boilr/blob/master/LICENSE" ><img alt="License" src="https://img.shields.io/badge/license-Apache%20License%202.0-E91E63.svg?style=flat-square"/></a>
<a href="https://github.com/Ilyes512/boilr/releases" ><img alt="Release Version" src="https://img.shields.io/badge/release-v0.4.4-blue.svg?style=flat-square"/></a>
<a href="http://goreportcard.com/report/Ilyes512/boilr" ><img alt="Code Quality" src="https://img.shields.io/badge/report%20card-A%2B-F44336.svg?style=flat-square"/></a>
<a href="https://github.com/Ilyes512/boilr/releases" ><img alt="Release Version" src="https://img.shields.io/github/release/Ilyes512/boilr.svg?style=flat-square"/></a>
<a href="http://goreportcard.com/report/Ilyes512/boilr" ><img alt="Code Quality" src="https://goreportcard.com/badge/github.com/Ilyes512/boilr?style=flat-square"/></a>
<a href="https://godoc.org/github.com/Ilyes512/boilr" ><img alt="Documentation" src="https://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square"/></a>
</h1>
</p>

<p align=center>
<em>Are you doing the <b>same steps over and over again</b> every time you start a new programming project?</em>
Expand Down
1 change: 1 addition & 0 deletions boilr.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"fmt"

"github.com/Ilyes512/boilr/pkg/boilr"
"github.com/Ilyes512/boilr/pkg/cmd"
"github.com/Ilyes512/boilr/pkg/util/exit"
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/huandu/xstrings v1.2.0 // indirect
github.com/imdario/mergo v0.3.6 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/kr/pty v1.1.3 // indirect
github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/mattn/go-runewidth v0.0.3 // indirect
Expand All @@ -19,10 +20,11 @@ require (
github.com/spf13/cobra v0.0.3
github.com/spf13/pflag v1.0.3 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16 // indirect
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc // indirect
golang.org/x/sys v0.0.0-20181031143558-9b800f95dbbc // indirect
golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869 // indirect
golang.org/x/net v0.0.0-20181113165502-88d92db4c548 // indirect
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8 // indirect
gopkg.in/src-d/go-billy.v4 v4.3.0 // indirect
gopkg.in/src-d/go-git-fixtures.v3 v3.2.0 // indirect
gopkg.in/src-d/go-git.v4 v4.7.1
gopkg.in/yaml.v2 v2.2.1 // indirect
)
Expand Down
11 changes: 11 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ github.com/kevinburke/ssh_config v0.0.0-20180830205328-81db2a75821e/go.mod h1:CT
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
Expand Down Expand Up @@ -77,12 +78,21 @@ github.com/xanzy/ssh-agent v0.2.0/go.mod h1:0NyE30eGUDliuLEHJgYte/zncp2zdTStcOnW
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16 h1:y6ce7gCWtnH+m3dCjzQ1PCuwl28DDIc3VNnvY29DlIA=
golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd h1:VtIkGDhk0ph3t+THbvXHfMZ8QHgsBO39Nh52+74pq7w=
golang.org/x/crypto v0.0.0-20181106171534-e4dc69e5b2fd/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869 h1:kkXA53yGe04D0adEYJwEVQjeBppL01Exg+fnMjfUraU=
golang.org/x/crypto v0.0.0-20181112202954-3d3f9f413869/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc h1:ZMCWScCvS2fUVFw8LOpxyUUW5qiviqr4Dg5NdjLeiLU=
golang.org/x/net v0.0.0-20181102091132-c10e9556a7bc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181108082009-03003ca0c849 h1:FSqE2GGG7wzsYUsWiQ8MZrvEd1EOyU3NCF0AW3Wtltg=
golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181113165502-88d92db4c548 h1:lqFnrcY5rM6XXZ41MVa5mTlOBrBYultJDG1orIvlqPA=
golang.org/x/net v0.0.0-20181113165502-88d92db4c548/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/sys v0.0.0-20180903190138-2b024373dcd9/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181031143558-9b800f95dbbc h1:SdCq5U4J+PpbSDIl9bM0V1e1Ug1jsnBkAFvTs1htn7U=
golang.org/x/sys v0.0.0-20181031143558-9b800f95dbbc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand All @@ -93,6 +103,7 @@ gopkg.in/src-d/go-billy.v4 v4.3.0 h1:KtlZ4c1OWbIs4jCv5ZXrTqG8EQocr0g/d4DjNg70aek
gopkg.in/src-d/go-billy.v4 v4.3.0/go.mod h1:tm33zBoOwxjYHZIE+OV8bxTWFMJLrconzFMd38aARFk=
gopkg.in/src-d/go-git-fixtures.v3 v3.1.1 h1:XWW/s5W18RaJpmo1l0IYGqXKuJITWRFuA45iOf1dKJs=
gopkg.in/src-d/go-git-fixtures.v3 v3.1.1/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g=
gopkg.in/src-d/go-git-fixtures.v3 v3.2.0/go.mod h1:dLBcvytrw/TYZsNTWCnkNF2DSIlzWYqTe3rJR56Ac7g=
gopkg.in/src-d/go-git.v4 v4.7.1 h1:phAV/kNULxfYEvyInGdPuq3U2MtPpJdgmtOUF3cghkQ=
gopkg.in/src-d/go-git.v4 v4.7.1/go.mod h1:xrJH/YX8uSWewT6evfocf8qsivF18JgCN7/IMitOptY=
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
Expand Down
130 changes: 0 additions & 130 deletions install

This file was deleted.

15 changes: 12 additions & 3 deletions pkg/boilr/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,22 @@ import (
"github.com/Ilyes512/boilr/pkg/util/osutil"
)

// All the below variables should be set with -X go linker option
var (
// Version of the application
Version = "NOT_SET"

// BuildDate of the application
BuildDate = "NOT_SET"

// Commit hash of the application
Commit = "NOT_SET"
)

const (
// AppName of the application
AppName = "boilr"

// Version of the application
Version = "0.4.4"

// ConfigDirPath is the configuration directory of the application
ConfigDirPath = ".config/boilr"

Expand Down
9 changes: 5 additions & 4 deletions pkg/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ import (
cli "github.com/spf13/cobra"

"github.com/Ilyes512/boilr/pkg/boilr"
"github.com/Ilyes512/boilr/pkg/util/tlog"
"github.com/Ilyes512/boilr/pkg/util/validate"
)

// Version contains the cli-command for printing the current version of the tool.
var Version = &cli.Command{
Use: "version",
Short: "Show the boilr version information",
Run: func(c *cli.Command, args []string) {
Run: func(cmd *cli.Command, args []string) {
MustValidateArgs(args, []validate.Argument{})

shouldntPrettify := GetBoolFlag(c, "dont-prettify")
shouldntPrettify := GetBoolFlag(cmd, "dont-prettify")
if shouldntPrettify {
fmt.Println(boilr.Version)
} else {
tlog.Info(fmt.Sprint("Current version is ", boilr.Version))
fmt.Println("Version: ", boilr.Version)
fmt.Println("Build Date (UTC): ", boilr.BuildDate)
fmt.Println("Commit:", boilr.Commit)
}
},
}

0 comments on commit 43b29db

Please sign in to comment.