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,16 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::ApiCommand do
4
6
  describe 'enterprise' do
5
7
  travis_config_path = ENV['TRAVIS_CONFIG_PATH']
8
+ subject(:api_command) { described_class.new }
6
9
 
7
10
  before do
8
11
  ENV['TRAVIS_CONFIG_PATH'] = File.expand_path '../support', File.dirname(__FILE__)
9
- config = subject.send(:load_file, 'fake_travis_config.yml')
10
- subject.config = YAML.load(config)
12
+ config = api_command.send(:load_file, 'fake_travis_config.yml')
13
+ api_command.config = YAML.load(config)
11
14
 
12
- subject.api_endpoint = 'https://travis-ci-enterprise/api'
13
- subject.enterprise_name = 'default'
15
+ api_command.api_endpoint = 'https://travis-ci-enterprise/api'
16
+ api_command.enterprise_name = 'default'
14
17
  end
15
18
 
16
19
  after do
@@ -19,19 +22,19 @@ describe Travis::CLI::ApiCommand do
19
22
 
20
23
  describe '#setup_enterprise' do
21
24
  before do
22
- subject.send(:setup_enterprise)
25
+ api_command.send(:setup_enterprise)
23
26
  end
24
27
 
25
28
  it 'keeps verifying peers' do
26
- subject.insecure.should be_falsey
29
+ api_command.insecure.should be_falsey
27
30
  end
28
31
 
29
32
  it 'uses default CAs' do
30
- subject.session.ssl.should_not include(:ca_file)
33
+ api_command.session.ssl.should_not include(:ca_file)
31
34
  end
32
35
 
33
36
  it 'flags endpoint' do
34
- subject.endpoint_config.should include('enterprise' => true)
37
+ api_command.endpoint_config.should include('enterprise' => true)
35
38
  end
36
39
  end
37
40
  end
@@ -1,15 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Cancel do
4
6
  example 'travis cancel' do
5
7
  run_cli('cancel', '-t', 'token').should be_success
6
- $params['id'].should be == "4125095"
7
- $params['entity'].should be == "builds"
8
8
  end
9
9
 
10
10
  example 'travis cancel 6180.1' do
11
11
  run_cli('cancel', '6180.1', '-t', 'token').should be_success
12
- $params['id'].should be == "4125096"
13
- $params['entity'].should be == "jobs"
14
12
  end
15
13
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'fileutils'
3
5
  require 'digest'
@@ -5,22 +7,22 @@ require 'digest'
5
7
  describe Travis::CLI::EncryptFile do
6
8
  CMD_TARGET = 'README.md'
7
9
 
8
- before :each do
9
- Digest.stub(:hexencode).and_return "randomhex" # to avoid relying on Dir.pwd value for hex
10
+ before do
11
+ Digest.stub(:hexencode).and_return 'randomhex' # to avoid relying on Dir.pwd value for hex
10
12
  end
11
13
 
12
- after :each do
14
+ after do
13
15
  FileUtils.rm_f "#{CMD_TARGET}.enc"
14
16
  end
15
17
 
16
18
  example "travis encrypt-file #{CMD_TARGET}" do
17
19
  run_cli('encrypt-file', CMD_TARGET).should be_success
18
- File.exists?("#{CMD_TARGET}.enc").should be true
20
+ File.exist?("#{CMD_TARGET}.enc").should be true
19
21
  end
20
22
 
21
23
  example "travis encrypt-file #{CMD_TARGET} -a" do
22
- run_cli('encrypt-file', CMD_TARGET, '-a') { |i| i.puts "n" }.should be_success
23
- stdout.should match /Overwrite the config file/
24
- File.exists?("#{CMD_TARGET}.enc").should be true
24
+ run_cli('encrypt-file', CMD_TARGET, '-a') { |i| i.puts 'n' }.should be_success
25
+ stdout.should match(/Overwrite the config file/)
26
+ File.exist?("#{CMD_TARGET}.enc").should be true
25
27
  end
26
28
  end
@@ -1,67 +1,69 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Encrypt do
4
- example "travis encrypt foo" do
6
+ example 'travis encrypt foo' do
5
7
  run_cli('encrypt', 'foo').should be_success
6
8
  stdout.should match(/^".{60,}"\n$/)
7
9
  end
8
10
 
9
- example "travis encrypt foo -r rails/rails" do
11
+ example 'travis encrypt foo -r rails/rails' do
10
12
  run_cli('encrypt', 'foo', '-r', 'rails/rails').should be_success
