Skip to content

Commit 328e372

Browse files
authored
Merge pull request #102 from go-task/develop
v2.0.1
2 parents 5649f75 + 2183e1e commit 328e372

File tree

8 files changed

+83
-24
lines changed

8 files changed

+83
-24
lines changed

.goreleaser.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,35 @@ archive:
2222
release:
2323
draft: true
2424

25-
fpm:
25+
snapshot:
26+
name_template: "{{.Tag}}"
27+
28+
nfpm:
2629
vendor: Task
2730
homepage: https://github.com/go-task/task
2831
maintainer: Andrey Nering <[email protected]>
2932
description: Simple task runner written in Go
3033
license: MIT
34+
conflicts:
35+
- taskwarrior
3136
formats:
3237
- deb
3338
- rpm
39+
40+
brew:
41+
name: go-task
42+
github:
43+
owner: go-task
44+
name: homebrew-tap
45+
commit_author:
46+
name: Andrey Nering
47+
48+
folder: Formula
49+
homepage: https://github.com/go-task/task
50+
description: Task runner / simpler Make alternative written in Go
51+
conflicts:
52+
- taskwarrior
53+
install: |
54+
bin.install "task"
55+
test: |
56+
system "#{bin}/task", "--help"

.travis.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
language: go
2+
23
go:
34
- '1.8'
45
- '1.9'
56
- '1.10'
7+
8+
addons:
9+
apt:
10+
packages:
11+
- rpm
12+
613
script:
714
- go install github.com/go-task/task/cmd/task
815
- task dl-deps
916
- task lint
1017
- task test
18+
19+
deploy:
20+
- provider: script
21+
skip_cleanup: true
22+
script: curl -sL http://git.io/goreleaser | bash
23+
on:
24+
tags: true
25+
condition: $TRAVIS_OS_NAME = linux

RELEASING_TASK.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Releasing Task
2+
3+
The release process of Task is done is done with the help of
4+
[GoReleaser][goreleaser]. You can test the release process locally by calling
5+
the `test-release` task of the Taskfile.
6+
7+
The Travis CI should release automatically when a new
8+
Git tag is pushed to master, either for the artifact uploading (raw executables
9+
and DEB and RPM packages) and publishing of a new version in the
10+
[Homebrew tap][homebrewtap].
11+
12+
# Snapcraft
13+
14+
The exception is the publishing of a new version of the
15+
[snap package][snappackage]. This current require two steps after publishing
16+
the binaries:
17+
18+
* Updating the current version on [snapcraft.yaml][snapcraftyaml];
19+
* Moving either the `i386` and `amd64` new artifacts to the stable channel on
20+
the [Snapscraft dashboard][snapcraftdashboard]
21+
22+
[goreleaser]: https://goreleaser.com/#continuous_integration
23+
[homebrewtap]: https://github.com/go-task/homebrew-tap
24+
[snappackage]: https://github.com/go-task/snap
25+
[snapcraftyaml]: https://github.com/go-task/snap/blob/master/snap/snapcraft.yaml#L2
26+
[snapcraftdashboard]: https://dashboard.snapcraft.io/

Taskfile.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,10 @@ tasks:
3939
cmds:
4040
- go test {{.GO_PACKAGES}}
4141

42-
# https://github.com/goreleaser/goreleaser
43-
release:
44-
desc: Release Task
45-
cmds:
46-
- goreleaser
47-
4842
test-release:
4943
desc: Tests release process without publishing
5044
cmds:
51-
- goreleaser --snapshot
45+
- goreleaser --snapshot --rm-dist
5246

5347
todo:
5448
desc: Prints TODO comments present in the code

