travis 1.11.1 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +34 -3
  3. data/Rakefile +22 -20
  4. data/bin/travis +5 -3
  5. data/examples/org_overview.rb +2 -0
  6. data/examples/pro_auth.rb +3 -1
  7. data/examples/stream.rb +5 -3
  8. data/lib/travis/auto_login.rb +2 -0
  9. data/lib/travis/cli/accounts.rb +12 -9
  10. data/lib/travis/cli/api_command.rb +85 -81
  11. data/lib/travis/cli/branches.rb +8 -6
  12. data/lib/travis/cli/cache.rb +48 -44
  13. data/lib/travis/cli/cancel.rb +4 -2
  14. data/lib/travis/cli/command.rb +170 -142
  15. data/lib/travis/cli/console.rb +5 -5
  16. data/lib/travis/cli/disable.rb +4 -2
  17. data/lib/travis/cli/enable.rb +14 -12
  18. data/lib/travis/cli/encrypt.rb +57 -57
  19. data/lib/travis/cli/encrypt_file.rb +29 -18
  20. data/lib/travis/cli/endpoint.rb +9 -7
  21. data/lib/travis/cli/env.rb +13 -8
  22. data/lib/travis/cli/help.rb +11 -9
  23. data/lib/travis/cli/history.rb +19 -15
  24. data/lib/travis/cli/init.rb +27 -24
  25. data/lib/travis/cli/lint.rb +10 -8
  26. data/lib/travis/cli/login.rb +17 -11
  27. data/lib/travis/cli/logout.rb +4 -2
  28. data/lib/travis/cli/logs.rb +28 -19
  29. data/lib/travis/cli/monitor.rb +11 -8
  30. data/lib/travis/cli/open.rb +17 -14
  31. data/lib/travis/cli/parser.rb +2 -0
  32. data/lib/travis/cli/pubkey.rb +13 -11
  33. data/lib/travis/cli/raw.rb +4 -3
  34. data/lib/travis/cli/regenerate_token.rb +15 -0
  35. data/lib/travis/cli/remove_token.rb +15 -0
  36. data/lib/travis/cli/repo_command.rb +123 -112
  37. data/lib/travis/cli/report.rb +40 -33
  38. data/lib/travis/cli/repos.rb +14 -9
  39. data/lib/travis/cli/requests.rb +13 -12
  40. data/lib/travis/cli/restart.rb +4 -2
  41. data/lib/travis/cli/settings.rb +41 -35
  42. data/lib/travis/cli/setup/anynines.rb +7 -6
  43. data/lib/travis/cli/setup/appfog.rb +6 -4
  44. data/lib/travis/cli/setup/artifacts.rb +7 -5
  45. data/lib/travis/cli/setup/biicode.rb +6 -4
  46. data/lib/travis/cli/setup/cloud_66.rb +6 -4
  47. data/lib/travis/cli/setup/cloud_control.rb +8 -6
  48. data/lib/travis/cli/setup/cloud_files.rb +7 -5
  49. data/lib/travis/cli/setup/cloud_foundry.rb +9 -7
  50. data/lib/travis/cli/setup/code_deploy.rb +33 -29
  51. data/lib/travis/cli/setup/deis.rb +8 -6
  52. data/lib/travis/cli/setup/divshot.rb +20 -18
  53. data/lib/travis/cli/setup/elastic_beanstalk.rb +10 -8
  54. data/lib/travis/cli/setup/engine_yard.rb +9 -7
  55. data/lib/travis/cli/setup/gcs.rb +9 -7
  56. data/lib/travis/cli/setup/hackage.rb +6 -4
  57. data/lib/travis/cli/setup/heroku.rb +10 -4
  58. data/lib/travis/cli/setup/modulus.rb +5 -3
  59. data/lib/travis/cli/setup/ninefold.rb +7 -5
  60. data/lib/travis/cli/setup/nodejitsu.rb +6 -4
  61. data/lib/travis/cli/setup/npm.rb +6 -4
  62. data/lib/travis/cli/setup/open_shift.rb +8 -6
  63. data/lib/travis/cli/setup/opsworks.rb +24 -22
  64. data/lib/travis/cli/setup/pypi.rb +7 -5
  65. data/lib/travis/cli/setup/releases.rb +6 -6
  66. data/lib/travis/cli/setup/ruby_gems.rb +7 -5
  67. data/lib/travis/cli/setup/s3.rb +12 -8
  68. data/lib/travis/cli/setup/sauce_connect.rb +7 -5
  69. data/lib/travis/cli/setup/service.rb +36 -25
  70. data/lib/travis/cli/setup.rb +7 -3
  71. data/lib/travis/cli/show.rb +10 -8
  72. data/lib/travis/cli/sshkey.rb +31 -27
  73. data/lib/travis/cli/status.rb +5 -3
  74. data/lib/travis/cli/sync.rb +9 -7
  75. data/lib/travis/cli/token.rb +4 -2
  76. data/lib/travis/cli/version.rb +4 -3
  77. data/lib/travis/cli/whatsup.rb +10 -8
  78. data/lib/travis/cli/whoami.rb +2 -2
  79. data/lib/travis/cli.rb +81 -76
  80. data/lib/travis/client/account.rb +8 -6
  81. data/lib/travis/client/artifact.rb +16 -12
  82. data/lib/travis/client/auto_login.rb +7 -4
  83. data/lib/travis/client/broadcast.rb +2 -0
  84. data/lib/travis/client/build.rb +7 -3
  85. data/lib/travis/client/cache.rb +4 -2
  86. data/lib/travis/client/commit.rb +5 -2
  87. data/lib/travis/client/entity.rb +50 -46
  88. data/lib/travis/client/env_var.rb +13 -8
  89. data/lib/travis/client/error.rb +5 -3
  90. data/lib/travis/client/has_uuid.rb +3 -1
  91. data/lib/travis/client/job.rb +8 -3
  92. data/lib/travis/client/lint_result.rb +2 -0
  93. data/lib/travis/client/listener.rb +70 -55
  94. data/lib/travis/client/methods.rb +26 -5
  95. data/lib/travis/client/namespace.rb +20 -16
  96. data/lib/travis/client/not_loadable.rb +3 -1
  97. data/lib/travis/client/repository.rb +34 -22
  98. data/lib/travis/client/request.rb +5 -2
  99. data/lib/travis/client/restartable.rb +2 -0
  100. data/lib/travis/client/session.rb +118 -88
  101. data/lib/travis/client/settings.rb +8 -3
  102. data/lib/travis/client/singleton_setting.rb +2 -0
  103. data/lib/travis/client/ssh_key.rb +2 -0
  104. data/lib/travis/client/states.rb +8 -6
  105. data/lib/travis/client/user.rb +2 -0
  106. data/lib/travis/client/weak_entity.rb +6 -3
  107. data/lib/travis/client.rb +4 -1
  108. data/lib/travis/pro/auto_login.rb +2 -0
  109. data/lib/travis/pro.rb +2 -0
  110. data/lib/travis/tools/assets.rb +6 -3
  111. data/lib/travis/tools/completion.rb +10 -6
  112. data/lib/travis/tools/formatter.rb +20 -14
  113. data/lib/travis/tools/github.rb +59 -49
  114. data/lib/travis/tools/notification.rb +18 -13
  115. data/lib/travis/tools/safe_string.rb +4 -1
  116. data/lib/travis/tools/ssl_key.rb +5 -2
  117. data/lib/travis/tools/system.rb +11 -6
  118. data/lib/travis/version.rb +3 -1
  119. data/lib/travis.rb +3 -1
  120. data/spec/cli/api_command_spec.rb +11 -8
  121. data/spec/cli/cancel_spec.rb +2 -4
  122. data/spec/cli/encrypt_file_spec.rb +9 -7
  123. data/spec/cli/encrypt_spec.rb +19 -17
  124. data/spec/cli/endpoint_spec.rb +12 -10
  125. data/spec/cli/help_spec.rb +14 -12
  126. data/spec/cli/history_spec.rb +2 -0
  127. data/spec/cli/init_spec.rb +35 -33
  128. data/spec/cli/logs_spec.rb +2 -0
  129. data/spec/cli/open_spec.rb +6 -4
  130. data/spec/cli/repo_command_spec.rb +8 -4
  131. data/spec/cli/restart_spec.rb +2 -4
  132. data/spec/cli/setup/service_spec.rb +17 -18
  133. data/spec/cli/setup_spec.rb +2 -4
  134. data/spec/cli/show_spec.rb +4 -2
  135. data/spec/cli/status_spec.rb +7 -5
  136. data/spec/cli/token_spec.rb +7 -5
  137. data/spec/cli/version_spec.rb +2 -0
  138. data/spec/cli/whoami_spec.rb +9 -7
  139. data/spec/client/account_spec.rb +28 -20
  140. data/spec/client/auto_login_spec.rb +12 -9
  141. data/spec/client/broadcast_spec.rb +5 -3
  142. data/spec/client/build_spec.rb +28 -24
  143. data/spec/client/commit_spec.rb +17 -14
  144. data/spec/client/job_spec.rb +27 -23
  145. data/spec/client/methods_spec.rb +8 -4
  146. data/spec/client/namespace_spec.rb +8 -4
  147. data/spec/client/repository_spec.rb +33 -30
  148. data/spec/client/session_spec.rb +71 -67
  149. data/spec/client/user_spec.rb +13 -10
  150. data/spec/client_spec.rb +6 -4
  151. data/spec/pro_spec.rb +5 -3
  152. data/spec/spec_helper.rb +3 -1
  153. data/spec/support/fake_api.rb +662 -662
  154. data/spec/support/fake_github.rb +6 -3
  155. data/spec/support/helpers.rb +13 -8
  156. data/spec/travis_spec.rb +5 -3
  157. data/travis.gemspec +402 -399
  158. metadata +31 -49
