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,20 +1,26 @@
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 Heroku < Service
7
- description "automatic deployment to Heroku"
9
+ description 'automatic deployment to Heroku'
8
10
 
9
11
  def run
10
12
  deploy 'heroku' do |config|
11
13
  config['api_key'] = `heroku auth:token 2>/dev/null`.strip
12
- config['api_key'] = ask("Heroku API token: ") { |q| q.echo = "*" }.to_s if config['api_key'].empty?
14
+ config['api_key'] = ask('Heroku API token: ') { |q| q.echo = '*' }.to_s if config['api_key'].empty?
13
15
  config['app'] = `heroku apps:info 2>/dev/null`.scan(/^=== (.+)$/).flatten.first
14
- config['app'] = ask("Heroku application name: ") { |q| q.default = repository.name }.to_s if config['app'].nil?
16
+ if config['app'].nil?
17
+ config['app'] = ask('Heroku application name: ') do |q|
18
+ q.default = repository.name
19
+ end.to_s
20
+ end
15
21
  end
16
22
  end
17
23
  end
18
24
  end
19
25
  end
20
- end
26
+ end
@@ -1,15 +1,17 @@
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 Modulus < Service
7
- description "deployment to Modulus"
9
+ description 'deployment to Modulus'
8
10
 
9
11
  def run
10
12
  deploy 'modulus' do |config|
11
- config['api_key'] = ask("Modulus Api Key: ") { |q| q.echo = "*" }.to_s
12
- config['project_name'] = ask("Modulus Project Name: ").to_s
13
+ config['api_key'] = ask('Modulus Api Key: ') { |q| q.echo = '*' }.to_s
14
+ config['project_name'] = ask('Modulus Project Name: ').to_s
13
15
  end
14
16
  end
15
17
  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 Ninefold < Service
7
- description "Automatic deployment to Ninefold"
9
+ description 'Automatic deployment to Ninefold'
8
10
 
9
11
  def run
10
12
  deploy 'ninefold', 'release' do |config|
11
- config['app_id'] ||= ask("Ninefold App ID: ").to_s
12
- config['auth_token'] ||= ask("Ninefold Auth Token: ") { |q| q.echo = "*" }.to_s
13
+ config['app_id'] ||= ask('Ninefold App ID: ').to_s
14
+ config['auth_token'] ||= ask('Ninefold Auth Token: ') { |q| q.echo = '*' }.to_s
13
15
 
14
- encrypt(config, 'auth_token') if agree("Encrypt Auth Token? ") { |q| q.default = 'yes' }
16
+ encrypt(config, 'auth_token') if agree('Encrypt Auth Token? ') { |q| q.default = 'yes' }
15
17
  end
16
18
  end
17
19
  end
18
20
  end
19
21
  end
20
- end
22
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'travis/cli/setup'
2
4
  require 'json'
3
5
 
@@ -5,7 +7,7 @@ module Travis
5
7
  module CLI
6
8
  class Setup
7
9
  class Nodejitsu < Service
8
- description "automatic deployment to Nodejitsu"
10
+ description 'automatic deployment to Nodejitsu'
9
11
 
10
12
  def run
11
13
  deploy 'nodejitsu' do |config|
@@ -17,11 +19,11 @@ module Travis
17
19
  config['api_key'] = jitsu_conf['apiToken']
18
20
  end
19
21
 
20
- config['user'] ||= ask("Nodejitsu user: ").to_s
21
- config['api_key'] ||= ask("Nodejitsu API token: ") { |q| q.echo = "*" }.to_s
22
+ config['user'] ||= ask('Nodejitsu user: ').to_s
23
+ config['api_key'] ||= ask('Nodejitsu API token: ') { |q| q.echo = '*' }.to_s
22
24
  end
23
25
  end
24
26
  end
25
27
  end
26
28
  end
27
- end
29
+ 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 NPM < Service
7
- description "automatic release to npm"
9
+ description 'automatic release to npm'
8
10
 
9
11
  def run
10
12
  deploy 'npm', 'release' do |config|