11
13
  stdout.should match(/^".{60,}"\n$/)
12
14
  end
13
15
 
14
- example "travis encrypt foo -i" do
16
+ example 'travis encrypt foo -i' do
15
17
  run_cli('encrypt', 'foo', '-i', '--skip-completion-check', '-r', 'travis-ci/travis.rb').should be_success
16
18
  stdout.should start_with("Please add the following to your .travis.yml file:\n\n secure: ")
17
19
  end
18
20
 
19
- example "cat foo | travis encrypt" do
21
+ example 'cat foo | travis encrypt' do
20
22
  run_cli('encrypt') { |i| i.puts('foo') }
21
23
  stdout.should match(/\A".{60,}"\n\Z/)
22
24
  end
23
25
 
24
- example "cat foo\\nbar | travis encrypt -s" do
26
+ example 'cat foo\\nbar | travis encrypt -s' do
25
27
  run_cli('encrypt', '-s') { |i| i.puts("foo\nbar") }
26
28
  stdout.should match(/\A(".{60,}"\n){2}\Z/)
27
29
  end
28
30
 
29
- example "cat foo\\nbar | travis encrypt" do
31
+ example 'cat foo\\nbar | travis encrypt' do
30
32
  run_cli('encrypt') { |i| i.puts("foo\nbar") }
31
33
  stdout.should match(/\A".{60,}"\n\Z/)
32
34
  end
33
35
 
34
- example "travis encrypt rails/rails foo" do
36
+ example 'travis encrypt rails/rails foo' do
35
37
  run_cli('encrypt', 'rails/rails', 'foo').should be_success
36
38
  stderr.should match(/WARNING/)
37
39
  end
38
40
 
39
- example "travis encrypt foo=foo/bar" do
40
- run_cli("encrypt", "foo=foo/bar").should be_success
41
+ example 'travis encrypt foo=foo/bar' do
42
+ run_cli('encrypt', 'foo=foo/bar').should be_success
41
43
  stderr.should_not match(/WARNING/)
42
44
  end
43
45
 
44
- example "travis encrypt FOO bar -a" do
46
+ example 'travis encrypt FOO bar -a' do
45
47
  described_class.any_instance.stub(:save_travis_config)
46
- run_cli("encrypt", "FOO", "bar", "-a") { |i| i.puts "foo" }.should be_success
48
+ run_cli('encrypt', 'FOO', 'bar', '-a') { |i| i.puts 'foo' }.should be_success
47
49
  stderr.should match(/Environment variables in env\.global should be formatted as FOO=bar/)
48
50
  end
49
51
 
50
- example "travis encrypt FOO bar -a foo" do
52
+ example 'travis encrypt FOO bar -a foo' do
51
53
  described_class.any_instance.stub(:save_travis_config)
52
- run_cli("encrypt", "FOO", "bar", "-a", "foo") { |i| i.puts "foo" }.should be_success
54
+ run_cli('encrypt', 'FOO', 'bar', '-a', 'foo') { |i| i.puts 'foo' }.should be_success
53
55
  stdout.should match(/Overwrite the config file/)
54
56
  end
55
57
 
56
- example "travis encrypt FOO bar -a --no-interactive" do
58
+ example 'travis encrypt FOO bar -a --no-interactive' do
57
59
  described_class.any_instance.stub(:save_travis_config)
58
- run_cli("encrypt", "FOO", "bar", "-a", "--no-interactive").should be_success
60
+ run_cli('encrypt', 'FOO', 'bar', '-a', '--no-interactive').should be_success
59
61
  stderr.should match(/Environment variables in env\.global should be formatted as FOO=bar/)
60
62
  end
61
63
 
62
- example "travis encrypt FOO=bar -a foo --no-interactive" do
64
+ example 'travis encrypt FOO=bar -a foo --no-interactive' do
63
65
  described_class.any_instance.stub(:save_travis_config)
64
- run_cli("encrypt", "FOO=bar", "-a", "foo", "--no-interactive").should be_success
66
+ run_cli('encrypt', 'FOO=bar', '-a', 'foo', '--no-interactive').should be_success
65
67
  stdout.should be_empty
66
68
  end
67
69
  end
@@ -1,39 +1,41 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Endpoint do
4
- example "travis endpoint" do
6
+ example 'travis endpoint' do
5
7
  run_cli('endpoint').should be_success