@@ -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 "access repository settings"
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 | c.setting = true }
11
- on('-f', '--disable', 'disable boolean setting(s)') { |c | c.setting = false }
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
- :builds_only_with_travis_yml => "Only run builds with a .travis.yml",
17
- :build_pushes => "Build pushes",
18
- :build_pull_requests => "Build pull requests",
19
- :maximum_number_of_builds => "Maximum number of concurrent builds",
20
- :auto_cancel_pushes => "Cancel older push builds that are not yet running",
21
- :auto_cancel_pull_requests => "Cancel older pull request builds that are not yet running"
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? and keys.empty? and !setting.nil? and !all_settings? and !configure?
27
+ exit 1 if interactive? && keys.empty? && !setting.nil? && !all_settings? && !configure?
26
28
  authenticate
27
- say repository.slug, "Settings for %s:"
29
+ say repository.slug, 'Settings for %s:'
28
30
  repository.settings.to_h.each do |key, value|
29
- next unless keys.empty? or keys.include? key
31
+ next unless keys.empty? || keys.include?(key)
32
+
30
33
  if configure?
31
- if boolean? key
32
- repository.settings[key] = agree("#{describe(key, "enable #{key}")}? ") do |q|
33
- default = setting.nil? ? value : setting
34
- q.default = default ? "yes" : "no"
35
- end
36
- else
37
- repository.settings[key] = ask("#{describe(key, "Value for #{key}")}: ", Integer) do |q|
38
- default = setting.to_i if setting and setting.respond_to? :to_i
39
- default ||= value
40
- default ||= 0
41
- q.default = default
42
- end
43
- end
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)) { |s| key.ljust(30) + " " + color(s, [:reset, :bold]) }, :info)
47
- say format_value(value) << " " << descr
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? or !setting.nil?
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("[-]", [ :bold, :red ])
60
- when true then color("[+]", [ :bold, :green ])
61
- else color(value.to_s.rjust(3), [ :bold, :blue ])
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 ? "enable" : "disable"} all settings? ") do |q|
67
- q.default = "no"
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 "automatic deployment to anynines"
9
+ description 'automatic deployment to anynines'
8
10
 