11
- config['email'] ||= ask("npm email address: ") { |q| q }.to_s
12
- config['api_key'] ||= ask("npm api key: ") { |q| q.echo = "*" }.to_s
13
+ config['email'] ||= ask('npm email address: ') { |q| q }.to_s
14
+ config['api_key'] ||= ask('npm api key: ') { |q| q.echo = '*' }.to_s
13
15
 
14
- on("release only tagged commits? ", config, 'tags' => true)
16
+ on('release only tagged commits? ', config, 'tags' => true)
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 OpenShift < Service
7
- description "automatic deployment to OpenShfit"
9
+ description 'automatic deployment to OpenShfit'
8
10
 
9
11
  def run
10
12
  deploy 'openshift' do |config|
11
- config['user'] = ask("OpenShift user: ").to_s
12
- config['password'] = ask("OpenShift password: ") { |q| q.echo = "*" }.to_s
13
- config['app'] = ask("OpenShift application name: ") { |q| q.default = repository.name }.to_s
14
- config['domain'] = ask("OpenShift domain: ").to_s
13
+ config['user'] = ask('OpenShift user: ').to_s
14
+ config['password'] = ask('OpenShift password: ') { |q| q.echo = '*' }.to_s
15
+ config['app'] = ask('OpenShift application name: ') { |q| q.default = repository.name }.to_s
16
+ config['domain'] = ask('OpenShift domain: ').to_s
15
17
  end
16
18
  end
17
19
  end
18
20
  end
19
21
  end
20
- end
22
+ end
@@ -1,22 +1,24 @@
1
- require 'travis/cli/setup'
2
-
3
- module Travis
4
- module CLI
5
- class Setup
6
- class OpsWorks < Service
7
- description "deployment to OpsWorks"
8
-
9
- def run
10
- deploy 'opsworks' 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['app-id'] = ask("App ID: ").to_s
14
- config['migrate'] = true if agree("Migrate the Database? ") { |q| q.default = 'no' }
15
-
16
- encrypt(config, 'secret_access_key') if agree("Encrypt secret access key? ") { |q| q.default = 'yes' }
17
- end
18
- end
19
- end
20
- end
21
- end
22
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'travis/cli/setup'
4
+
5
+ module Travis
6
+ module CLI
7
+ class Setup
8
+ class OpsWorks < Service
9
+ description 'deployment to OpsWorks'
10
+
11
+ def run
12
+ deploy 'opsworks' do |config|
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['app-id'] = ask('App ID: ').to_s
16
+ config['migrate'] = true if agree('Migrate the Database? ') { |q| q.default = 'no' }
17
+
18
+ encrypt(config, 'secret_access_key') if agree('Encrypt secret access key? ') { |q| q.default = 'yes' }
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,19 +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 PyPI < Service
7
- description "automatic deployment to PyPI"
9
+ description 'automatic deployment to PyPI'
8
10
 
9
11
  def run
10
12
  deploy 'pypi', 'release' do |config|
11
- config['user'] ||= ask("Username: ").to_s
12
- config['password'] ||= ask("Password: ") { |q| q.echo = "*" }.to_s
13
+ config['user'] ||= ask('Username: ').to_s
14
+ config['password'] ||= ask('Password: ') { |q| q.echo = '*' }.to_s
13
15
 
14
- on("release only tagged commits? ", config, 'tags' => true)
16
+ on('release only tagged commits? ', config, 'tags' => true)
15
17
  # the default of pypi `setup.py build` is the `sdist`
16
- on("deploy as wheel file too? ", config, 'distributions' => 'sdist bdist_wheel')
18
+ on('deploy as wheel file too? ', config, 'distributions' => 'sdist bdist_wheel')
17
19
  end
18
20
  end
19
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'travis/cli/setup'
2
4
  require 'travis/tools/github'
3
5
 
@@ -5,16 +7,14 @@ module Travis
5
7
  module CLI
6
8
  class Setup
7
9
  class Releases < Service
8
- description "Upload Assets to GitHub Releases"
10
+ description 'Upload Assets to GitHub Releases'
9
11
 