6
- stdout.should be == "https://api.travis-ci.org/\n"
8
+ stdout.should be == "https://api.travis-ci.com/\n"
7
9
  end
8
10
 
9
- example "travis endpoint --pro" do
11
+ example 'travis endpoint --pro' do
10
12
  run_cli('endpoint', '--pro').should be_success
11
13
  stdout.should be == "https://api.travis-ci.com/\n"
12
14
  end
13
15
 
14
- example "travis endpoint --com" do
16
+ example 'travis endpoint --com' do
15
17
  run_cli('endpoint', '--com').should be_success
16
18
  stdout.should be == "https://api.travis-ci.com/\n"
17
19
  end
18
20
 
19
- example "travis endpoint -e http://localhost:3000/" do
21
+ example 'travis endpoint -e http://localhost:3000/' do
20
22
  run_cli('endpoint', '-e', 'http://localhost:3000/').should be_success
21
23
  stdout.should be == "http://localhost:3000/\n"
22
24
  end
23
25
 
24
- example "TRAVIS_ENDPOINT=http://localhost:3000/ travis endpoint" do
25
- ENV['TRAVIS_ENDPOINT'] = "http://localhost:3000/"
26
+ example 'TRAVIS_ENDPOINT=http://localhost:3000/ travis endpoint' do
27
+ ENV['TRAVIS_ENDPOINT'] = 'http://localhost:3000/'
26
28
  run_cli('endpoint').should be_success
27
29
  stdout.should be == "http://localhost:3000/\n"
28
30
  end
29
31
 
30
- example "travis endpoint --github" do
32
+ example 'travis endpoint --github' do
31
33
  run_cli('endpoint', '--github').should be_success
32
34
  stdout.should be == "https://api.github.com\n"
33
35
  end
34
36
 
35
- example "travis endpoint -i" do
37
+ example 'travis endpoint -i' do
36
38
  run_cli('endpoint', '-i').should be_success
37
- stdout.should be == "API endpoint: https://api.travis-ci.org/\n"
39
+ stdout.should be == "API endpoint: https://api.travis-ci.com/\n"
38
40
  end
39
41
  end
@@ -1,33 +1,35 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Help do
4
- example "travis help" do
6
+ example 'travis help' do
5
7
  run_cli('help').should be_success
6
- stdout.should include("Usage: travis COMMAND")
8
+ stdout.should include('Usage: travis COMMAND')
7
9
  end
8
10
 
9
- example "travis --help" do
11
+ example 'travis --help' do
10
12
  run_cli('--help').should be_success
11
- stdout.should include("Usage: travis COMMAND")
13
+ stdout.should include('Usage: travis COMMAND')
12
14
  end
13
15
 
14
- example "travis -h" do
16
+ example 'travis -h' do
15
17
  run_cli('-h').should be_success
16
- stdout.should include("Usage: travis COMMAND")
18
+ stdout.should include('Usage: travis COMMAND')
17
19
  end
18
20
 
19
- example "travis -?" do
21
+ example 'travis -?' do
20
22
  run_cli('-?').should be_success
21
- stdout.should include("Usage: travis COMMAND")
23
+ stdout.should include('Usage: travis COMMAND')
22
24
  end
23
25
 
24
- example "travis help endpoint" do
26
+ example 'travis help endpoint' do
25
27
  run_cli('help', 'endpoint').should be_success
26
- stdout.should include("Usage: travis endpoint [OPTIONS]")
28
+ stdout.should include('Usage: travis endpoint [OPTIONS]')
27
29
  end
28
30
 
29
- example "travis endpoint --help" do
31
+ example 'travis endpoint --help' do
30
32
  run_cli('endpoint', '--help').should be_success
31
- stdout.should include("Usage: travis endpoint [OPTIONS]")
33
+ stdout.should include('Usage: travis endpoint [OPTIONS]')
32
34
  end
33
35
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::History do
@@ -1,20 +1,22 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Init do
4
6
  old_path = Dir.pwd
5
7
  tmp_path = File.expand_path('travis-spec-init', Dir.tmpdir)
6
8
 
7
- before(:each) do
9
+ before do
8
10
  FileUtils.mkdir_p(tmp_path)
9
11
  Dir.chdir(tmp_path)
10
12
  FileUtils.rm('.travis.yml') if File.exist?('.travis.yml')
11
13
  end
12
14
 