9
11
  def run
10
12
  deploy 'anynines' do |config|
11
- config['username'] ||= ask("anynines username: ").to_s
12
- config['password'] ||= ask("anynines password: ") { |q| q.echo = "*" }.to_s
13
- config['organization'] ||= ask("anynines organization: ").to_s
14
- config['space'] ||= ask("anynines space: ").to_s
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 "automatic deployment to Appfog"
9
+ description 'automatic deployment to Appfog'
8
10
 
9
11
  def run
10
12
  deploy 'appfog' do |config|
11
- config['email'] = ask("Email address: ").to_s
12
- config['password'] = ask("Password: ") { |q| q.echo = "*" }.to_s
13
- config['app'] = ask("App name: ") { |q| q.default = repository.name }.to_s
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("Access key ID: ").to_s
14
- config['secret'] = ask("Secret access key: ") { |q| q.echo = "*" }.to_s
15
- config['bucket'] = ask("Bucket: ").to_s
16
- encrypt(config, 'key') if agree("Encrypt access key ID? ") { |q| q.default = 'yes' }
17
- encrypt(config, 'secret') if agree("Encrypt secret access key? ") { |q| q.default = 'yes' }
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 "automatic publish to biicode"
9
+ description 'automatic publish to biicode'
8
10
 
9
11
  def run