10
12
  def run
11
13
  deploy 'releases' do |config|
12
14
  github.with_token { |t| config['api_key'] = t }
13
- if config['api_key'].nil?
14
- raise Travis::Client::GitHubLoginFailed, 'all GitHub tokens given were invalid'
15
- end
15
+ raise Travis::Client::GitHubLoginFailed, 'all GitHub tokens given were invalid' if config['api_key'].nil?
16
16
 
17
- config['file'] = ask("File to Upload: ").to_s
17
+ config['file'] = ask('File to Upload: ').to_s
18
18
  end
19
19
  end
20
20
 
@@ -25,7 +25,7 @@ module Travis
25
25
  g.drop_token = false
26
26
  g.github_token = github_token
27
27
  g.debug = proc { |log| debug(log) }
28
- g.after_tokens = proc { g.explode = true and error("no suitable github token found") }
28
+ g.after_tokens = proc { g.explode = true and error('no suitable github token found') }
29
29
  g.scopes = org? ? ['public_repo'] : ['repo']
30
30
  g.note = "automatic releases for #{repository.slug}"
31
31
  end
@@ -1,10 +1,12 @@
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 RubyGems < Service
7
- description "automatic release to RubyGems"
9
+ description 'automatic release to RubyGems'
8
10
 
9
11
  def run
10
12
  deploy 'rubygems', 'release' do |config|
@@ -13,13 +15,13 @@ module Travis
13
15
 
14
16
  config['api_key'] ||= File.read(authorization_file) if File.exist? authorization_file
15
17
  config['api_key'] ||= YAML.load_file(credentials_file)[:rubygems_api_key] if File.exist? credentials_file
16
- config['api_key'] ||= ask("RubyGems API token: ") { |q| q.echo = "*" }.to_s
17
- config['gem'] ||= ask("Gem name: ") { |q| q.default = repository.name }.to_s
18
+ config['api_key'] ||= ask('RubyGems API token: ') { |q| q.echo = '*' }.to_s
19
+ config['gem'] ||= ask('Gem name: ') { |q| q.default = repository.name }.to_s
18
20
 
19
- on("Release only tagged commits? ", config, 'tags' => true)
21
+ on('Release only tagged commits? ', config, 'tags' => true)
20
22
  end
21
23
  end
22
24
  end
23
25
  end
24
26
  end
25
- end
27
+ end
@@ -1,22 +1,26 @@
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 S3 < Service
7
- description "automatic pushing to S3"
9
+ description 'automatic pushing to S3'
8
10
 
9
11
  def run
10
12
  deploy 's3', 'push' 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
- upload_dir = ask("S3 upload directory (Optional): ").to_s
18
+ upload_dir = ask('S3 upload directory (Optional): ').to_s
17
19
  config['upload-dir'] = upload_dir unless upload_dir.empty?
18
- config['acl'] = ask("S3 ACL Settings (private, public_read, public_read_write, authenticated_read, bucket_owner_read, bucket_owner_full_control): ").to_s { |q| q.default = 'private'}
19
- encrypt(config, 'secret_access_key') if agree("Encrypt secret access key? ") { |q| q.default = 'yes' }
20
+ config['acl'] = ask('S3 ACL Settings (private, public_read, public_read_write, authenticated_read, bucket_owner_read, bucket_owner_full_control): ').to_s do |q|
21
+ q.default = 'private'
22
+ end
23
+ encrypt(config, 'secret_access_key') if agree('Encrypt secret access key? ') { |q| q.default = 'yes' }
20
24
  end
21
25
  end
22
26
  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 SauceConnect < Service
7
- description "Sauce Connet addon for Sauce Labs integration"
8
- service_name "sauce_connect"
9
+ description 'Sauce Connet addon for Sauce Labs integration'
10
+ service_name 'sauce_connect'
9
11
 
10
12
  def run
11
13
  travis_config['addons'] ||= {}
12
14
  configure 'sauce_connect', {}, travis_config['addons'] do |config|