13
- after(:each) do
15
+ after do
14
16
  Dir.chdir(old_path)
15
17
  end
16
18
 
17
- example "travis init fakelanguage" do
19
+ example 'travis init fakelanguage' do
18
20
  run_cli('init', 'fakelanguage', '--skip-enable', '-r', 'travis-ci/travis.rb').should_not be_success
19
21
  stderr.should be == "unknown language fakelanguage\n"
20
22
  end
@@ -29,28 +31,28 @@ describe Travis::CLI::Init do
29
31
  end
30
32
 
31
33
  example "travis init #{language} (.travis.yml already exists, using --force)" do
32
- File.open(".travis.yml", "w") { |f| f << "old file" }
34
+ File.open('.travis.yml', 'w') { |f| f << 'old file' }
33
35
  run_cli('init', language, '--force', '--skip-enable', '-r', 'travis-ci/travis.rb').should be_success
34
36
  stdout.should be == ".travis.yml file created!\n"
35
- File.read(".travis.yml").should_not be == "old file"
37
+ File.read('.travis.yml').should_not be == 'old file'
36
38
  end
37
39
 
38
40
  example "travis init #{language} (.travis.yml already exists, not using --force)" do
39
- File.open(".travis.yml", "w") { |f| f << "old file" }
41
+ File.open('.travis.yml', 'w') { |f| f << 'old file' }
40
42
  run_cli('init', language, '--skip-enable', '-r', 'travis-ci/travis.rb').should_not be_success
41
43
  stderr.should be == ".travis.yml already exists, use --force to override\n"
42
- File.read('.travis.yml').should be == "old file"
44
+ File.read('.travis.yml').should be == 'old file'
43
45
  end
44
46
  end
45
47
 
46
48
  describe 'travis init c' do
47
- it_should_behave_like 'travis init', 'c'
48
-
49
49
  let :result do
50
50
  run_cli('init', 'c', '--skip-enable', '-r', 'travis-ci/travis.rb')
51
51
  YAML.load_file('.travis.yml')
52
52
  end
53
53
 
54
+ it_behaves_like 'travis init', 'c'
55
+
54
56
  it 'sets compiler' do
55
57
  result.should include('compiler')
56
58
  result['compiler'].should include('clang')
@@ -59,17 +61,17 @@ describe Travis::CLI::Init do
59
61
  end
60
62
 
61
63
  describe 'travis init clojure' do
62
- it_should_behave_like 'travis init', 'clojure'
64
+ it_behaves_like 'travis init', 'clojure'
63
65
  end
64
66
 
65
67
  describe 'travis init cpp' do
66
- it_should_behave_like 'travis init', 'cpp'
67
-
68
68
  let :result do
69
69
  run_cli('init', 'cpp', '--skip-enable', '-r', 'travis-ci/travis.rb')
70
70
  YAML.load_file('.travis.yml')
71
71
  end
72
72
 
73
+ it_behaves_like 'travis init', 'cpp'
74
+
73
75
  it 'sets compiler' do
74
76
  result.should include('compiler')
75
77
  result['compiler'].should include('clang')
@@ -78,13 +80,13 @@ describe Travis::CLI::Init do
78
80
  end
79
81
 
80
82
  describe 'travis init erlang' do
81
- it_should_behave_like 'travis init', 'erlang'
82
-
83
83
  let :result do
84
84
  run_cli('init', 'erlang', '--skip-enable', '-r', 'travis-ci/travis.rb')
85
85
  YAML.load_file('.travis.yml')
86
86
  end
87
87
 
88
+ it_behaves_like 'travis init', 'erlang'
89
+
88
90
  it 'sets compiler' do
89
91
  result.should include('otp_release')
90
92
  result['otp_release'].should include('R16B')
@@ -92,13 +94,13 @@ describe Travis::CLI::Init do
92
94
  end
93
95
 
94
96
  describe 'travis init go' do
95
- it_should_behave_like 'travis init', 'go'
96
-
97
97
  let :result do
98
98
  run_cli('init', 'go', '--skip-enable', '-r', 'travis-ci/travis.rb')
99
99
  YAML.load_file('.travis.yml')
100
100
  end
101
101
 
102
+ it_behaves_like 'travis init', 'go'
103
+
102
104
  it 'sets compiler' do
103
105
  result.should include('go')
104
106
  result['go'].should include('1.0')
@@ -107,21 +109,21 @@ describe Travis::CLI::Init do
107
109
  end