10
12
  deploy 'biicode', 'release' do |config|
11
- config['user'] ||= ask("biicode username: ") { |q| q }.to_s
12
- config['password'] ||= ask("biicode password: ") { |q| q.echo = "*" }.to_s
13
- on("publish only tagged commits? ", config, 'tags' => true)
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 "Automatic deployment to Cloud 66"
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("Cloud 66 Redeployment Hook Url: ") { |q| q.echo = "*" }.to_s
14
+ config['redeployment_hook'] ||= ask('Cloud 66 Redeployment Hook Url: ') { |q| q.echo = '*' }.to_s
13
15
 
14
- encrypt(config, 'redeployment_hook') if agree("Encrypt Redeployment Hook?") { |q| q.default = 'yes' }
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 "automatic deployment to cloudControl"
9
+ description 'automatic deployment to cloudControl'
8
10
 
9
11
  def run
10
12
  deploy 'cloudcontrol' do |config|
11
- config['email'] = ask("cloudControl email: ").to_s
12
- config['password'] = ask("cloudControl password: ") { |q| q.echo = "*" }.to_s
13
- app = ask("cloudControl application: ") { |q| q.default = repository.name }.to_s
14
- dep = ask("cloudControl deployment: ") { |q| q.default = "default" }.to_s
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 "automatic pushing to Rackspace Cloud Files"
9
+ description 'automatic pushing to Rackspace Cloud Files'
8
10
 
9
11
  def run
10
12
  deploy 'cloudfiles' do |config|
11
- config['username'] = ask("Rackspace Username: ").to_s
12
- config['api_key'] = ask("Rackspace Api Key: ") { |q| q.echo = "*" }.to_s
13
- config['region'] = ask("Cloud Files Region: ").to_s
14
- config['container'] = ask("Container: ").to_s
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 "automatic deployment to Cloud Foundry"
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))["Target"] if File.exist? target_file
13
- config['api'] ||= ask("Cloud Foundry api: ").to_s
14
- config['username'] ||= ask("Cloud Foundry username: ").to_s
15
- config['password'] ||= ask("Cloud Foundry password: ") { |q| q.echo = "*" }.to_s
16
- config['organization'] ||= ask("Cloud Foundry organization: ").to_s
17
- config['space'] ||= ask("Cloud Foundry space: ").to_s
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'travis/cli/setup'
2
4
  require 'shellwords'