13
- config['username'] = ask("Sauce Labs user: ").to_s
14
- config['access_key'] = ask("Sauce Labs access key: ") { |q| q.echo = "*" }.to_s
15
- encrypt(config, 'access_key') if agree("Encrypt access key? ") { |q| q.default = 'yes' }
15
+ config['username'] = ask('Sauce Labs user: ').to_s
16
+ config['access_key'] = ask('Sauce Labs access key: ') { |q| q.echo = '*' }.to_s
17
+ encrypt(config, 'access_key') if agree('Encrypt access key? ') { |q| q.default = 'yes' }
16
18
  end
17
19
  end
18
20
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'travis/cli/setup'
2
4
 
3
5
  module Travis
@@ -9,7 +11,7 @@ module Travis
9
11
  end
10
12
 
11
13
  def self.description(description = nil)
12
- @description ||= ""
14
+ @description ||= ''
13
15
  @description = description if description
14
16
  @description
15
17
  end
@@ -36,39 +38,48 @@ module Travis
36
38
 
37
39
  private
38
40
 
39
- def on(question, config, condition)
40
- return unless agree(question) { |q| q.default = 'yes' }
41
- config['on'] ||= {}
42
- config['on'].merge! condition
43
- end
41
+ def on(question, config, condition)
42
+ return unless agree(question) { |q| q.default = 'yes' }
44
43
 
45
- def encrypt(config, key)
46
- encrypted = repository.encrypt(config.fetch(key))
47
- config[key] = { 'secure' => encrypted }
48
- end
44
+ config['on'] ||= {}
45
+ config['on'].merge! condition
46
+ end
49
47
 
50
- def configure(key, value = {}, config = travis_config)
51
- error "#{key} section already exists in .travis.yml, run with --force to override" if config.include? key and not force?
52
- yield(config[key] = value)
53
- end
48
+ def encrypt(config, key)
49
+ encrypted = repository.encrypt(config.fetch(key))
50
+ config[key] = { 'secure' => encrypted }
51
+ end
54
52
 
55
- def branch
56
- @branch ||= `git rev-parse --symbolic-full-name --abbrev-ref HEAD`.chomp
53
+ def configure(key, value = {}, config = travis_config)
54
+ if config.include?(key) && !force?
55
+ error "#{key} section already exists in .travis.yml, run with --force to override"
57
56
  end
57
+ yield(config[key] = value)
58
+ end
58
59
 
59
- def deploy(provider, verb = "deploy")
60
- configure('deploy', 'provider' => provider) do |config|
61
- yield config
62
-
63
- on("#{verb.capitalize} only from #{repository.slug}? ", config, 'repo' => repository.slug)
64
- on("#{verb.capitalize} from #{branch} branch? ", config, 'branch' => branch) if branch != 'master' and branch != 'HEAD'
60
+ def branch
61
+ @branch ||= `git rev-parse --symbolic-full-name --abbrev-ref HEAD`.chomp
62
+ end
65
63
 
66
- config['skip_cleanup'] = 'true' if not ( config.has_key?('skip_cleanup') or config.fetch('edge', 'false') != 'false' )
64
+ def deploy(provider, verb = 'deploy')
65
+ configure('deploy', 'provider' => provider) do |config|
66
+ yield config
67
67
 
68
- encrypt(config, 'password') if config['password'] and agree("Encrypt Password? ") { |q| q.default = 'yes' }
69
- encrypt(config, 'api_key') if config['api_key'] and agree("Encrypt API key? ") { |q| q.default = 'yes' }
68
+ on("#{verb.capitalize} only from #{repository.slug}? ", config, 'repo' => repository.slug)
69
+ if (branch != 'master') && (branch != 'HEAD')
70
+ on("#{verb.capitalize} from #{branch} branch? ", config,
71
+ 'branch' => branch)
70
72
  end
