trigger_build 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a379d6a646a09ae34d2d3f9b6e56ad325c4e6b50
4
- data.tar.gz: 08b5d212329b35855b4b0595695a4d6eda012f07
3
+ metadata.gz: 69e157df90d7388179451651a9efd895afe2bf26
4
+ data.tar.gz: 39ded176dabfa23f400d5985879e8ad31bf375be
5
5
  SHA512:
6
- metadata.gz: ef27a48430125cdaa2cb17c1ebe1c6ba2844d4446f1801ba7dccb397f5d7149fe6aff315355a00aa6b2051d6d05f867a5b15c211758f27bf9c54113789cf8e38
7
- data.tar.gz: 22f55888e6bc115e7577a1e37418f8e1936e9566bea9ad2e13fb309a629b30554c679c106987cfc8c54e959df154e0583bd65cde7322538f7ee731136c2a780a
6
+ metadata.gz: eb804070a9d76885ecf6b0baea20032d5fb20549f67df61378fae9719b4c3bc6c82f691362830c3803ae1e4868929e5431645bc2065f8d3b450d15f37fb4432b
7
+ data.tar.gz: 08260534780bbf310e3e6382174df92cd6d6ae80ce95749b8fefa403b5c8de0ce8fb09d3588892f86641e3f647aba42e5a06b632b1a0ff03ba58f30f01ee2f17
data/.travis.yml CHANGED
@@ -1,5 +1,14 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
+ - 2.0
5
+ - 2.1
6
+ - 2.2
4
7
  - 2.3.1
5
- before_install: gem install bundler -v 1.12.5
8
+ before_install:
9
+ - gem install bundler
10
+ cache: bundler
11
+ notifications:
12
+ email:
13
+ on_success: change
14
+ on_failure: always
data/Dockerfile ADDED
@@ -0,0 +1,7 @@
1
+ FROM ruby:2.3.1-alpine
2
+
3
+ RUN apk update && apk add --no-cache git
4
+
5
+ RUN gem install trigger_build
6
+
7
+ ENTRYPOINT ["trigger_build"]
data/README.md CHANGED
@@ -1,33 +1,27 @@
1
1
  # TriggerBuild
2
2
 
3
- ## Installation
4
-
5
- Add this line to your application's Gemfile:
6
-
7
- ```ruby
8
- gem 'trigger_build'
9
- ```
10
-
11
- And then execute:
12
-
13
- $ bundle
3
+ TriggerBuild is a simple command line application that can be used to trigger builds on Travis CI.
14
4
 
15
- Or install it yourself as:
5
+ Installation is as simple as:
16
6
 
17
7
  $ gem install trigger_build
18
8
 
19
9
  ## Usage
20
10
 