3
5
 
@@ -5,7 +7,7 @@ module Travis
5
7
  module CLI
6
8
  class Setup
7
9
  class CodeDeploy < Service
8
- description "triggering a new deployment on Amazon CodeDeploy"
10
+ description 'triggering a new deployment on Amazon CodeDeploy'
9
11
  AWS_CONFIG = File.expand_path('.aws/config', ENV['HOME'])
10
12
 
11
13
  def run
@@ -16,38 +18,40 @@ module Travis
16
18
  end
17
19
 
18
20
  deploy 'codedeploy' do |config|
19
- config['access_key_id'] = ask("Access key ID: ") { |q| q.default = access_key if access_key }.to_s
21
+ config['access_key_id'] = ask('Access key ID: ') { |q| q.default = access_key if access_key }.to_s
20
22
  secret_access_key = nil unless access_key == config['access_key_id']
21
- config['secret_access_key'] = secret_access_key || ask("Secret access key: ") { |q| q.echo = "*" }.to_s
22
- config['bucket'] = ask("S3 Bucket: ").to_s
23
- config['key'] = ask("S3 Key: ").to_s
24
- config['bundle_type'] = ask("Bundle Type: ") { |q| q.default = config['key'][/\.(zip|tar|tgz)$/, 1] }.to_s
25
- config['application'] = ask("Application Name: ") { |q| q.default = repository.name }.to_s
26
- config['deployment_group'] = ask("Deployment Group Name: ").to_s
27
- encrypt(config, 'secret_access_key') if agree("Encrypt secret access key? ") { |q| q.default = 'yes' }
23
+ config['secret_access_key'] = secret_access_key || ask('Secret access key: ') { |q| q.echo = '*' }.to_s
24
+ config['bucket'] = ask('S3 Bucket: ').to_s
25
+ config['key'] = ask('S3 Key: ').to_s
26
+ config['bundle_type'] = ask('Bundle Type: ') do |q|
27
+ q.default = config['key'][/\.(zip|tar|tgz)$/, 1]
28
+ end.to_s
29
+ config['application'] = ask('Application Name: ') { |q| q.default = repository.name }.to_s
30
+ config['deployment_group'] = ask('Deployment Group Name: ').to_s
31
+ encrypt(config, 'secret_access_key') if agree('Encrypt secret access key? ') { |q| q.default = 'yes' }
28
32
  end
29
33
 
30
- if agree("Also push bundle to S3? ")
31
- cd = travis_config['deploy']
32
- s3 = {
33
- 'provider' => 's3',
34
- 'access_key_id' => cd['access_key_id'],
35
- 'secret_access_key' => cd['secret_access_key'],
36
- 'local_dir' => 'dpl_cd_upload',
37
- 'skip_cleanup' => true,
38
- 'on' => cd['on'],
39
- 'bucket' => cd['bucket']
40
- }
34
+ return unless agree('Also push bundle to S3? ')
41
35
 
42
- s3['upload_dir'] = File.dirname(cd['key']) if cd['key'].include? '/'
43
- travis_config['deploy'] = [ s3, cd ]
44
- upload_file_name = File.basename(cd['key'])
45
- source_file = ask("Source File: ") { |q| q.default = upload_file_name }
46
- travis_config['before_deploy'] = [
47
- "mkdir -p dpl_cd_upload",
48
- "mv #{Shellwords.escape(source_file)} dpl_cd_upload/#{Shellwords.escape(upload_file_name)}"
49
- ]
50
- end
36
+ cd = travis_config['deploy']
37
+ s3 = {
38
+ 'provider' => 's3',
39
+ 'access_key_id' => cd['access_key_id'],
40
+ 'secret_access_key' => cd['secret_access_key'],
41
+ 'local_dir' => 'dpl_cd_upload',
42
+ 'skip_cleanup' => true,
43
+ 'on' => cd['on'],
44
+ 'bucket' => cd['bucket']
45
+ }
46
+
47
+ s3['upload_dir'] = File.dirname(cd['key']) if cd['key'].include? '/'
48
+ travis_config['deploy'] = [s3, cd]
49
+ upload_file_name = File.basename(cd['key'])
50
+ source_file = ask('Source File: ') { |q| q.default = upload_file_name }
51
+ travis_config['before_deploy'] = [
52
+ 'mkdir -p dpl_cd_upload',
53
+ "mv #{Shellwords.escape(source_file)} dpl_cd_upload/#{Shellwords.escape(upload_file_name)}"
54
+ ]
51
55
  end
