Skip to content

Commit 8d9ce65

Browse files
committed
Add travis build and badges
1 parent 9d78132 commit 8d9ce65

File tree

8 files changed

+92
-14
lines changed

8 files changed

+92
-14
lines changed

.travis.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
language: go
2+
3+
env:
4+
global:
5+
- GO111MODULE=on
6+
- CC_TEST_REPORTER_ID=1fee6b47ad638c3cb28b932d28413d643a06c90b277bc5839e306f40e932422e
7+
8+
stages:
9+
- test
10+
11+
go:
12+
- 1.12.x
13+
- 1.13.x
14+
15+
sudo: required
16+
dist: trusty
17+
18+
before_install:
19+
- go get -u golang.org/x/lint/golint
20+
- make deps
21+
- curl -L https://github.com/SimonBaeumer/commander/releases/download/v0.3.0/commander-linux-amd64 -o ~/bin/commander
22+
- chmod +x ~/bin/commander
23+
24+
jobs:
25+
include:
26+
- name: macOS Unit
27+
os: osx
28+
script:
29+
- make test
30+
31+
- name: macOS integration
32+
os: osx
33+
script:
34+
- make integration
35+
36+
- name: windows Unit
37+
os: windows
38+
before_install:
39+
- choco install make
40+
script:
41+
- make test
42+
43+
- name: Unit tests
44+
before_script:
45+
- curl https://s3.amazonaws.com/codeclimate/test-reporter/test-reporter-0.6.3-linux-amd64 --output test-reporter
46+
- chmod +x test-reporter
47+
- ./test-reporter before-build
48+
script:
49+
- make test-coverage
50+
after_script:
51+
- ./test-reporter after-build -t gocov --exit-code $TRAVIS_TEST_RESULT

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Svett Ralchev
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
[![Build Status](https://travis-ci.org/SimonBaeumer/cmd.svg?branch=master)](https://travis-ci.org/SimonBaeumer/cmd)
2+
[![GoDoc](https://godoc.org/github.com/SimonBaeumer/cmd?status.svg)](https://godoc.org/github.com/SimonBaeumer/cmd)
3+
[![Test Coverage](https://api.codeclimate.com/v1/badges/af3487439a313d580619/test_coverage)](https://codeclimate.com/github/SimonBaeumer/cmd/test_coverage)
4+
[![Maintainability](https://api.codeclimate.com/v1/badges/af3487439a313d580619/maintainability)](https://codeclimate.com/github/SimonBaeumer/cmd/maintainability)
5+
[![Go Report Card](https://goreportcard.com/badge/github.com/SimonBaeumer/cmd)](https://goreportcard.com/report/github.com/SimonBaeumer/cmd)
6+
17
# cmd package
28

39
A simple package to execute shell commands on windows, darwin and windows.

command.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ type Command struct {
3030
//NewCommand creates a new command
3131
func NewCommand(cmd string, options ...func(*Command)) *Command {
3232
c := &Command{
33-
Command: cmd,
34-
Timeout: 1 * time.Minute,
35-
executed: false,
36-
Env: []string{},
33+
Command: cmd,
34+
Timeout: 1 * time.Minute,
35+
executed: false,
36+
Env: []string{},
3737
}
3838

3939
c.StdoutWriter = &c.stdout

command_linux_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestCommand_WithValidTimeout(t *testing.T) {
3737
}
3838

3939
func TestCommand_WithWorkingDir(t *testing.T) {
40-
setWorkingDir := func (c *Command) {
40+
setWorkingDir := func(c *Command) {
4141
c.WorkingDir = "/tmp"
4242
}
4343

@@ -52,4 +52,4 @@ func TestCommand_WithStandardStreams(t *testing.T) {
5252
cmd.Execute()
5353

5454
assert.Equal(t, "/tmp\n", cmd.Stdout())
55-
}
55+
}

command_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,4 @@ func TestCommand_SetOptions(t *testing.T) {
150150
assert.Nil(t, err)
151151
assert.Equal(t, time.Duration(1000000000), c.Timeout)
152152
assert.Equal(t, "test\n", writer.String())
153-
}
153+
}

examples/standard_streams.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ package main
33
import "github.com/SimonBaeumer/cmd"
44

55
func main() {
6-
c := cmd.NewCommand("echo hello; sleep 1; echo another;", cmd.WithStandardStreams)
7-
c.Execute()
6+
c := cmd.NewCommand("echo hello; sleep 1; echo another;", cmd.WithStandardStreams)
7+
c.Execute()
88
}

examples/working_dir.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package main
33
import "github.com/SimonBaeumer/cmd"
44

55
func main() {
6-
setWorkingDir := func(c *cmd.Command) {
7-
c.WorkingDir = "/tmp"
8-
}
9-
c := cmd.NewCommand("pwd", cmd.WithStandardStreams, setWorkingDir)
10-
c.Execute()
6+
setWorkingDir := func(c *cmd.Command) {
7+
c.WorkingDir = "/tmp"
8+
}
9+
c := cmd.NewCommand("pwd", cmd.WithStandardStreams, setWorkingDir)
10+
c.Execute()
1111
}

0 commit comments

Comments
 (0)