travis-akerl 1.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +2512 -0
- data/Rakefile +64 -0
- data/assets/cacert.pem +69 -0
- data/assets/init/c.yml +4 -0
- data/assets/init/clojure.yml +1 -0
- data/assets/init/cpp.yml +4 -0
- data/assets/init/erlang.yml +3 -0
- data/assets/init/go.yml +4 -0
- data/assets/init/groovy.yml +1 -0
- data/assets/init/haskell.yml +1 -0
- data/assets/init/java.yml +4 -0
- data/assets/init/node_js.yml +5 -0
- data/assets/init/objective-c.yml +1 -0
- data/assets/init/perl.yml +4 -0
- data/assets/init/php.yml +4 -0
- data/assets/init/python.yml +5 -0
- data/assets/init/ruby.yml +6 -0
- data/assets/init/scala.yml +4 -0
- data/assets/notifications/Travis CI.app/Contents/Info.plist +52 -0
- data/assets/notifications/Travis CI.app/Contents/MacOS/Travis CI +0 -0
- data/assets/notifications/Travis CI.app/Contents/PkgInfo +1 -0
- data/assets/notifications/Travis CI.app/Contents/Resources/Travis CI.icns +0 -0
- data/assets/notifications/Travis CI.app/Contents/Resources/en.lproj/Credits.rtf +29 -0
- data/assets/notifications/Travis CI.app/Contents/Resources/en.lproj/InfoPlist.strings +0 -0
- data/assets/notifications/Travis CI.app/Contents/Resources/en.lproj/MainMenu.nib +0 -0
- data/assets/notifications/Travis CI.app/Contents/_CodeSignature/CodeResources +173 -0
- data/assets/notifications/Travis CI.app/Contents/embedded.provisionprofile +0 -0
- data/assets/notifications/icon.png +0 -0
- data/assets/travis.sh +163 -0
- data/assets/travis.sh.erb +64 -0
- data/bin/travis +18 -0
- data/examples/org_overview.rb +3 -0
- data/examples/pro_auth.rb +23 -0
- data/examples/stream.rb +6 -0
- data/lib/travis/auto_login.rb +3 -0
- data/lib/travis/cli/accounts.rb +31 -0
- data/lib/travis/cli/api_command.rb +182 -0
- data/lib/travis/cli/branches.rb +25 -0
- data/lib/travis/cli/cache.rb +76 -0
- data/lib/travis/cli/cancel.rb +18 -0
- data/lib/travis/cli/command.rb +422 -0
- data/lib/travis/cli/console.rb +33 -0
- data/lib/travis/cli/disable.rb +15 -0
- data/lib/travis/cli/enable.rb +31 -0
- data/lib/travis/cli/encrypt.rb +115 -0
- data/lib/travis/cli/encrypt_file.rb +140 -0
- data/lib/travis/cli/endpoint.rb +35 -0
- data/lib/travis/cli/env.rb +66 -0
- data/lib/travis/cli/help.rb +23 -0
- data/lib/travis/cli/history.rb +49 -0
- data/lib/travis/cli/init.rb +82 -0
- data/lib/travis/cli/lint.rb +49 -0
- data/lib/travis/cli/login.rb +76 -0
- data/lib/travis/cli/logout.rb +14 -0
- data/lib/travis/cli/logs.rb +65 -0
- data/lib/travis/cli/monitor.rb +111 -0
- data/lib/travis/cli/open.rb +39 -0
- data/lib/travis/cli/parser.rb +43 -0
- data/lib/travis/cli/pubkey.rb +30 -0
- data/lib/travis/cli/raw.rb +20 -0
- data/lib/travis/cli/repo_command.rb +154 -0
- data/lib/travis/cli/report.rb +101 -0
- data/lib/travis/cli/repos.rb +53 -0
- data/lib/travis/cli/requests.rb +47 -0
- data/lib/travis/cli/restart.rb +18 -0
- data/lib/travis/cli/settings.rb +79 -0
- data/lib/travis/cli/setup/anynines.rb +21 -0
- data/lib/travis/cli/setup/appfog.rb +19 -0
- data/lib/travis/cli/setup/artifacts.rb +23 -0
- data/lib/travis/cli/setup/biicode.rb +19 -0
- data/lib/travis/cli/setup/cloud_66.rb +20 -0
- data/lib/travis/cli/setup/cloud_control.rb +21 -0
- data/lib/travis/cli/setup/cloud_files.rb +20 -0
- data/lib/travis/cli/setup/cloud_foundry.rb +23 -0
- data/lib/travis/cli/setup/code_deploy.rb +55 -0
- data/lib/travis/cli/setup/deis.rb +20 -0
- data/lib/travis/cli/setup/divshot.rb +18 -0
- data/lib/travis/cli/setup/elastic_beanstalk.rb +23 -0
- data/lib/travis/cli/setup/engine_yard.rb +24 -0
- data/lib/travis/cli/setup/gcs.rb +22 -0
- data/lib/travis/cli/setup/hackage.rb +18 -0
- data/lib/travis/cli/setup/heroku.rb +20 -0
- data/lib/travis/cli/setup/modulus.rb +18 -0
- data/lib/travis/cli/setup/ninefold.rb +20 -0
- data/lib/travis/cli/setup/nodejitsu.rb +27 -0
- data/lib/travis/cli/setup/npm.rb +20 -0
- data/lib/travis/cli/setup/open_shift.rb +20 -0
- data/lib/travis/cli/setup/opsworks.rb +22 -0
- data/lib/travis/cli/setup/pypi.rb +22 -0
- data/lib/travis/cli/setup/releases.rb +35 -0
- data/lib/travis/cli/setup/ruby_gems.rb +25 -0
- data/lib/travis/cli/setup/s3.rb +25 -0
- data/lib/travis/cli/setup/sauce_connect.rb +21 -0
- data/lib/travis/cli/setup/service.rb +73 -0
- data/lib/travis/cli/setup.rb +66 -0
- data/lib/travis/cli/show.rb +57 -0
- data/lib/travis/cli/sshkey.rb +118 -0
- data/lib/travis/cli/status.rb +19 -0
- data/lib/travis/cli/sync.rb +30 -0
- data/lib/travis/cli/token.rb +14 -0
- data/lib/travis/cli/version.rb +17 -0
- data/lib/travis/cli/whatsup.rb +30 -0
- data/lib/travis/cli/whoami.rb +15 -0
- data/lib/travis/cli.rb +126 -0
- data/lib/travis/client/account.rb +56 -0
- data/lib/travis/client/artifact.rb +88 -0
- data/lib/travis/client/auto_login.rb +45 -0
- data/lib/travis/client/broadcast.rb +14 -0
- data/lib/travis/client/build.rb +47 -0
- data/lib/travis/client/cache.rb +25 -0
- data/lib/travis/client/commit.rb +28 -0
- data/lib/travis/client/entity.rb +238 -0
- data/lib/travis/client/env_var.rb +102 -0
- data/lib/travis/client/error.rb +38 -0
- data/lib/travis/client/has_uuid.rb +13 -0
- data/lib/travis/client/job.rb +61 -0
- data/lib/travis/client/lint_result.rb +25 -0
- data/lib/travis/client/listener.rb +183 -0
- data/lib/travis/client/methods.rb +104 -0
- data/lib/travis/client/namespace.rb +85 -0
- data/lib/travis/client/not_loadable.rb +13 -0
- data/lib/travis/client/repository.rb +224 -0
- data/lib/travis/client/request.rb +36 -0
- data/lib/travis/client/restartable.rb +23 -0
- data/lib/travis/client/session.rb +339 -0
- data/lib/travis/client/settings.rb +25 -0
- data/lib/travis/client/singleton_setting.rb +36 -0
- data/lib/travis/client/ssh_key.rb +11 -0
- data/lib/travis/client/states.rb +98 -0
- data/lib/travis/client/user.rb +67 -0
- data/lib/travis/client/weak_entity.rb +26 -0
- data/lib/travis/client.rb +38 -0
- data/lib/travis/pro/auto_login.rb +3 -0
- data/lib/travis/pro.rb +5 -0
- data/lib/travis/tools/assets.rb +21 -0
- data/lib/travis/tools/completion.rb +54 -0
- data/lib/travis/tools/formatter.rb +50 -0
- data/lib/travis/tools/github.rb +293 -0
- data/lib/travis/tools/notification.rb +69 -0
- data/lib/travis/tools/safe_string.rb +22 -0
- data/lib/travis/tools/ssl_key.rb +48 -0
- data/lib/travis/tools/system.rb +88 -0
- data/lib/travis/version.rb +3 -0
- data/lib/travis.rb +8 -0
- data/spec/cli/api_command_spec.rb +38 -0
- data/spec/cli/cancel_spec.rb +15 -0
- data/spec/cli/encrypt_spec.rb +49 -0
- data/spec/cli/endpoint_spec.rb +39 -0
- data/spec/cli/help_spec.rb +33 -0
- data/spec/cli/history_spec.rb +38 -0
- data/spec/cli/init_spec.rb +227 -0
- data/spec/cli/login_spec.rb +13 -0
- data/spec/cli/logs_spec.rb +8 -0
- data/spec/cli/open_spec.rb +33 -0
- data/spec/cli/repo_command_spec.rb +25 -0
- data/spec/cli/restart_spec.rb +15 -0
- data/spec/cli/setup_spec.rb +5 -0
- data/spec/cli/show_spec.rb +9 -0
- data/spec/cli/status_spec.rb +28 -0
- data/spec/cli/token_spec.rb +22 -0
- data/spec/cli/version_spec.rb +18 -0
- data/spec/cli/whoami_spec.rb +34 -0
- data/spec/client/account_spec.rb +32 -0
- data/spec/client/auto_login_spec.rb +25 -0
- data/spec/client/broadcast_spec.rb +10 -0
- data/spec/client/build_spec.rb +31 -0
- data/spec/client/commit_spec.rb +22 -0
- data/spec/client/job_spec.rb +30 -0
- data/spec/client/methods_spec.rb +15 -0
- data/spec/client/namespace_spec.rb +19 -0
- data/spec/client/repository_spec.rb +39 -0
- data/spec/client/session_spec.rb +165 -0
- data/spec/client/user_spec.rb +16 -0
- data/spec/client_spec.rb +17 -0
- data/spec/pro_spec.rb +10 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/support/fake_api.rb +731 -0
- data/spec/support/fake_github.rb +24 -0
- data/spec/support/fake_travis_config.yml +14 -0
- data/spec/support/helpers.rb +45 -0
- data/spec/travis_spec.rb +10 -0
- data/travis.gemspec +371 -0
- metadata +534 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
require 'travis/cli'
|
|
2
|
+
|
|
3
|
+
module Travis
|
|
4
|
+
module CLI
|
|
5
|
+
class ApiCommand < Command
|
|
6
|
+
include Travis::Client::Methods
|
|
7
|
+
attr_accessor :enterprise_name
|
|
8
|
+
attr_reader :session
|
|
9
|
+
abstract
|
|
10
|
+
|
|
11
|
+
on('-e', '--api-endpoint URL', 'Travis API server to talk to')
|
|
12
|
+
on('-I', '--[no-]insecure', 'do not verify SSL certificate of API endpoint')
|
|
13
|
+
on('--pro', "short-cut for --api-endpoint '#{Travis::Client::COM_URI}'") { |c,_| c.api_endpoint = Travis::Client::COM_URI }
|
|
14
|
+
on('--com', "short-cut for --api-endpoint '#{Travis::Client::COM_URI}'") { |c,_| c.api_endpoint = Travis::Client::COM_URI }
|
|
15
|
+
on('--org', "short-cut for --api-endpoint '#{Travis::Client::ORG_URI}'") { |c,_| c.api_endpoint = Travis::Client::ORG_URI }
|
|
16
|
+
on('--staging', 'talks to staging system') { |c,_| c.api_endpoint = c.api_endpoint.gsub(/api/, 'api-staging') }
|
|
17
|
+
on('-t', '--token [ACCESS_TOKEN]', 'access token to use') { |c, t| c.access_token = t }
|
|
18
|
+
|
|
19
|
+
on('--debug', 'show API requests') do |c,_|
|
|
20
|
+
c.debug = true
|
|
21
|
+
c.session.instrument do |info, request|
|
|
22
|
+
c.time(info, request)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
on('--debug-http', 'show HTTP(S) exchange') do |c,_|
|
|
27
|
+
c.session.debug_http = true
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
on('-X', '--enterprise [NAME]', 'use enterprise setup (optionally takes name for multiple setups)') do |c, name|
|
|
31
|
+
c.enterprise_name = name || 'default'
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
on('--adapter ADAPTER', 'Faraday adapter to use for HTTP requests') do |c, adapter|
|
|
35
|
+
adapter.gsub! '-', '_'
|
|
36
|
+
require "faraday/adapter/#{adapter}"
|
|
37
|
+
require 'typhoeus/adapters/faraday' if adapter == 'typhoeus'
|
|
38
|
+
c.session.faraday_adapter = adapter.to_sym
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def initialize(*)
|
|
42
|
+
@session = Travis::Client.new(:agent_info => "command #{command_name}")
|
|
43
|
+
super
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def endpoint_config
|
|
47
|
+
config['endpoints'] ||= {}
|
|
48
|
+
config['endpoints'][api_endpoint] ||= {}
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def setup
|
|
52
|
+
setup_enterprise
|
|
53
|
+
self.api_endpoint = default_endpoint if default_endpoint and not explicit_api_endpoint?
|
|
54
|
+
self.access_token ||= fetch_token
|
|
55
|
+
endpoint_config['access_token'] ||= access_token
|
|
56
|
+
endpoint_config['insecure'] = insecure unless insecure.nil?
|
|
57
|
+
self.insecure = endpoint_config['insecure']
|
|
58
|
+
session.ssl = { :verify => false } if insecure?
|
|
59
|
+
authenticate if pro? or enterprise?
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def enterprise?
|
|
63
|
+
!!endpoint_config['enterprise']
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def pro?
|
|
67
|
+
api_endpoint == Travis::Client::COM_URI
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def org?
|
|
71
|
+
api_endpoint == Travis::Client::ORG_URI
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def detected_endpoint?
|
|
75
|
+
api_endpoint == detected_endpoint
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def authenticate
|
|
79
|
+
error "not logged in, please run #{command("login#{endpoint_option}")}" if access_token.nil?
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def sync(block = true, dot = '.')
|
|
83
|
+
user.sync
|
|
84
|
+
|
|
85
|
+
steps = count = 1
|
|
86
|
+
while block and user.reload.syncing?
|
|
87
|
+
count += 1
|
|
88
|
+
sleep(1)
|
|
89
|
+
|
|
90
|
+
if count % steps == 0
|
|
91
|
+
steps = count/10 + 1
|
|
92
|
+
output.print dot
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
private
|
|
98
|
+
|
|
99
|
+
def setup_enterprise
|
|
100
|
+
return unless setup_enterprise?
|
|
101
|
+
c = config['enterprise'] ||= {}
|
|
102
|
+
c[enterprise_name] = api_endpoint if explicit_api_endpoint?
|
|
103
|
+
c[enterprise_name] ||= write_to($stderr) do
|
|
104
|
+
error "enterprise setup not configured" unless interactive?
|
|
105
|
+
user_input = ask(color("Enterprise domain: ", :bold)).to_s
|
|
106
|
+
domain = user_input[%r{^(?:https?://)?(.*?)/?(?:/api/?)?$}, 1]
|
|
107
|
+
endpoint = "https://#{domain}/api"
|
|
108
|
+
config['default_endpoint'] = endpoint if agree("Use #{color domain, :bold} as default endpoint? ") { |q| q.default = 'yes' }
|
|
109
|
+
endpoint
|
|
110
|
+
end
|
|
111
|
+
self.api_endpoint = c[enterprise_name]
|
|
112
|
+
self.insecure = insecure unless insecure.nil?
|
|
113
|
+
self.session.ssl.delete :ca_file
|
|
114
|
+
endpoint_config['enterprise'] = true
|
|
115
|
+
@setup_ennterpise = true
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def setup_enterprise?
|
|
119
|
+
@setup_ennterpise ||= false
|
|
120
|
+
!!enterprise_name and not @setup_ennterpise
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def load_gh
|
|
124
|
+
return if defined? GH
|
|
125
|
+
debug "Loading gh"
|
|
126
|
+
require 'gh'
|
|
127
|
+
|
|
128
|
+
gh_config = session.config['github']
|
|
129
|
+
gh_config &&= gh_config.inject({}) { |h,(k,v)| h.update(k.to_sym => v) }
|
|
130
|
+
gh_config ||= {}
|
|
131
|
+
gh_config[:ssl] = Travis::Client::Session::SSL_OPTIONS
|
|
132
|
+
gh_config[:ssl] = { :verify => false } if gh_config[:api_url] and gh_config[:api_url] != "https://api.github.com"
|
|
133
|
+
gh_config.delete :scopes
|
|
134
|
+
|
|
135
|
+
gh_config[:instrumenter] = proc do |type, payload, &block|
|
|
136
|
+
next block.call unless type == 'http.gh'
|
|
137
|
+
time("GitHub API: #{payload[:verb].to_s.upcase} #{payload[:url]}", block)
|
|
138
|
+
end if debug?
|
|
139
|
+
|
|
140
|
+
GH.set(gh_config)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def github_endpoint
|
|
144
|
+
load_gh
|
|
145
|
+
GH.with({}).api_host
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
def listen(*args)
|
|
149
|
+
super(*args) do |listener|
|
|
150
|
+
on_signal { listener.disconnect }
|
|
151
|
+
yield listener
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
def default_endpoint
|
|
156
|
+
ENV['TRAVIS_ENDPOINT'] || config['default_endpoint']
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
def detected_endpoint
|
|
160
|
+
default_endpoint || Travis::Client::ORG_URI
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
def endpoint_option
|
|
164
|
+
return "" if org? and detected_endpoint?
|
|
165
|
+
return " --org" if org?
|
|
166
|
+
return " --pro" if pro?
|
|
167
|
+
|
|
168
|
+
if config['enterprise']
|
|
169
|
+
key, _ = config['enterprise'].detect { |k,v| v.start_with? api_endpoint }
|
|
170
|
+
return " -X" if key == "default"
|
|
171
|
+
return " -X #{key}" if key
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
" -e %p" % api_endpoint
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
def fetch_token
|
|
178
|
+
ENV['TRAVIS_TOKEN'] || endpoint_config['access_token']
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'travis/cli'
|
|
2
|
+
|
|
3
|
+
module Travis
|
|
4
|
+
module CLI
|
|
5
|
+
class Branches < RepoCommand
|
|
6
|
+
description "displays the most recent build for each branch"
|
|
7
|
+
|
|
8
|
+
def run
|
|
9
|
+
repository.last_on_branch.each do |build|
|
|
10
|
+
say [
|
|
11
|
+
color("#{build.branch_info}:".ljust(longest + 2), [:info, :bold]),
|
|
12
|
+
color("##{build.number.to_s.ljust(4)} #{build.state}".ljust(16), build.color),
|
|
13
|
+
build.commit.subject
|
|
14
|
+
].join(" ").strip + "\n"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
def longest
|
|
21
|
+
repository.branches.keys.map { |b| b.size }.max
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
require 'travis/cli'
|
|
2
|
+
|
|
3
|
+
module Travis
|
|
4
|
+
module CLI
|
|
5
|
+
class Cache < RepoCommand
|
|
6
|
+
description 'lists or deletes repository caches'
|
|
7
|
+
on '-d', '--delete', 'delete listed caches'
|
|
8
|
+
on '-b', '--branch BRANCH', 'only list/delete caches on given branch'
|
|
9
|
+
on '-m', '--match STRING', 'only list/delete caches where slug matches given string'
|
|
10
|
+
on '-f', '--force', 'do not ask user to confirm deleting the caches'
|
|
11
|
+
|
|
12
|
+
def run
|
|
13
|
+
error "not allowed to access caches for #{color(repository.slug, :bold)}" unless repository.push?
|
|
14
|
+
branches = caches.group_by(&:branch)
|
|
15
|
+
check_caches
|
|
16
|
+
|
|
17
|
+
warn "Deleted the following caches:\n" if delete?
|
|
18
|
+
branches.each { |name, list| display_branch(name, list) }
|
|
19
|
+
size = caches.inject(0) { |s,c| s + c.size }
|
|
20
|
+
say "Overall size of above caches: " << formatter.file_size(size)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
def check_caches
|
|
26
|
+
return if caches.any?
|
|
27
|
+
say "no caches found"
|
|
28
|
+
exit
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def display_branch(name, list)
|
|
32
|
+
say color(name ? "On branch #{name}:" : "Global:", :important)
|
|
33
|
+
list.each { |c| display_cache(c) }
|
|
34
|
+
puts
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def display_cache(cache)
|
|
38
|
+
say [
|
|
39
|
+
color(cache.slug.ljust(space), :bold),
|
|
40
|
+
"last modified: " << formatter.time(cache.last_modified),
|
|
41
|
+
"size: " << formatter.file_size(cache.size)
|
|
42
|
+
].join(" ") << "\n"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def params
|
|
46
|
+
params = {}
|
|
47
|
+
params[:branch] = branch if branch?
|
|
48
|
+
params[:match] = match if match?
|
|
49
|
+
params
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def caches
|
|
53
|
+
@caches ||= drop? ? repository.delete_caches(params) : repository.caches(params)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def space
|
|
57
|
+
@space ||= caches.map(&:slug).map(&:size).max
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def drop?
|
|
61
|
+
return false unless delete?
|
|
62
|
+
return true if force?
|
|
63
|
+
error "not deleting caches without --force" unless interactive?
|
|
64
|
+
error "aborted" unless danger_zone? "Do you really want to delete #{description}?"
|
|
65
|
+
true
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def description
|
|
69
|
+
description = color("all caches", :important)
|
|
70
|
+
description << " on branch #{color(branch, :important)}" if branch?
|
|
71
|
+
description << " that match #{color(match, :important)}" if match?
|
|
72
|
+
description
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'travis/cli'
|
|
2
|
+
|
|
3
|
+
module Travis
|
|
4
|
+
module CLI
|
|
5
|
+
class Cancel < RepoCommand
|
|
6
|
+
description "cancels a job or build"
|
|
7
|
+
|
|
8
|
+
def run(number = last_build.number)
|
|
9
|
+
authenticate
|
|
10
|
+
entity = job(number) || build(number)
|
|
11
|
+
error "could not find job or build #{repository.slug}##{number}" unless entity
|
|
12
|
+
entity.cancel
|
|
13
|
+
|
|
14
|
+
say "canceled", "#{entity.class.one} ##{entity.number} has been %s"
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|