73
+
74
+ config['skip_cleanup'] = 'true' unless config.key?('skip_cleanup') || (config.fetch('edge',
75
+ 'false') != 'false')
76
+
77
+ encrypt(config, 'password') if config['password'] && agree('Encrypt Password? ') do |q|
78
+ q.default = 'yes'
79
+ end
80
+ encrypt(config, 'api_key') if config['api_key'] && agree('Encrypt API key? ') { |q| q.default = 'yes' }
71
81
  end
82
+ end
72
83
  end
73
84
  end
74
85
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'travis/cli'
2
4
 
3
5
  module Travis
@@ -32,14 +34,14 @@ module Travis
32
34
  autoload :Deis, 'travis/cli/setup/deis'
33
35
  autoload :Service, 'travis/cli/setup/service'
34
36
 
35
- description "sets up an addon or deploy target"
37
+ description 'sets up an addon or deploy target'
36
38
  on('-f', '--force', 'override config section if it already exists')
37
39
 
38
40
  def self.service(name)
39
41
  normal_name = Service.normalized_name(name)
40
42
  const_name = constants(false).detect { |c| Service.normalized_name(c) == normal_name }
41
43
  constant = const_get(const_name) if const_name
42
- constant if constant and constant < Service and constant.known_as? name
44
+ constant if constant && (constant < Service) && constant.known_as?(name)
43
45
  end
44
46
 
45
47
  def self.services
@@ -47,7 +49,9 @@ module Travis
47
49
  end
48
50
 
49
51
  def help
50
- services = self.class.services.map { |s| "\t" << color(s.service_name.ljust(20), :command) << color(s.description, :info) }.join("\n")
52
+ services = self.class.services.map do |s|
53
+ "\t" << color(s.service_name.ljust(20), :command) << color(s.description, :info)
54
+ end.join("\n")
51
55
  super("\nAvailable services:\n\n#{services}\n\n")
52
56
  end
53
57
 
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'travis/cli'
2
4
 
3
5
  module Travis
4
6
  module CLI
5
7
  class Show < RepoCommand
6
- description "displays a build or job"
8
+ description 'displays a build or job'
7
9
 
8
10
  def run(number = last_build.number)
9
- number = repository.branch(number).number if number !~ /^\d+(\.\d+)?$/ and repository.branch(number)
11
+ number = repository.branch(number).number if number !~ /^\d+(\.\d+)?$/ && repository.branch(number)
10
12
  entity = job(number) || build(number)
11
13
 
12
14
  error "could not find job or build #{repository.slug}##{number}" unless entity
@@ -17,7 +19,7 @@ module Travis
17
19
  entity.commit.subject,
18
20
  entity.state,
19
21
  entity.color,
20
- entity.pull_request? ? "pull request" : "push",
22
+ entity.pull_request? ? 'pull request' : 'push',
21
23
  entity.branch_info,
22
24
  entity.commit.short_sha,
23
25
  entity.commit.compare_url,
@@ -33,13 +35,13 @@ module Travis
33
35
  color("##{job.number} #{job.state}:".ljust(16), [job.color, :bold]),
34
36
  formatter.duration(job.duration).ljust(14),
35
37
  formatter.job_config(job.config),
36
- (color("(failure allowed)", :info) if job.allow_failures?)
37
- ].compact.join(" ").rstrip
38
+ (color('(failure allowed)', :info) if job.allow_failures?)
39
+ ].compact.join(' ').rstrip
38
40
  end
39
41
  else
40
42
  config = formatter.job_config(entity.config)
41
- say color("Allow Failure: ", :info) + entity.allow_failures?.inspect
42
- say color("Config: ", :info) + config unless config.empty?
43
+ say color('Allow Failure: ', :info) + entity.allow_failures?.inspect
44
+ say color('Config: ', :info) + config unless config.empty?
43
45
  end
44
46
  end
45
47
  end
@@ -56,4 +58,4 @@ __END__
56
58
  <[[ color("Compare URL: ", :info) ]]>%s
57
59
  <[[ color("Duration: ", :info) ]]>%s
58
60
  <[[ color("Started: ", :info) ]]>%s
59
- <[[ color("Finished: ", :info) ]]>%s
61
+ <[[ color("Finished: ", :info) ]]>%s