21
- TriggerBuild is a simple command line application that can be used to trigger builds on Travis CI.
11
+ Triggering builds on Travis CI requires a Travis API token, which is specified via the `--token` option. The `TRAVIS_API_TOKEN` environment variable will be used if no option is supplied.
12
+
13
+ By default public projects hosted on [travis-ci.org](https://travis-ci.org) will be triggered. The `--pro` option should be used if the project is private and hosted on [travis-ci.com](https://travis-ci.com).
22
14
 
23
- The following example triggers a build of trigger_build:
15
+ The following example triggers a build of trigger_build hosted on [travis-ci.org](https://travis-ci.org/MYOB-Technology/trigger_build):
24
16
 
25
- $ trigger_build MYOB-Technology trigger_build --token $TRAVIS_API_TOKEN
17
+ $ trigger_build MYOB-Technology trigger_build --token $API_TOKEN
26
18
 
27
- For detailed usage:
19
+ For detailed usage and options:
28
20
 
29
21
  $ trigger_build -h
30
22
 
23
+ The Travis CI web user interface displays a message for the currently running build. By default this message will include the name of the Git repository from where the `trigger_build` command is executed and the most recent commit message. A generic message will be used if `trigger_build` is not run from a directory containing a Git repository.
24
+
31
25
  ## Contributing
32
26
 
33
27
  Bug reports and pull requests are welcome on GitHub at https://github.com/MYOB-Technology/trigger_build.
@@ -35,4 +29,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/MYOB-T
35
29
  ## License
36
30
 
37
31
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
38
-
data/lib/trigger_build.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'trigger_build/options'
2
2
  require 'trigger_build/repo'
3
- require 'trigger_build/travis'
3
+ require 'trigger_build/travis_api'
4
4
 
5
5
  module TriggerBuild
6
6
 
@@ -10,8 +10,8 @@ module TriggerBuild
10
10
 
11
11
  def self.travis(opts)
12
12
  repo = Repo.new
13
- travis = Travis.new(opts)
14
- travis.trigger("Triggered by #{repo.name}: #{repo.last_commit_message}", branch: 'master')
13
+ triggerer = repo.valid? ? "#{repo.name}: #{repo.last_commit_message}" : 'trigger_build'
14
+ TravisAPI.new(opts).trigger("Triggered by #{triggerer}")
15
15
  end
16
16
 
17
17
  end
@@ -7,12 +7,12 @@ module TriggerBuild
7
7
 
8
8
  def self.parse(args)
9
9
  opts = Slop.parse(args) do |o|
10
- o.banner = "usage: trigger_build [options] owner repo"
11
- o.separator ""
12
- o.separator "options:"
10
+ o.banner = 'usage: trigger_build [options] owner repo'
11
+ o.separator ''
12
+ o.separator 'options:'
13
13
  o.bool '--pro', 'use travis-ci.com'
14
14
  o.string '-t', '--token',
15
- 'the TravisCI API token (default: TRAVIS_API_TOKEN)', default: ENV['TRAVIS_API_TOKEN']
15
+ 'the Travis CI API token (default: TRAVIS_API_TOKEN)', default: ENV['TRAVIS_API_TOKEN']
16
16
  o.on '-h', '--help', 'display this message' do
17
17
  puts o
18
18
  exit
@@ -5,7 +5,7 @@ module TriggerBuild
5
5
  class Repo
6
6
 
7
7
  def initialize(directory = Dir.pwd)
8
- @git = Git.open(directory)
8
+ @git = Git.open(directory) rescue nil
9
9
  end
10
10
 
11
11
  def name
@@ -16,6 +16,10 @@ module TriggerBuild
16
16
  @git.gcommit(@git.log.first).message
17
17
  end
18
18
 
19
+ def valid?
20
+ not @git.nil?
21
+ end
22
+
19
23
  end
20
24
 
21
25
  end
@@ -2,7 +2,7 @@ require 'httparty'
2
2
 
3
3
  module TriggerBuild
4
4
 
5
- class Travis
5
+ class TravisAPI
6
6
  include HTTParty
7
7
  headers 'Accept' => 'application/json',
8
8
  'Content-Type' => 'application/json',
@@ -1,3 +1,3 @@
1
1
  module TriggerBuild
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency 'bundler', '~> 1.12'
27
27
  spec.add_development_dependency 'rake', '~> 10.0'
28
28
  spec.add_development_dependency 'rspec', '~> 3.0'
29
+ spec.add_development_dependency 'simplecov', '~> 0.12'
29
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trigger_build
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-14 00:00:00.000000000 Z
11
+ date: 2016-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.12'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.12'
97
111
  description: Trigger Travis CI builds with ease
98
112
  email:
99
113
  - void@rdavis.xyz
@@ -106,6 +120,7 @@ files:
106
120
  - ".gitignore"
107
121
  - ".rspec"
108
122
  - ".travis.yml"
123
+ - Dockerfile
109
124
  - Gemfile
110
125
  - LICENSE.txt
111
126
  - README.md
@@ -114,7 +129,7 @@ files:
114
129
  - lib/trigger_build.rb
115
130
  - lib/trigger_build/options.rb
116
131
  - lib/trigger_build/repo.rb
117
- - lib/trigger_build/travis.rb
132
+ - lib/trigger_build/travis_api.rb
118
133
  - lib/trigger_build/version.rb
119
134
  - trigger_build.gemspec
120
135
  homepage: https://github.com/MYOB-Technology/trigger_build