travis 1.11.0 → 1.12.0
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 +4 -4
- data/README.md +18 -4
- data/Rakefile +22 -20
- data/bin/travis +5 -3
- data/examples/org_overview.rb +2 -0
- data/examples/pro_auth.rb +3 -1
- data/examples/stream.rb +5 -3
- data/lib/travis/auto_login.rb +2 -0
- data/lib/travis/cli/accounts.rb +12 -9
- data/lib/travis/cli/api_command.rb +85 -81
- data/lib/travis/cli/branches.rb +8 -6
- data/lib/travis/cli/cache.rb +48 -44
- data/lib/travis/cli/cancel.rb +4 -2
- data/lib/travis/cli/command.rb +170 -142
- data/lib/travis/cli/console.rb +5 -5
- data/lib/travis/cli/disable.rb +4 -2
- data/lib/travis/cli/enable.rb +14 -12
- data/lib/travis/cli/encrypt.rb +57 -57
- data/lib/travis/cli/encrypt_file.rb +29 -18
- data/lib/travis/cli/endpoint.rb +9 -7
- data/lib/travis/cli/env.rb +13 -8
- data/lib/travis/cli/help.rb +10 -8
- data/lib/travis/cli/history.rb +19 -15
- data/lib/travis/cli/init.rb +27 -24
- data/lib/travis/cli/lint.rb +10 -8
- data/lib/travis/cli/login.rb +17 -11
- data/lib/travis/cli/logout.rb +4 -2
- data/lib/travis/cli/logs.rb +28 -19
- data/lib/travis/cli/monitor.rb +11 -8
- data/lib/travis/cli/open.rb +17 -14
- data/lib/travis/cli/parser.rb +2 -0
- data/lib/travis/cli/pubkey.rb +13 -11
- data/lib/travis/cli/raw.rb +4 -3
- data/lib/travis/cli/repo_command.rb +123 -112
- data/lib/travis/cli/report.rb +40 -33
- data/lib/travis/cli/repos.rb +14 -9
- data/lib/travis/cli/requests.rb +13 -12
- data/lib/travis/cli/restart.rb +4 -2
- data/lib/travis/cli/settings.rb +41 -35
- data/lib/travis/cli/setup/anynines.rb +7 -6
- data/lib/travis/cli/setup/appfog.rb +6 -4
- data/lib/travis/cli/setup/artifacts.rb +7 -5
- data/lib/travis/cli/setup/biicode.rb +6 -4
- data/lib/travis/cli/setup/cloud_66.rb +6 -4
- data/lib/travis/cli/setup/cloud_control.rb +8 -6
- data/lib/travis/cli/setup/cloud_files.rb +7 -5
- data/lib/travis/cli/setup/cloud_foundry.rb +9 -7
- data/lib/travis/cli/setup/code_deploy.rb +33 -29
- data/lib/travis/cli/setup/deis.rb +8 -6
- data/lib/travis/cli/setup/divshot.rb +20 -18
- data/lib/travis/cli/setup/elastic_beanstalk.rb +10 -8
- data/lib/travis/cli/setup/engine_yard.rb +9 -7
- data/lib/travis/cli/setup/gcs.rb +9 -7
- data/lib/travis/cli/setup/hackage.rb +6 -4
- data/lib/travis/cli/setup/heroku.rb +10 -4
- data/lib/travis/cli/setup/modulus.rb +5 -3
- data/lib/travis/cli/setup/ninefold.rb +7 -5
- data/lib/travis/cli/setup/nodejitsu.rb +6 -4
- data/lib/travis/cli/setup/npm.rb +6 -4
- data/lib/travis/cli/setup/open_shift.rb +8 -6
- data/lib/travis/cli/setup/opsworks.rb +24 -22
- data/lib/travis/cli/setup/pypi.rb +7 -5
- data/lib/travis/cli/setup/releases.rb +6 -6
- data/lib/travis/cli/setup/ruby_gems.rb +7 -5
- data/lib/travis/cli/setup/s3.rb +12 -8
- data/lib/travis/cli/setup/sauce_connect.rb +7 -5
- data/lib/travis/cli/setup/service.rb +36 -25
- data/lib/travis/cli/setup.rb +7 -3
- data/lib/travis/cli/show.rb +10 -8
- data/lib/travis/cli/sshkey.rb +31 -28
- data/lib/travis/cli/status.rb +5 -3
- data/lib/travis/cli/sync.rb +9 -7
- data/lib/travis/cli/token.rb +4 -2
- data/lib/travis/cli/version.rb +4 -3
- data/lib/travis/cli/whatsup.rb +10 -8
- data/lib/travis/cli/whoami.rb +2 -2
- data/lib/travis/cli.rb +39 -36
- data/lib/travis/client/account.rb +8 -6
- data/lib/travis/client/artifact.rb +16 -12
- data/lib/travis/client/auto_login.rb +7 -4
- data/lib/travis/client/broadcast.rb +2 -0
- data/lib/travis/client/build.rb +7 -3
- data/lib/travis/client/cache.rb +4 -2
- data/lib/travis/client/commit.rb +5 -2
- data/lib/travis/client/entity.rb +50 -46
- data/lib/travis/client/env_var.rb +13 -8
- data/lib/travis/client/error.rb +5 -3
- data/lib/travis/client/has_uuid.rb +3 -1
- data/lib/travis/client/job.rb +8 -3
- data/lib/travis/client/lint_result.rb +2 -0
- data/lib/travis/client/listener.rb +70 -55
- data/lib/travis/client/methods.rb +10 -5
- data/lib/travis/client/namespace.rb +20 -16
- data/lib/travis/client/not_loadable.rb +3 -1
- data/lib/travis/client/repository.rb +34 -22
- data/lib/travis/client/request.rb +5 -2
- data/lib/travis/client/restartable.rb +2 -0
- data/lib/travis/client/session.rb +118 -88
- data/lib/travis/client/settings.rb +8 -3
- data/lib/travis/client/singleton_setting.rb +2 -0
- data/lib/travis/client/ssh_key.rb +2 -0
- data/lib/travis/client/states.rb +8 -6
- data/lib/travis/client/user.rb +2 -0
- data/lib/travis/client/weak_entity.rb +6 -3
- data/lib/travis/client.rb +4 -1
- data/lib/travis/pro/auto_login.rb +2 -0
- data/lib/travis/pro.rb +2 -0
- data/lib/travis/tools/assets.rb +6 -3
- data/lib/travis/tools/completion.rb +10 -6
- data/lib/travis/tools/formatter.rb +20 -14
- data/lib/travis/tools/github.rb +59 -49
- data/lib/travis/tools/notification.rb +18 -13
- data/lib/travis/tools/safe_string.rb +4 -1
- data/lib/travis/tools/ssl_key.rb +5 -2
- data/lib/travis/tools/system.rb +11 -6
- data/lib/travis/version.rb +3 -1
- data/lib/travis.rb +3 -1
- data/spec/cli/api_command_spec.rb +11 -8
- data/spec/cli/cancel_spec.rb +2 -4
- data/spec/cli/encrypt_file_spec.rb +9 -7
- data/spec/cli/encrypt_spec.rb +19 -17
- data/spec/cli/endpoint_spec.rb +12 -10
- data/spec/cli/help_spec.rb +14 -12
- data/spec/cli/history_spec.rb +2 -0
- data/spec/cli/init_spec.rb +35 -33
- data/spec/cli/logs_spec.rb +2 -0
- data/spec/cli/open_spec.rb +6 -4
- data/spec/cli/repo_command_spec.rb +8 -4
- data/spec/cli/restart_spec.rb +2 -4
- data/spec/cli/setup/service_spec.rb +17 -18
- data/spec/cli/setup_spec.rb +2 -4
- data/spec/cli/show_spec.rb +4 -2
- data/spec/cli/status_spec.rb +7 -5
- data/spec/cli/token_spec.rb +7 -5
- data/spec/cli/version_spec.rb +2 -0
- data/spec/cli/whoami_spec.rb +9 -7
- data/spec/client/account_spec.rb +28 -20
- data/spec/client/auto_login_spec.rb +12 -9
- data/spec/client/broadcast_spec.rb +5 -3
- data/spec/client/build_spec.rb +28 -24
- data/spec/client/commit_spec.rb +17 -14
- data/spec/client/job_spec.rb +27 -23
- data/spec/client/methods_spec.rb +8 -4
- data/spec/client/namespace_spec.rb +8 -4
- data/spec/client/repository_spec.rb +33 -30
- data/spec/client/session_spec.rb +71 -67
- data/spec/client/user_spec.rb +13 -10
- data/spec/client_spec.rb +6 -4
- data/spec/pro_spec.rb +5 -3
- data/spec/spec_helper.rb +3 -1
- data/spec/support/fake_api.rb +662 -662
- data/spec/support/fake_github.rb +6 -3
- data/spec/support/helpers.rb +13 -8
- data/spec/travis_spec.rb +5 -3
- data/travis.gemspec +400 -399
- metadata +30 -50
data/lib/travis/cli/report.rb
CHANGED
@@ -1,65 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli'
|
2
4
|
require 'travis/tools/system'
|
3
5
|
|
4
6
|
module Travis
|
5
7
|
module CLI
|
6
8
|
class Report < ApiCommand
|
7
|
-
description
|
9
|
+
description 'generates a report useful for filing issues'
|
8
10
|
on '-r', '--known-repos', 'include repositories in report'
|
9
11
|
skip :authenticate, :clear_error
|
10
12
|
|
11
13
|
def run
|
12
|
-
display(
|
13
|
-
display(
|
14
|
-
display(
|
15
|
-
display(
|
16
|
-
display(
|
14
|
+
display('System', :general)
|
15
|
+
display('CLI', :cli_info)
|
16
|
+
display('Session', :session_info)
|
17
|
+
display('Endpoints', :endpoints)
|
18
|
+
display('Known Repositories', :known_repos) if known_repos?
|
17
19
|
display_error
|
18
|
-
say "For issues with the command line tool, please visit #{color(
|
19
|
-
|
20
|
+
say "For issues with the command line tool, please visit #{color(
|
21
|
+
'https://github.com/travis-ci/travis.rb/issues', :underline
|
22
|
+
)}."
|
23
|
+
say "For Travis CI in general, go to #{color('https://github.com/travis-ci/travis-ci/issues',
|
24
|
+
:underline)} or email #{color('support@travis-ci.com',
|
25
|
+
:underline)}."
|
20
26
|
end
|
21
27
|
|
22
28
|
def display_error
|
23
|
-
return unless error = load_file(
|
24
|
-
|
29
|
+
return unless (error = load_file('error.log'))
|
30
|
+
|
31
|
+
display('Last Exception', :say, color(error, :info))
|
25
32
|
end
|
26
33
|
|
27
34
|
def display(title, method, *args)
|
28
|
-
say color(title, [
|
35
|
+
say color(title, %i[bold underline])
|
29
36
|
send(method, *args) { |*a| list(*a) }
|
30
37
|
puts
|
31
38
|
end
|
32
39
|
|
33
40
|
def list(key, value, additional = nil)
|
34
41
|
value = case value
|
35
|
-
when Array then value.empty? ? 'none' : value.map(&:inspect).join(
|
36
|
-
when true then
|
37
|
-
when false then
|
38
|
-
when nil then
|
42
|
+
when Array then value.empty? ? 'none' : value.map(&:inspect).join(', ')
|
43
|
+
when true then 'yes'
|
44
|
+
when false then 'no'
|
45
|
+
when nil then 'unknown'
|
39
46
|
else value.to_s
|
40
47
|
end
|
41
48
|
additional &&= " (#{additional})"
|
42
|
-
say "#{key}:".ljust(known_repos? ? 50 : 25) <<
|
49
|
+
say "#{key}:".ljust(known_repos? ? 50 : 25) << ' ' << color(value.to_s, :bold) << additional.to_s
|
43
50
|
end
|
44
51
|
|
45
52
|
def general
|
46
|
-
yield
|
47
|
-
yield
|
48
|
-
yield
|
53
|
+
yield 'Ruby', Tools::System.ruby
|
54
|
+
yield 'Operating System', Tools::System.os
|
55
|
+
yield 'RubyGems', Tools::System.rubygems
|
49
56
|
end
|
50
57
|
|
51
58
|
def cli_info
|
52
|
-
yield
|
53
|
-
yield
|
54
|
-
yield
|
55
|
-
yield
|
59
|
+
yield 'Version', Travis::VERSION
|
60
|
+
yield 'Plugins', defined?(TRAVIS_PLUGINS) ? TRAVIS_PLUGINS : []
|
61
|
+
yield 'Auto-Completion', Tools::Completion.completion_installed?
|
62
|
+
yield 'Last Version Check', last_check['at'] ? Time.at(last_check['at']) : 'never'
|
56
63
|
end
|
57
64
|
|
58
65
|
def session_info
|
59
|
-
yield
|
60
|
-
yield
|
61
|
-
yield
|
62
|
-
yield
|
66
|
+
yield 'API Endpoint', api_endpoint
|
67
|
+
yield 'Logged In', user_info
|
68
|
+
yield 'Verify SSL', !insecure
|
69
|
+
yield 'Enterprise', enterprise?
|
63
70
|
end
|
64
71
|
|
65
72
|
def endpoints
|
@@ -74,25 +81,25 @@ module Travis
|
|
74
81
|
end
|
75
82
|
end
|
76
83
|
|
77
|
-
def endpoint_name(url, prefix =
|
84
|
+
def endpoint_name(url, prefix = '')
|
78
85
|
case url
|
79
86
|
when Travis::Client::ORG_URI then "#{prefix}org"
|
80
87
|
when Travis::Client::COM_URI then "#{prefix}com"
|
81
|
-
when /api-staging\.travis-ci/ then endpoint_name(url.sub(
|
88
|
+
when /api-staging\.travis-ci/ then endpoint_name(url.sub('api-staging.', 'api.'), 'staging-')
|
82
89
|
else
|
83
|
-
key,
|
84
|
-
key ?
|
90
|
+
key, = config['enterprise'].detect { |_k, v| v.start_with? url } if config['enterprise'].respond_to?(:detect)
|
91
|
+
key ? 'enterprise %p' % key : '???'
|
85
92
|
end
|
86
93
|
end
|
87
94
|
|
88
95
|
def known_repos
|
89
|
-
config[
|
96
|
+
config['repos'].each do |key, info|
|
90
97
|
yield key, info['endpoint']
|
91
98
|
end
|
92
99
|
end
|
93
100
|
|
94
101
|
def user_info
|
95
|
-
access_token ?
|
102
|
+
access_token ? 'as %p' % user.login : 'no'
|
96
103
|
rescue Travis::Client::Error => e
|
97
104
|
e.message
|
98
105
|
end
|
data/lib/travis/cli/repos.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli'
|
2
4
|
|
3
5
|
module Travis
|
4
6
|
module CLI
|
5
7
|
class Repos < ApiCommand
|
6
|
-
description
|
8
|
+
description 'lists repositories the user has certain permissions on'
|
7
9
|
on('-m', '--match PATTERN', 'only list repositories matching the given pattern (shell style)')
|
8
10
|
on('-o', '--owner LOGIN', 'only list repos for a certain owner')
|
9
11
|
on('-n', '--name NAME', 'only list repos with a given name')
|
@@ -15,11 +17,12 @@ module Travis
|
|
15
17
|
def run
|
16
18
|
repositories.each do |repo|
|
17
19
|
next say(repo.slug) unless interactive?
|
20
|
+
|
18
21
|
state_color = repo.active? ? :green : :yellow
|
19
|
-
say color(repo.slug, [:bold, state_color])
|
20
|
-
say color(
|
22
|
+
say "#{color(repo.slug, [:bold, state_color])} "
|
23
|
+
say color('(' << attributes(repo).map { |n, v| "#{n}: #{v ? 'yes' : 'no'}" }.join(', ') << ')', state_color)
|
21
24
|
description = repo.description.lines.first.chomp unless repo.description.to_s.empty?
|
22
|
-
say "Description: #{description ||
|
25
|
+
say "Description: #{description || '???'}"
|
23
26
|
empty_line unless repo == repositories.last
|
24
27
|
end
|
25
28
|
end
|
@@ -29,21 +32,23 @@ module Travis
|
|
29
32
|
repos = session.hooks.concat(user.repositories).uniq
|
30
33
|
session.preload(repos).sort_by(&:slug).select do |repo|
|
31
34
|
next false unless match? repo.slug
|
32
|
-
next false unless active.nil?
|
33
|
-
next false unless owner.nil?
|
34
|
-
next false unless name.nil?
|
35
|
-
next false unless admin.nil?
|
35
|
+
next false unless active.nil? || (repo.active? == active)
|
36
|
+
next false unless owner.nil? || (repo.owner_name == owner)
|
37
|
+
next false unless name.nil? || (repo.name == name)
|
38
|
+
next false unless admin.nil? || (repo.admin? == admin)
|
39
|
+
|
36
40
|
true
|
37
41
|
end
|
38
42
|
end
|
39
43
|
end
|
40
44
|
|
41
45
|
def attributes(repo)
|
42
|
-
{
|
46
|
+
{ 'active' => repo.active?, 'admin' => repo.admin?, 'push' => repo.push?, 'pull' => repo.pull? }
|
43
47
|
end
|
44
48
|
|
45
49
|
def match?(string)
|
46
50
|
return true if match.nil?
|
51
|
+
|
47
52
|
flags = File::FNM_PATHNAME | File::FNM_DOTMATCH
|
48
53
|
flags |= File::FNM_EXTGLOB if defined? File::FNM_EXTGLOB
|
49
54
|
File.fnmatch?(match, string, flags)
|
data/lib/travis/cli/requests.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli'
|
2
4
|
|
3
5
|
module Travis
|
4
6
|
module CLI
|
5
7
|
class Requests < RepoCommand
|
6
|
-
description
|
8
|
+
description 'lists recent requests'
|
7
9
|
on '-l', '--limit LIMIT', 'Maximum number requests to display'
|
8
10
|
|
9
11
|
def run
|
@@ -16,18 +18,17 @@ module Travis
|
|
16
18
|
|
17
19
|
case request.event_type
|
18
20
|
when 'push'
|
19
|
-
result = request.result ||
|
21
|
+
result = request.result || 'received'
|
20
22
|
message = request.message
|
21
|
-
message ||=
|
22
|
-
message ||=
|
23
|
-
message ||=
|
24
|
-
description = "push to #{request.branch || request.tag ||
|
23
|
+
message ||= 'validation pending' unless request.rejected? || request.accepted?
|
24
|
+
message ||= 'unknown reason' unless request.accepted?
|
25
|
+
message ||= 'triggered new build' unless request.rejected?
|
26
|
+
description = "push to #{request.branch || request.tag || '???'}"
|
25
27
|
when 'pull_request'
|
26
|
-
result = request.result ||
|
28
|
+
result = request.result || 'received'
|
27
29
|
message = request.message
|
28
|
-
message ||=
|
29
|
-
message ||=
|
30
|
-
description = "push to #{request.branch || request.tag || "???"}"
|
30
|
+
message ||= 'HEAD commit not updated' unless request.accepted?
|
31
|
+
message ||= 'triggered new build' unless request.rejected?
|
31
32
|
description = "PR ##{request.pull_request_number}"
|
32
33
|
end
|
33
34
|
|
@@ -35,9 +36,9 @@ module Travis
|
|
35
36
|
color(description, [:bold, style]),
|
36
37
|
color(result, style),
|
37
38
|
color("(#{message})", style)
|
38
|
-
].join(
|
39
|
+
].join(' ').strip + "\n"
|
39
40
|
|
40
|
-
say "
|
41
|
+
say " #{color(request.commit.short_sha, :bold)} - #{request.commit.subject}" if request.commit
|
41
42
|
say " received at: #{formatter.time(request.created_at)}"
|
42
43
|
empty_line
|
43
44
|
end
|
data/lib/travis/cli/restart.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli'
|
2
4
|
|
3
5
|
module Travis
|
4
6
|
module CLI
|
5
7
|
class Restart < RepoCommand
|
6
|
-
description
|
8
|
+
description 'restarts a build or job'
|
7
9
|
|
8
10
|
def run(number = last_build.number)
|
9
11
|
authenticate
|
@@ -11,7 +13,7 @@ module Travis
|
|
11
13
|
error "could not find job or build #{repository.slug}##{number}" unless entity
|
12
14
|
entity.restart
|
13
15
|
|
14
|
-
say
|
16
|
+
say 'restarted', "#{entity.class.one} ##{entity.number} has been %s"
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
data/lib/travis/cli/settings.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli'
|
2
4
|
|
3
5
|
module Travis
|
@@ -5,49 +7,52 @@ module Travis
|
|
5
7
|
class Settings < RepoCommand
|
6
8
|
attr_accessor :setting
|
7
9
|
|
8
|
-
description
|
10
|
+
description 'access repository settings'
|
9
11
|
on('--keys', 'always use setting key instead of description')
|
10
|
-
on('-t', '--enable', 'enable boolean setting(s)') { |c
|
11
|
-
on('-f', '--disable', 'disable boolean setting(s)') { |c
|
12
|
-
on('-s', '--set VALUE', 'set to given value') { |c,v| c.setting = v
|
12
|
+
on('-t', '--enable', 'enable boolean setting(s)') { |c| c.setting = true }
|
13
|
+
on('-f', '--disable', 'disable boolean setting(s)') { |c| c.setting = false }
|
14
|
+
on('-s', '--set VALUE', 'set to given value') { |c, v| c.setting = v }
|
13
15
|
on('-c', '--configure', 'change settings interactively')
|
14
16
|
|
15
17
|
DESCRIPTIONS = {
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
}
|
18
|
+
builds_only_with_travis_yml: 'Only run builds with a .travis.yml',
|
19
|
+
build_pushes: 'Build pushes',
|
20
|
+
build_pull_requests: 'Build pull requests',
|
21
|
+
maximum_number_of_builds: 'Maximum number of concurrent builds',
|
22
|
+
auto_cancel_pushes: 'Cancel older push builds that are not yet running',
|
23
|
+
auto_cancel_pull_requests: 'Cancel older pull request builds that are not yet running'
|
24
|
+
}.freeze
|
23
25
|
|
24
26
|
def run(*keys)
|
25
|
-
exit 1 if interactive?
|
27
|
+
exit 1 if interactive? && keys.empty? && !setting.nil? && !all_settings? && !configure?
|
26
28
|
authenticate
|
27
|
-
say repository.slug,
|
29
|
+
say repository.slug, 'Settings for %s:'
|
28
30
|
repository.settings.to_h.each do |key, value|
|
29
|
-
next unless keys.empty?
|
31
|
+
next unless keys.empty? || keys.include?(key)
|
32
|
+
|
30
33
|
if configure?
|
31
|
-
if boolean? key
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
34
|
+
repository.settings[key] = if boolean? key
|
35
|
+
agree("#{describe(key, "enable #{key}")}? ") do |q|
|
36
|
+
default = setting.nil? ? value : setting
|
37
|
+
q.default = default ? 'yes' : 'no'
|
38
|
+
end
|
39
|
+
else
|
40
|
+
ask("#{describe(key, "Value for #{key}")}: ", Integer) do |q|
|
41
|
+
default = setting.to_i if setting && setting.respond_to?(:to_i)
|
42
|
+
default ||= value
|
43
|
+
default ||= 0
|
44
|
+
q.default = default
|
45
|
+
end
|
46
|
+
end
|
44
47
|
else
|
45
48
|
value = repository.settings[key] = setting unless setting.nil?
|
46
|
-
descr = color(describe(key, color(key, :info))
|
47
|
-
|
49
|
+
descr = color(describe(key, color(key, :info)) do |s|
|
50
|
+
"#{key.ljust(30)} #{color(s, %i[reset bold])}"
|
51
|
+
end, :info)
|
52
|
+
say format_value(value) << ' ' << descr
|
48
53
|
end
|
49
54
|
end
|
50
|
-
repository.settings.save if configure?
|
55
|
+
repository.settings.save if configure? || !setting.nil?
|
51
56
|
end
|
52
57
|
|
53
58
|
def boolean?(key)
|
@@ -56,20 +61,21 @@ module Travis
|
|
56
61
|
|
57
62
|
def format_value(value)
|
58
63
|
case value
|
59
|
-
when false, nil then color(
|
60
|
-
when true then color(
|
61
|
-
else color(value.to_s.rjust(3),
|
64
|
+
when false, nil then color('[-]', %i[bold red])
|
65
|
+
when true then color('[+]', %i[bold green])
|
66
|
+
else color(value.to_s.rjust(3), %i[bold blue])
|
62
67
|
end
|
63
68
|
end
|
64
69
|
|
65
70
|
def all_settings?
|
66
|
-
agree("Really #{setting ?
|
67
|
-
q.default =
|
71
|
+
agree("Really #{setting ? 'enable' : 'disable'} all settings? ") do |q|
|
72
|
+
q.default = 'no'
|
68
73
|
end
|
69
74
|
end
|
70
75
|
|
71
76
|
def describe(key, description = key)
|
72
77
|
return description if keys?
|
78
|
+
|
73
79
|
desc = DESCRIPTIONS[key.to_sym]
|
74
80
|
desc &&= yield(desc) if block_given?
|
75
81
|
desc || description
|
@@ -1,20 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli/setup'
|
2
4
|
|
3
5
|
module Travis
|
4
6
|
module CLI
|
5
7
|
class Setup
|
6
8
|
class Anynines < Service
|
7
|
-
description
|
9
|
+
description 'automatic deployment to anynines'
|
8
10
|
|
9
11
|
def run
|
10
12
|
deploy 'anynines' do |config|
|
11
|
-
config['username'] ||= ask(
|
12
|
-
config['password'] ||= ask(
|
13
|
-
config['organization'] ||= ask(
|
14
|
-
config['space'] ||= ask(
|
13
|
+
config['username'] ||= ask('anynines username: ').to_s
|
14
|
+
config['password'] ||= ask('anynines password: ') { |q| q.echo = '*' }.to_s
|
15
|
+
config['organization'] ||= ask('anynines organization: ').to_s
|
16
|
+
config['space'] ||= ask('anynines space: ').to_s
|
15
17
|
end
|
16
18
|
end
|
17
|
-
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -1,16 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli/setup'
|
2
4
|
|
3
5
|
module Travis
|
4
6
|
module CLI
|
5
7
|
class Setup
|
6
8
|
class Appfog < Service
|
7
|
-
description
|
9
|
+
description 'automatic deployment to Appfog'
|
8
10
|
|
9
11
|
def run
|
10
12
|
deploy 'appfog' do |config|
|
11
|
-
config['email'] = ask(
|
12
|
-
config['password'] = ask(
|
13
|
-
config['app'] = ask(
|
13
|
+
config['email'] = ask('Email address: ').to_s
|
14
|
+
config['password'] = ask('Password: ') { |q| q.echo = '*' }.to_s
|
15
|
+
config['app'] = ask('App name: ') { |q| q.default = repository.name }.to_s
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli/setup'
|
2
4
|
|
3
5
|
module Travis
|
@@ -10,11 +12,11 @@ module Travis
|
|
10
12
|
def run
|
11
13
|
travis_config['addons'] ||= {}
|
12
14
|
configure 'artifacts', {}, travis_config['addons'] do |config|
|
13
|
-
config['key'] = ask(
|
14
|
-
config['secret'] = ask(
|
15
|
-
config['bucket'] = ask(
|
16
|
-
encrypt(config, 'key') if agree(
|
17
|
-
encrypt(config, 'secret') if agree(
|
15
|
+
config['key'] = ask('Access key ID: ').to_s
|
16
|
+
config['secret'] = ask('Secret access key: ') { |q| q.echo = '*' }.to_s
|
17
|
+
config['bucket'] = ask('Bucket: ').to_s
|
18
|
+
encrypt(config, 'key') if agree('Encrypt access key ID? ') { |q| q.default = 'yes' }
|
19
|
+
encrypt(config, 'secret') if agree('Encrypt secret access key? ') { |q| q.default = 'yes' }
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
@@ -1,16 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli/setup'
|
2
4
|
|
3
5
|
module Travis
|
4
6
|
module CLI
|
5
7
|
class Setup
|
6
8
|
class Biicode < Service
|
7
|
-
description
|
9
|
+
description 'automatic publish to biicode'
|
8
10
|
|
9
11
|
def run
|
10
12
|
deploy 'biicode', 'release' do |config|
|
11
|
-
config['user'] ||= ask(
|
12
|
-
config['password'] ||= ask(
|
13
|
-
on(
|
13
|
+
config['user'] ||= ask('biicode username: ') { |q| q }.to_s
|
14
|
+
config['password'] ||= ask('biicode password: ') { |q| q.echo = '*' }.to_s
|
15
|
+
on('publish only tagged commits? ', config, 'tags' => true)
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -1,20 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli/setup'
|
2
4
|
|
3
5
|
module Travis
|
4
6
|
module CLI
|
5
7
|
class Setup
|
6
8
|
class Cloud_66 < Service
|
7
|
-
description
|
9
|
+
description 'Automatic deployment to Cloud 66'
|
8
10
|
service_name 'cloud66'
|
9
11
|
|
10
12
|
def run
|
11
13
|
deploy 'cloud66', 'release' do |config|
|
12
|
-
config['redeployment_hook'] ||= ask(
|
14
|
+
config['redeployment_hook'] ||= ask('Cloud 66 Redeployment Hook Url: ') { |q| q.echo = '*' }.to_s
|
13
15
|
|
14
|
-
encrypt(config, 'redeployment_hook') if agree(
|
16
|
+
encrypt(config, 'redeployment_hook') if agree('Encrypt Redeployment Hook?') { |q| q.default = 'yes' }
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
20
|
-
end
|
22
|
+
end
|
@@ -1,21 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli/setup'
|
2
4
|
|
3
5
|
module Travis
|
4
6
|
module CLI
|
5
7
|
class Setup
|
6
8
|
class CloudControl < Service
|
7
|
-
description
|
9
|
+
description 'automatic deployment to cloudControl'
|
8
10
|
|
9
11
|
def run
|
10
12
|
deploy 'cloudcontrol' do |config|
|
11
|
-
config['email'] = ask(
|
12
|
-
config['password'] = ask(
|
13
|
-
app = ask(
|
14
|
-
dep = ask(
|
13
|
+
config['email'] = ask('cloudControl email: ').to_s
|
14
|
+
config['password'] = ask('cloudControl password: ') { |q| q.echo = '*' }.to_s
|
15
|
+
app = ask('cloudControl application: ') { |q| q.default = repository.name }.to_s
|
16
|
+
dep = ask('cloudControl deployment: ') { |q| q.default = 'default' }.to_s
|
15
17
|
config['deployment'] = "#{app}/#{dep}"
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
21
|
-
end
|
23
|
+
end
|
@@ -1,17 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli/setup'
|
2
4
|
|
3
5
|
module Travis
|
4
6
|
module CLI
|
5
7
|
class Setup
|
6
8
|
class CloudFiles < Service
|
7
|
-
description
|
9
|
+
description 'automatic pushing to Rackspace Cloud Files'
|
8
10
|
|
9
11
|
def run
|
10
12
|
deploy 'cloudfiles' do |config|
|
11
|
-
config['username'] = ask(
|
12
|
-
config['api_key'] = ask(
|
13
|
-
config['region'] = ask(
|
14
|
-
config['container'] = ask(
|
13
|
+
config['username'] = ask('Rackspace Username: ').to_s
|
14
|
+
config['api_key'] = ask('Rackspace Api Key: ') { |q| q.echo = '*' }.to_s
|
15
|
+
config['region'] = ask('Cloud Files Region: ').to_s
|
16
|
+
config['container'] = ask('Container: ').to_s
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
@@ -1,20 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'travis/cli/setup'
|
2
4
|
|
3
5
|
module Travis
|
4
6
|
module CLI
|
5
7
|
class Setup
|
6
8
|
class CloudFoundry < Service
|
7
|
-
description
|
9
|
+
description 'automatic deployment to Cloud Foundry'
|
8
10
|
|
9
11
|
def run
|
10
12
|
deploy 'cloudfoundry' do |config|
|
11
13
|
target_file = File.expand_path('.cf/config.json', Dir.home)
|
12
|
-
config['api'] ||= JSON.parse(File.read(target_file))[
|
13
|
-
config['api'] ||= ask(
|
14
|
-
config['username'] ||= ask(
|
15
|
-
config['password'] ||= ask(
|
16
|
-
config['organization'] ||= ask(
|
17
|
-
config['space'] ||= ask(
|
14
|
+
config['api'] ||= JSON.parse(File.read(target_file))['Target'] if File.exist? target_file
|
15
|
+
config['api'] ||= ask('Cloud Foundry api: ').to_s
|
16
|
+
config['username'] ||= ask('Cloud Foundry username: ').to_s
|
17
|
+
config['password'] ||= ask('Cloud Foundry password: ') { |q| q.echo = '*' }.to_s
|
18
|
+
config['organization'] ||= ask('Cloud Foundry organization: ').to_s
|
19
|
+
config['space'] ||= ask('Cloud Foundry space: ').to_s
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|