trigger_build 0.0.1 → 0.0.2

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: 2ffaa2d85aaebcf7ffdfa296b1c8b7b4bb12893f
4
- data.tar.gz: 3a114cd362a3d4d05f6824d308643750d4d84dc7
3
+ metadata.gz: a379d6a646a09ae34d2d3f9b6e56ad325c4e6b50
4
+ data.tar.gz: 08b5d212329b35855b4b0595695a4d6eda012f07
5
5
  SHA512:
6
- metadata.gz: dc3ba8a5192b0c1843bcd869e5d30eeea75526bb83bc80a427e22cea7529970bdd21bd531d21c832e489b5c950573ed4ec1d10c391f235ca78c49b383cba107c
7
- data.tar.gz: baeac19db6d96e0ada82b1f3c31bf1c06f2122bd0e1302139728b5803fbd0b32fc4e9d4e548425705570acdec58919ab4aed1782d4c900b338a5b198a45cae3b
6
+ metadata.gz: ef27a48430125cdaa2cb17c1ebe1c6ba2844d4446f1801ba7dccb397f5d7149fe6aff315355a00aa6b2051d6d05f867a5b15c211758f27bf9c54113789cf8e38
7
+ data.tar.gz: 22f55888e6bc115e7577a1e37418f8e1936e9566bea9ad2e13fb309a629b30554c679c106987cfc8c54e959df154e0583bd65cde7322538f7ee731136c2a780a
data/README.md CHANGED
@@ -18,11 +18,11 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TriggerBuild is a simple command line application that can be used to trigger builds on TravisCI.
21
+ TriggerBuild is a simple command line application that can be used to trigger builds on Travis CI.
22
22
 
23
23
  The following example triggers a build of trigger_build:
24
24
 
25
- $ trigger_build MYOB-Technology trigger_build --pro --token $TRAVIS_API_TOKEN
25
+ $ trigger_build MYOB-Technology trigger_build --token $TRAVIS_API_TOKEN
26
26
 
27
27
  For detailed usage:
28
28
 
data/bin/trigger_build CHANGED
@@ -1,6 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'pp'
4
3
  require 'trigger_build'
5
4
 
6
- pp TriggerBuild.travis
5
+ opts = TriggerBuild.parse_args(ARGV)
6
+ response = TriggerBuild.travis(opts)
7
+ if response.success?
8
+ puts 'Successfully triggered build'
9
+ else
10
+ abort "Failed to trigger build: #{response}"
11
+ end
@@ -27,10 +27,8 @@ module TriggerBuild
27
27
  abort opts.to_s
28
28
  end
29
29
 
30
- url = opts.pro? ? 'travis-ci.com' : 'travis-ci.org'
31
30
  owner, repo = *opts.args
32
-
33
- { owner: owner, repo: repo, token: opts[:token], url: url }
31
+ { owner: owner, repo: repo, token: opts[:token], pro: opts.pro? }
34
32
  end
35
33
 
36
34
  end
@@ -9,7 +9,8 @@ module TriggerBuild
9
9
  'Travis-API-Version' => '3'
10
10
 
11
11
  def initialize(opts)
12
- self.class.base_uri "api.#{opts[:url]}/repo/#{opts[:owner]}\%2F#{opts[:repo]}"
12
+ url = opts[:pro] ? 'travis-ci.com' : 'travis-ci.org'
13
+ self.class.base_uri "api.#{url}/repo/#{opts[:owner]}\%2F#{opts[:repo]}"
13
14
  self.class.headers 'Authorization' => "token #{opts[:token]}"
14
15
  end
15
16
 
@@ -1,3 +1,3 @@
1
1
  module TriggerBuild
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
data/lib/trigger_build.rb CHANGED
@@ -4,8 +4,11 @@ require 'trigger_build/travis'
4
4
 
5
5
  module TriggerBuild
6
6
 
7
- def self.travis(args = ARGV)
8
- opts = Options.parse(args)
7
+ def self.parse_args(args)
8
+ Options.parse(args)
9
+ end
10
+
11
+ def self.travis(opts)
9
12
  repo = Repo.new
10
13
  travis = Travis.new(opts)
11
14
  travis.trigger("Triggered by #{repo.name}: #{repo.last_commit_message}", branch: 'master')
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ['void@rdavis.xyz']
11
11
  spec.executables = ['trigger_build']
12
12
 
13
- spec.summary = 'Trigger TravisCI builds'
14
- spec.description = 'Trigger TravisCI builds with ease'
13
+ spec.summary = 'Trigger Travis CI builds'
14
+ spec.description = 'Trigger Travis CI builds with ease'
15
15
  spec.homepage = 'https://github.com/MYOB-Technology/trigger_build'
16
16
  spec.license = 'MIT'
17
17
 
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.1
4
+ version: 0.0.2
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-13 00:00:00.000000000 Z
11
+ date: 2016-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.0'
97
- description: Trigger TravisCI builds with ease
97
+ description: Trigger Travis CI builds with ease
98
98
  email:
99
99
  - void@rdavis.xyz
100
100
  executables:
@@ -140,5 +140,5 @@ rubyforge_project:
140
140
  rubygems_version: 2.5.1
141
141
  signing_key:
142
142
  specification_version: 4
143
- summary: Trigger TravisCI builds
143
+ summary: Trigger Travis CI builds
144
144
  test_files: []