108
110
 
109
111
  describe 'travis init groovy' do
110
- it_should_behave_like 'travis init', 'groovy'
112
+ it_behaves_like 'travis init', 'groovy'
111
113
  end
112
114
 
113
115
  describe 'travis init haskell' do
114
- it_should_behave_like 'travis init', 'haskell'
116
+ it_behaves_like 'travis init', 'haskell'
115
117
  end
116
118
 
117
119
  describe 'travis init java' do
118
- it_should_behave_like 'travis init', 'java'
119
-
120
120
  let :result do
121
121
  run_cli('init', 'java', '--skip-enable', '-r', 'travis-ci/travis.rb')
122
122
  YAML.load_file('.travis.yml')
123
123
  end
124
124
 
125
+ it_behaves_like 'travis init', 'java'
126
+
125
127
  it 'sets compiler' do
126
128
  result.should include('jdk')
127
129
  result['jdk'].should include('oraclejdk7')
@@ -130,13 +132,13 @@ describe Travis::CLI::Init do
130
132
  end
131
133
 
132
134
  describe 'travis init node_js' do
133
- it_should_behave_like 'travis init', 'node_js'
134
-
135
135
  let :result do
136
136
  run_cli('init', 'node_js', '--skip-enable', '-r', 'travis-ci/travis.rb')
137
137
  YAML.load_file('.travis.yml')
138
138
  end
139
139
 
140
+ it_behaves_like 'travis init', 'node_js'
141
+
140
142
  it 'sets compiler' do
141
143
  result.should include('node_js')
142
144
  result['node_js'].should include('stable')
@@ -146,17 +148,17 @@ describe Travis::CLI::Init do
146
148
  end
147
149
 
148
150
  describe 'travis init objective-c' do
149
- it_should_behave_like 'travis init', 'objective-c'
151
+ it_behaves_like 'travis init', 'objective-c'
150
152
  end
151
153
 
152
154
  describe 'travis init perl' do
153
- it_should_behave_like 'travis init', 'perl'
154
-
155
155
  let :result do
156
156
  run_cli('init', 'perl', '--skip-enable', '-r', 'travis-ci/travis.rb')
157
157
  YAML.load_file('.travis.yml')
158
158
  end
159
159
 
160
+ it_behaves_like 'travis init', 'perl'
161
+
160
162
  it 'sets compiler' do
161
163
  result.should include('perl')
162
164
  result['perl'].should include('5.16')
@@ -165,13 +167,13 @@ describe Travis::CLI::Init do
165
167
  end
166
168
 
167
169
  describe 'travis init php' do
168
- it_should_behave_like 'travis init', 'php'
169
-
170
170
  let :result do
171
171
  run_cli('init', 'php', '--skip-enable', '-r', 'travis-ci/travis.rb')
172
172
  YAML.load_file('.travis.yml')
173
173
  end
174
174
 
175
+ it_behaves_like 'travis init', 'php'
176
+
175
177
  it 'sets compiler' do
176
178
  result.should include('php')
177
179
  result['php'].should include('5.5')
@@ -180,13 +182,13 @@ describe Travis::CLI::Init do
180
182
  end
181
183
 
182
184
  describe 'travis init python' do
183
- it_should_behave_like 'travis init', 'python'
184
-
185
185
  let :result do
186
186
  run_cli('init', 'python', '--skip-enable', '-r', 'travis-ci/travis.rb')
187
187
  YAML.load_file('.travis.yml')
188
188
  end
189
189
 
190
+ it_behaves_like 'travis init', 'python'
191
+
190
192
  it 'sets compiler' do
191
193
  result.should include('python')
192
194
  result['python'].should include('2.7')
@@ -195,13 +197,13 @@ describe Travis::CLI::Init do
195
197
  end
196
198
 
197
199
  describe 'travis init ruby' do
198
- it_should_behave_like 'travis init', 'ruby'
199
-
200
200
  let :result do
201
201
  run_cli('init', 'ruby', '--skip-enable', '-r', 'travis-ci/travis.rb')
202
202
  YAML.load_file('.travis.yml')
203
203
  end
204
204
 
205
+ it_behaves_like 'travis init', 'ruby'
206
+
205
207
  it 'sets compiler' do
206
208
  result.should include('rvm')
207
209
  result['rvm'].should include('1.9.3')
@@ -211,13 +213,13 @@ describe Travis::CLI::Init do
211
213
  end