52
56
  end
53
57
  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 Deis < Service
7
- description "automatic deployment to a deis app"
9
+ description 'automatic deployment to a deis app'
8
10
 
9
11
  def run
10
12
  deploy 'deis' do |config|
11
- config['controller'] ||= ask("Deis Controller: ").to_s
12
- config['app'] ||= ask("Deis App: ").to_s
13
- config['username'] ||= ask("Deis Username: ").to_s
14
- config['password'] ||= ask("Deis Password: ") { |q| q.echo = "*" }.to_s
13
+ config['controller'] ||= ask('Deis Controller: ').to_s
14
+ config['app'] ||= ask('Deis App: ').to_s
15
+ config['username'] ||= ask('Deis Username: ').to_s
16
+ config['password'] ||= ask('Deis Password: ') { |q| q.echo = '*' }.to_s
15
17
  end
16
18
  end
17
19
  end
18
20
  end
19
21
  end
20
- end
22
+ end
@@ -1,18 +1,20 @@
1
- require 'travis/cli/setup'
2
-
3
- module Travis
4
- module CLI
5
- class Setup
6
- class Divshot < Service
7
- description "deployment to Divshot.io"
8
-
9
- def run
10
- deploy 'divshot' do |config|
11
- config['api_key'] = ask("Divshot Api Key: ") { |q| q.echo = "*" }.to_s
12
- config['environment'] = ask("Divshot Environment: ").to_s
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'travis/cli/setup'
4
+
5
+ module Travis
6
+ module CLI
7
+ class Setup
8
+ class Divshot < Service
9
+ description 'deployment to Divshot.io'
10
+
11
+ def run
12
+ deploy 'divshot' do |config|
13
+ config['api_key'] = ask('Divshot Api Key: ') { |q| q.echo = '*' }.to_s
14
+ config['environment'] = ask('Divshot Environment: ').to_s
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ 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 ElasticBeanstalk < Service
7
- description "deployment to AWS Elastic Beanstalk"
9
+ description 'deployment to AWS Elastic Beanstalk'
8
10
 
9
11
  def run
10
12
  deploy 'elasticbeanstalk' do |config|
11
- config['access_key_id'] = ask("Access key ID: ").to_s
12
- config['secret_access_key'] = ask("Secret access key: ") { |q| q.echo = "*" }.to_s
13
- config['region'] = ask("Elastic Beanstalk region: ") {|q| q.default = 'us-east-1'}.to_s
14
- config['app'] = ask("Elastic Beanstalk application name: ").to_s
15
- config['env'] = ask("Elastic Beanstalk environment to update: ").to_s
16
- config['bucket_name'] = ask("Bucket name to upload app to: ").to_s
13
+ config['access_key_id'] = ask('Access key ID: ').to_s
14
+ config['secret_access_key'] = ask('Secret access key: ') { |q| q.echo = '*' }.to_s
15
+ config['region'] = ask('Elastic Beanstalk region: ') { |q| q.default = 'us-east-1' }.to_s
16
+ config['app'] = ask('Elastic Beanstalk application name: ').to_s
17
+ config['env'] = ask('Elastic Beanstalk environment to update: ').to_s
18
+ config['bucket_name'] = ask('Bucket name to upload app to: ').to_s
17
19
 