cmd/task/task.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ func main() {
9898
Stdout: os.Stdout,
9999
Stderr: os.Stderr,
100100
}
101-
if err := e.ReadTaskfile(); err != nil {
101+
if err := e.Setup(); err != nil {
102102
log.Fatal(err)
103103
}
104104

task.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,6 @@ type Executor struct {
5252

5353
// Run runs Task
5454
func (e *Executor) Run(calls ...taskfile.Call) error {
55-
if err := e.setup(); err != nil {
56-
return err
57-
}
58-
5955
// check if given tasks exist
6056
for _, c := range calls {
6157
if _, ok := e.Taskfile.Tasks[c.Task]; !ok {
@@ -77,7 +73,12 @@ func (e *Executor) Run(calls ...taskfile.Call) error {
7773
return nil
7874
}
7975

80-
func (e *Executor) setup() error {
76+
// Setup setups Executor's internal state
77+
func (e *Executor) Setup() error {
78+
if err := e.readTaskfile(); err != nil {
79+
return err
80+
}
81+
8182
v, err := semver.NewVersion(e.Taskfile.Version)
8283
if err != nil {
8384
return fmt.Errorf(`task: could not parse taskfile version "%s": %v`, e.Taskfile.Version, err)

task_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func (fct fileContentTest) Run(t *testing.T) {
3838
Stdout: ioutil.Discard,
3939
Stderr: ioutil.Discard,
4040
}
41-
assert.NoError(t, e.ReadTaskfile(), "e.ReadTaskfile()")
41+
assert.NoError(t, e.Setup(), "e.Setup()")
4242
assert.NoError(t, e.Run(taskfile.Call{Task: fct.Target}), "e.Run(target)")
4343

4444
for name, expectContent := range fct.Files {
@@ -176,7 +176,7 @@ func TestVarsInvalidTmpl(t *testing.T) {
176176
Stdout: ioutil.Discard,
177177
Stderr: ioutil.Discard,
178178
}
179-
assert.NoError(t, e.ReadTaskfile(), "e.ReadTaskfile()")
179+
assert.NoError(t, e.Setup(), "e.Setup()")
180180
assert.EqualError(t, e.Run(taskfile.Call{Task: target}), expectError, "e.Run(target)")
181181
}
182182

@@ -228,7 +228,7 @@ func TestDeps(t *testing.T) {
228228
Stdout: ioutil.Discard,
229229
Stderr: ioutil.Discard,
230230
}
231-
assert.NoError(t, e.ReadTaskfile())
231+
assert.NoError(t, e.Setup())
232232
assert.NoError(t, e.Run(taskfile.Call{Task: "default"}))
233233

234234
for _, f := range files {
@@ -256,7 +256,7 @@ func TestStatus(t *testing.T) {
256256
Stderr: &buff,
257257
Silent: true,
258258
}
259-
assert.NoError(t, e.ReadTaskfile())
259+
assert.NoError(t, e.Setup())
260260
assert.NoError(t, e.Run(taskfile.Call{Task: "gen-foo"}))
261261

262262
if _, err := os.Stat(file); err != nil {
@@ -295,7 +295,7 @@ func TestGenerates(t *testing.T) {
295295
Stdout: buff,
296296
Stderr: buff,
297297
}
298-
assert.NoError(t, e.ReadTaskfile())
298+
assert.NoError(t, e.Setup())
299299

300300
for _, theTask := range []string{relTask, absTask} {
301301
var destFile = filepath.Join(dir, theTask)
@@ -347,7 +347,7 @@ func TestStatusChecksum(t *testing.T) {
347347
Stdout: &buff,
348348
Stderr: &buff,
349349
}
350-
assert.NoError(t, e.ReadTaskfile())
350+
assert.NoError(t, e.Setup())
351351

352352
assert.NoError(t, e.Run(taskfile.Call{Task: "build"}))
353353
for _, f := range files {
@@ -386,7 +386,7 @@ func TestCyclicDep(t *testing.T) {
386386
Stdout: ioutil.Discard,
387387
Stderr: ioutil.Discard,
388388
}
389-
assert.NoError(t, e.ReadTaskfile())
389+
assert.NoError(t, e.Setup())
390390
assert.IsType(t, &task.MaximumTaskCallExceededError{}, e.Run(taskfile.Call{Task: "task-1"}))
391391
}
392392

@@ -406,7 +406,7 @@ func TestTaskVersion(t *testing.T) {
406406
Stdout: ioutil.Discard,
407407
Stderr: ioutil.Discard,
408408
}
409-
assert.NoError(t, e.ReadTaskfile())
409+
assert.NoError(t, e.Setup())
410410
assert.Equal(t, test.Version, e.Taskfile.Version)
411411
assert.Equal(t, 2, len(e.Taskfile.Tasks))
412412
})

taskfile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"gopkg.in/yaml.v2"
1313
)
1414

15-
// ReadTaskfile parses Taskfile from the disk
16-
func (e *Executor) ReadTaskfile() error {
15+
// readTaskfile parses Taskfile from the disk
16+
func (e *Executor) readTaskfile() error {
1717
path := filepath.Join(e.Dir, TaskFilePath)
1818

1919
var err error

0 commit comments

Comments
 (0)