trigger_build 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +12 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +38 -0
- data/Rakefile +6 -0
- data/bin/trigger_build +6 -0
- data/lib/trigger_build/options.rb +38 -0
- data/lib/trigger_build/repo.rb +21 -0
- data/lib/trigger_build/travis.rb +21 -0
- data/lib/trigger_build/version.rb +3 -0
- data/lib/trigger_build.rb +14 -0
- data/trigger_build.gemspec +29 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2ffaa2d85aaebcf7ffdfa296b1c8b7b4bb12893f
|
4
|
+
data.tar.gz: 3a114cd362a3d4d05f6824d308643750d4d84dc7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dc3ba8a5192b0c1843bcd869e5d30eeea75526bb83bc80a427e22cea7529970bdd21bd531d21c832e489b5c950573ed4ec1d10c391f235ca78c49b383cba107c
|
7
|
+
data.tar.gz: baeac19db6d96e0ada82b1f3c31bf1c06f2122bd0e1302139728b5803fbd0b32fc4e9d4e548425705570acdec58919ab4aed1782d4c900b338a5b198a45cae3b
|
data/.editorconfig
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Ryan Davis
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# TriggerBuild
|
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
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install trigger_build
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TriggerBuild is a simple command line application that can be used to trigger builds on TravisCI.
|
22
|
+
|
23
|
+
The following example triggers a build of trigger_build:
|
24
|
+
|
25
|
+
$ trigger_build MYOB-Technology trigger_build --pro --token $TRAVIS_API_TOKEN
|
26
|
+
|
27
|
+
For detailed usage:
|
28
|
+
|
29
|
+
$ trigger_build -h
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/MYOB-Technology/trigger_build.
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
38
|
+
|
data/Rakefile
ADDED
data/bin/trigger_build
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'slop'
|
2
|
+
require 'trigger_build/version'
|
3
|
+
|
4
|
+
module TriggerBuild
|
5
|
+
|
6
|
+
class Options
|
7
|
+
|
8
|
+
def self.parse(args)
|
9
|
+
opts = Slop.parse(args) do |o|
|
10
|
+
o.banner = "usage: trigger_build [options] owner repo"
|
11
|
+
o.separator ""
|
12
|
+
o.separator "options:"
|
13
|
+
o.bool '--pro', 'use travis-ci.com'
|
14
|
+
o.string '-t', '--token',
|
15
|
+
'the TravisCI API token (default: TRAVIS_API_TOKEN)', default: ENV['TRAVIS_API_TOKEN']
|
16
|
+
o.on '-h', '--help', 'display this message' do
|
17
|
+
puts o
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
o.on '-v', '--version', 'print the version' do
|
21
|
+
puts TriggerBuild::VERSION
|
22
|
+
exit
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
unless opts.arguments.length == 2
|
27
|
+
abort opts.to_s
|
28
|
+
end
|
29
|
+
|
30
|
+
url = opts.pro? ? 'travis-ci.com' : 'travis-ci.org'
|
31
|
+
owner, repo = *opts.args
|
32
|
+
|
33
|
+
{ owner: owner, repo: repo, token: opts[:token], url: url }
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'git'
|
2
|
+
|
3
|
+
module TriggerBuild
|
4
|
+
|
5
|
+
class Repo
|
6
|
+
|
7
|
+
def initialize(directory = Dir.pwd)
|
8
|
+
@git = Git.open(directory)
|
9
|
+
end
|
10
|
+
|
11
|
+
def name
|
12
|
+
@git.dir.path.split('/').last
|
13
|
+
end
|
14
|
+
|
15
|
+
def last_commit_message
|
16
|
+
@git.gcommit(@git.log.first).message
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
|
3
|
+
module TriggerBuild
|
4
|
+
|
5
|
+
class Travis
|
6
|
+
include HTTParty
|
7
|
+
headers 'Accept' => 'application/json',
|
8
|
+
'Content-Type' => 'application/json',
|
9
|
+
'Travis-API-Version' => '3'
|
10
|
+
|
11
|
+
def initialize(opts)
|
12
|
+
self.class.base_uri "api.#{opts[:url]}/repo/#{opts[:owner]}\%2F#{opts[:repo]}"
|
13
|
+
self.class.headers 'Authorization' => "token #{opts[:token]}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def trigger(message, branch: 'master')
|
17
|
+
self.class.post('/requests', query: { request: { message: message, branch: branch } })
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'trigger_build/options'
|
2
|
+
require 'trigger_build/repo'
|
3
|
+
require 'trigger_build/travis'
|
4
|
+
|
5
|
+
module TriggerBuild
|
6
|
+
|
7
|
+
def self.travis(args = ARGV)
|
8
|
+
opts = Options.parse(args)
|
9
|
+
repo = Repo.new
|
10
|
+
travis = Travis.new(opts)
|
11
|
+
travis.trigger("Triggered by #{repo.name}: #{repo.last_commit_message}", branch: 'master')
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'trigger_build/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'trigger_build'
|
8
|
+
spec.version = TriggerBuild::VERSION
|
9
|
+
spec.authors = ['Ryan Davis']
|
10
|
+
spec.email = ['void@rdavis.xyz']
|
11
|
+
spec.executables = ['trigger_build']
|
12
|
+
|
13
|
+
spec.summary = 'Trigger TravisCI builds'
|
14
|
+
spec.description = 'Trigger TravisCI builds with ease'
|
15
|
+
spec.homepage = 'https://github.com/MYOB-Technology/trigger_build'
|
16
|
+
spec.license = 'MIT'
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = 'bin'
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_dependency 'git', '~> 1.3'
|
23
|
+
spec.add_dependency 'httparty', '~> 0.14'
|
24
|
+
spec.add_dependency 'slop', '~> 4.4'
|
25
|
+
|
26
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
27
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: trigger_build
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Davis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: git
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: httparty
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.14'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.14'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: slop
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '4.4'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.12'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.12'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
description: Trigger TravisCI builds with ease
|
98
|
+
email:
|
99
|
+
- void@rdavis.xyz
|
100
|
+
executables:
|
101
|
+
- trigger_build
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".editorconfig"
|
106
|
+
- ".gitignore"
|
107
|
+
- ".rspec"
|
108
|
+
- ".travis.yml"
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- bin/trigger_build
|
114
|
+
- lib/trigger_build.rb
|
115
|
+
- lib/trigger_build/options.rb
|
116
|
+
- lib/trigger_build/repo.rb
|
117
|
+
- lib/trigger_build/travis.rb
|
118
|
+
- lib/trigger_build/version.rb
|
119
|
+
- trigger_build.gemspec
|
120
|
+
homepage: https://github.com/MYOB-Technology/trigger_build
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata: {}
|
124
|
+
post_install_message:
|
125
|
+
rdoc_options: []
|
126
|
+
require_paths:
|
127
|
+
- lib
|
128
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
138
|
+
requirements: []
|
139
|
+
rubyforge_project:
|
140
|
+
rubygems_version: 2.5.1
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Trigger TravisCI builds
|
144
|
+
test_files: []
|