18
- encrypt(config, 'secret_access_key') if agree("Encrypt secret access key? ") { |q| q.default = 'yes' }
20
+ encrypt(config, 'secret_access_key') if agree('Encrypt secret access key? ') { |q| q.default = 'yes' }
19
21
  end
20
22
  end
21
23
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'travis/cli/setup'
2
4
  require 'yaml'
3
5
 
@@ -5,17 +7,17 @@ module Travis
5
7
  module CLI
6
8
  class Setup
7
9
  class EngineYard < Service
8
- description "automatic deployment to Engine Yard"
10
+ description 'automatic deployment to Engine Yard'
9
11
 
10
12
  def run
11
13
  deploy 'engineyard' do |config|
12
- eyrc = File.expand_path(".eyrc", Dir.home)
13
- config['api_key'] = YAML.load_file(eyrc)["api_token"] if File.exists?(eyrc)
14
- config['api_key'] = ask("API token: ") { |q| q.echo = "*" }.to_s unless config['api_key']
15
- env = ask("Environment (optional): ").to_s
14
+ eyrc = File.expand_path('.eyrc', Dir.home)
15
+ config['api_key'] = YAML.load_file(eyrc)['api_token'] if File.exist?(eyrc)
16
+ config['api_key'] = ask('API token: ') { |q| q.echo = '*' }.to_s unless config['api_key']
17
+ env = ask('Environment (optional): ').to_s
16
18
  config['environment'] = env unless env.empty?
17
- migrate = agree("Run migrations on deploy? ") { |q| q.default = 'yes' }
18
- config['migrate'] = ask("Migration command: ") { |q| q.default = "rake db:migrate" } if migrate
19
+ migrate = agree('Run migrations on deploy? ') { |q| q.default = 'yes' }
20
+ config['migrate'] = ask('Migration command: ') { |q| q.default = 'rake db:migrate' } if migrate
19
21
  end
20
22
  end
21
23
  end
@@ -1,22 +1,24 @@
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 GCS < Service
7
- description "automatic pushing to Google Cloud Storage"
9
+ description 'automatic pushing to Google Cloud Storage'
8
10
 
9
11
  def run
10
12
  deploy 'gcs' do |config|
11
- config['access_key_id'] = ask("Access key ID: ").to_s
12
- config['secret_access_key'] = ask("Secret access key: ") { |q| q.echo = "*" }.to_s
13
- config['bucket'] = ask("Bucket: ").to_s
14
- local_dir = ask("Local project directory to upload (Optional): ").to_s
13
+ config['access_key_id'] = ask('Access key ID: ').to_s
14
+ config['secret_access_key'] = ask('Secret access key: ') { |q| q.echo = '*' }.to_s
15
+ config['bucket'] = ask('Bucket: ').to_s
16
+ local_dir = ask('Local project directory to upload (Optional): ').to_s
15
17
  config['local-dir'] = local_dir unless local_dir.empty?
16
- encrypt(config, 'secret_access_key') if agree("Encrypt secret access key? ") { |q| q.default = 'yes' }
18
+ encrypt(config, 'secret_access_key') if agree('Encrypt secret access key? ') { |q| q.default = 'yes' }
17
19
  end
18
20
  end
19
21
  end
20
22
  end
21
23
  end
22
- end
24
+ end
@@ -1,18 +1,20 @@
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 Hackage < Service
7
- description "automatic deployment of hackage packages"
9
+ description 'automatic deployment of hackage packages'
8
10
 
9
11
  def run
10
12
  deploy 'hackage' do |config|
11
- config['username'] ||= ask("Hackage Username: ").to_s
12
- config['password'] ||= ask("Hackage Password: ") { |q| q.echo = "*" }.to_s
13
+ config['username'] ||= ask('Hackage Username: ').to_s
14
+ config['password'] ||= ask('Hackage Password: ') { |q| q.echo = '*' }.to_s
13
15
  end
14
16
  end
15
17
  end
16
18
  end
17
19
  end
18
- end
20
+ end