212
214
 
213
215
  describe 'travis init scala' do
214
- it_should_behave_like 'travis init', 'scala'
215
-
216
216
  let :result do
217
217
  run_cli('init', 'scala', '--skip-enable', '-r', 'travis-ci/travis.rb')
218
218
  YAML.load_file('.travis.yml')
219
219
  end
220
220
 
221
+ it_behaves_like 'travis init', 'scala'
222
+
221
223
  it 'sets compiler' do
222
224
  result.should include('scala')
223
225
  result['scala'].should include('2.10.1')
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Logs do
@@ -1,24 +1,26 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Open do
4
6
  example 'travis open -p' do
5
7
  run_cli('open', '-p').should be_success
6
- stdout.should match(/https:\/\/travis-ci.org\/[\w\W]*\/travis\.rb/)
8
+ stdout.should match(%r{https://travis-ci.org/[\w\W]*/travis\.rb})
7
9
  end
8
10
 
9
11
  example 'travis open 6180 -p' do
10
12
  run_cli('open', '6180', '-p').should be_success
11
- stdout.should match(/https:\/\/travis-ci.org\/[\w\W]*\/travis\.rb\/builds\/4125095/)
13
+ stdout.should match(%r{https://travis-ci.org/[\w\W]*/travis\.rb/builds/4125095})
12
14
  end
13
15
 
14
16
  example 'travis open 6180.1 -p' do
15
17
  run_cli('open', '6180.1', '-p').should be_success
16
- stdout.should match(/https:\/\/travis-ci.org\/[\w\W]*\/travis\.rb\/jobs\/4125096/)
18
+ stdout.should match(%r{https://travis-ci.org/[\w\W]*/travis\.rb/jobs/4125096})
17
19
  end
18
20
 
19
21
  example 'travis open -pg' do
20
22
  run_cli('open', '-pg').should be_success
21
- stdout.should match(/https:\/\/github.com\/[\w\W]*\/travis\.rb/)
23
+ stdout.should match(%r{https://github.com/[\w\W]*/travis\.rb})
22
24
  end
23
25
 
24
26
  example 'travis open 6180 -pg' do
@@ -1,25 +1,29 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
  require 'uri'
3
5
 
4
6
  describe Travis::CLI::RepoCommand do
5
7
  describe '#parse_remote' do
8
+ subject(:repo_command) { described_class.new }
9
+
6
10
  it 'handles git@github.com URIs' do
7
- path = subject.send(:parse_remote, 'git@github.com:travis-ci/travis.rb.git')
11
+ path = repo_command.send(:parse_remote, 'git@github.com:travis-ci/travis.rb.git')
8
12
  path.should be == '/travis-ci/travis.rb.git'
9
13
  end
10
14
 
11
15
  it 'handles GitHub Enterprise URIS' do
12
- path = subject.send(:parse_remote, 'git@example.com:travis-ci/travis.rb.git')
16
+ path = repo_command.send(:parse_remote, 'git@example.com:travis-ci/travis.rb.git')
13
17
  path.should be == '/travis-ci/travis.rb.git'
14
18
  end
15
19
 
16
20
  it 'handles HTTPS URIs' do
17
- path = subject.send(:parse_remote, 'https://github.com/travis-ci/travis.rb.git')
21
+ path = repo_command.send(:parse_remote, 'https://github.com/travis-ci/travis.rb.git')
18
22
  path.should be == '/travis-ci/travis.rb.git'
19
23
  end
20
24
 
21
25
  it 'raises URI::InvalidURIError for invalid URIs' do
22
- expect { subject.send(:parse_remote, "foo@example.com:baz/bar.git") }.to raise_error(URI::InvalidURIError)
26
+ expect { repo_command.send(:parse_remote, 'foo@example.com:baz/bar.git') }.to raise_error(URI::InvalidURIError)
23
27
  end
24
28
  end
25
29
  end
@@ -1,15 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Travis::CLI::Restart do
4
6
  example 'travis restart' do
5
7
  run_cli('restart', '-t', 'token').should be_success
6
- $params['id'].should be == "4125095"
7
- $params['entity'].should be == "builds"
8
8
  end
9
9
 
10
10
  example 'travis restart 6180.1' do
11
11
  run_cli('restart', '6180.1', '-t', 'token').should be_success
12
- $params['entity'].should be == "jobs"
13
- $params['id'].should be == "4125096"
14
12
  end
15
13
  end