travis-akerl 1.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +22 -0
- data/README.md +2512 -0
- data/Rakefile +64 -0
- data/assets/cacert.pem +69 -0
- data/assets/init/c.yml +4 -0
- data/assets/init/clojure.yml +1 -0
- data/assets/init/cpp.yml +4 -0
- data/assets/init/erlang.yml +3 -0
- data/assets/init/go.yml +4 -0
- data/assets/init/groovy.yml +1 -0
- data/assets/init/haskell.yml +1 -0
- data/assets/init/java.yml +4 -0
- data/assets/init/node_js.yml +5 -0
- data/assets/init/objective-c.yml +1 -0
- data/assets/init/perl.yml +4 -0
- data/assets/init/php.yml +4 -0
- data/assets/init/python.yml +5 -0
- data/assets/init/ruby.yml +6 -0
- data/assets/init/scala.yml +4 -0
- data/assets/notifications/Travis CI.app/Contents/Info.plist +52 -0
- data/assets/notifications/Travis CI.app/Contents/MacOS/Travis CI +0 -0
- data/assets/notifications/Travis CI.app/Contents/PkgInfo +1 -0
- data/assets/notifications/Travis CI.app/Contents/Resources/Travis CI.icns +0 -0
- data/assets/notifications/Travis CI.app/Contents/Resources/en.lproj/Credits.rtf +29 -0
- data/assets/notifications/Travis CI.app/Contents/Resources/en.lproj/InfoPlist.strings +0 -0
- data/assets/notifications/Travis CI.app/Contents/Resources/en.lproj/MainMenu.nib +0 -0
- data/assets/notifications/Travis CI.app/Contents/_CodeSignature/CodeResources +173 -0
- data/assets/notifications/Travis CI.app/Contents/embedded.provisionprofile +0 -0
- data/assets/notifications/icon.png +0 -0
- data/assets/travis.sh +163 -0
- data/assets/travis.sh.erb +64 -0
- data/bin/travis +18 -0
- data/examples/org_overview.rb +3 -0
- data/examples/pro_auth.rb +23 -0
- data/examples/stream.rb +6 -0
- data/lib/travis/auto_login.rb +3 -0
- data/lib/travis/cli/accounts.rb +31 -0
- data/lib/travis/cli/api_command.rb +182 -0
- data/lib/travis/cli/branches.rb +25 -0
- data/lib/travis/cli/cache.rb +76 -0
- data/lib/travis/cli/cancel.rb +18 -0
- data/lib/travis/cli/command.rb +422 -0
- data/lib/travis/cli/console.rb +33 -0
- data/lib/travis/cli/disable.rb +15 -0
- data/lib/travis/cli/enable.rb +31 -0
- data/lib/travis/cli/encrypt.rb +115 -0
- data/lib/travis/cli/encrypt_file.rb +140 -0
- data/lib/travis/cli/endpoint.rb +35 -0
- data/lib/travis/cli/env.rb +66 -0
- data/lib/travis/cli/help.rb +23 -0
- data/lib/travis/cli/history.rb +49 -0
- data/lib/travis/cli/init.rb +82 -0
- data/lib/travis/cli/lint.rb +49 -0
- data/lib/travis/cli/login.rb +76 -0
- data/lib/travis/cli/logout.rb +14 -0
- data/lib/travis/cli/logs.rb +65 -0
- data/lib/travis/cli/monitor.rb +111 -0
- data/lib/travis/cli/open.rb +39 -0
- data/lib/travis/cli/parser.rb +43 -0
- data/lib/travis/cli/pubkey.rb +30 -0
- data/lib/travis/cli/raw.rb +20 -0
- data/lib/travis/cli/repo_command.rb +154 -0
- data/lib/travis/cli/report.rb +101 -0
- data/lib/travis/cli/repos.rb +53 -0
- data/lib/travis/cli/requests.rb +47 -0
- data/lib/travis/cli/restart.rb +18 -0
- data/lib/travis/cli/settings.rb +79 -0
- data/lib/travis/cli/setup/anynines.rb +21 -0
- data/lib/travis/cli/setup/appfog.rb +19 -0
- data/lib/travis/cli/setup/artifacts.rb +23 -0
- data/lib/travis/cli/setup/biicode.rb +19 -0
- data/lib/travis/cli/setup/cloud_66.rb +20 -0
- data/lib/travis/cli/setup/cloud_control.rb +21 -0
- data/lib/travis/cli/setup/cloud_files.rb +20 -0
- data/lib/travis/cli/setup/cloud_foundry.rb +23 -0
- data/lib/travis/cli/setup/code_deploy.rb +55 -0
- data/lib/travis/cli/setup/deis.rb +20 -0
- data/lib/travis/cli/setup/divshot.rb +18 -0
- data/lib/travis/cli/setup/elastic_beanstalk.rb +23 -0
- data/lib/travis/cli/setup/engine_yard.rb +24 -0
- data/lib/travis/cli/setup/gcs.rb +22 -0
- data/lib/travis/cli/setup/hackage.rb +18 -0
- data/lib/travis/cli/setup/heroku.rb +20 -0
- data/lib/travis/cli/setup/modulus.rb +18 -0
- data/lib/travis/cli/setup/ninefold.rb +20 -0
- data/lib/travis/cli/setup/nodejitsu.rb +27 -0
- data/lib/travis/cli/setup/npm.rb +20 -0
- data/lib/travis/cli/setup/open_shift.rb +20 -0
- data/lib/travis/cli/setup/opsworks.rb +22 -0
- data/lib/travis/cli/setup/pypi.rb +22 -0
- data/lib/travis/cli/setup/releases.rb +35 -0
- data/lib/travis/cli/setup/ruby_gems.rb +25 -0
- data/lib/travis/cli/setup/s3.rb +25 -0
- data/lib/travis/cli/setup/sauce_connect.rb +21 -0
- data/lib/travis/cli/setup/service.rb +73 -0
- data/lib/travis/cli/setup.rb +66 -0
- data/lib/travis/cli/show.rb +57 -0
- data/lib/travis/cli/sshkey.rb +118 -0
- data/lib/travis/cli/status.rb +19 -0
- data/lib/travis/cli/sync.rb +30 -0
- data/lib/travis/cli/token.rb +14 -0
- data/lib/travis/cli/version.rb +17 -0
- data/lib/travis/cli/whatsup.rb +30 -0
- data/lib/travis/cli/whoami.rb +15 -0
- data/lib/travis/cli.rb +126 -0
- data/lib/travis/client/account.rb +56 -0
- data/lib/travis/client/artifact.rb +88 -0
- data/lib/travis/client/auto_login.rb +45 -0
- data/lib/travis/client/broadcast.rb +14 -0
- data/lib/travis/client/build.rb +47 -0
- data/lib/travis/client/cache.rb +25 -0
- data/lib/travis/client/commit.rb +28 -0
- data/lib/travis/client/entity.rb +238 -0
- data/lib/travis/client/env_var.rb +102 -0
- data/lib/travis/client/error.rb +38 -0
- data/lib/travis/client/has_uuid.rb +13 -0
- data/lib/travis/client/job.rb +61 -0
- data/lib/travis/client/lint_result.rb +25 -0
- data/lib/travis/client/listener.rb +183 -0
- data/lib/travis/client/methods.rb +104 -0
- data/lib/travis/client/namespace.rb +85 -0
- data/lib/travis/client/not_loadable.rb +13 -0
- data/lib/travis/client/repository.rb +224 -0
- data/lib/travis/client/request.rb +36 -0
- data/lib/travis/client/restartable.rb +23 -0
- data/lib/travis/client/session.rb +339 -0
- data/lib/travis/client/settings.rb +25 -0
- data/lib/travis/client/singleton_setting.rb +36 -0
- data/lib/travis/client/ssh_key.rb +11 -0
- data/lib/travis/client/states.rb +98 -0
- data/lib/travis/client/user.rb +67 -0
- data/lib/travis/client/weak_entity.rb +26 -0
- data/lib/travis/client.rb +38 -0
- data/lib/travis/pro/auto_login.rb +3 -0
- data/lib/travis/pro.rb +5 -0
- data/lib/travis/tools/assets.rb +21 -0
- data/lib/travis/tools/completion.rb +54 -0
- data/lib/travis/tools/formatter.rb +50 -0
- data/lib/travis/tools/github.rb +293 -0
- data/lib/travis/tools/notification.rb +69 -0
- data/lib/travis/tools/safe_string.rb +22 -0
- data/lib/travis/tools/ssl_key.rb +48 -0
- data/lib/travis/tools/system.rb +88 -0
- data/lib/travis/version.rb +3 -0
- data/lib/travis.rb +8 -0
- data/spec/cli/api_command_spec.rb +38 -0
- data/spec/cli/cancel_spec.rb +15 -0
- data/spec/cli/encrypt_spec.rb +49 -0
- data/spec/cli/endpoint_spec.rb +39 -0
- data/spec/cli/help_spec.rb +33 -0
- data/spec/cli/history_spec.rb +38 -0
- data/spec/cli/init_spec.rb +227 -0
- data/spec/cli/login_spec.rb +13 -0
- data/spec/cli/logs_spec.rb +8 -0
- data/spec/cli/open_spec.rb +33 -0
- data/spec/cli/repo_command_spec.rb +25 -0
- data/spec/cli/restart_spec.rb +15 -0
- data/spec/cli/setup_spec.rb +5 -0
- data/spec/cli/show_spec.rb +9 -0
- data/spec/cli/status_spec.rb +28 -0
- data/spec/cli/token_spec.rb +22 -0
- data/spec/cli/version_spec.rb +18 -0
- data/spec/cli/whoami_spec.rb +34 -0
- data/spec/client/account_spec.rb +32 -0
- data/spec/client/auto_login_spec.rb +25 -0
- data/spec/client/broadcast_spec.rb +10 -0
- data/spec/client/build_spec.rb +31 -0
- data/spec/client/commit_spec.rb +22 -0
- data/spec/client/job_spec.rb +30 -0
- data/spec/client/methods_spec.rb +15 -0
- data/spec/client/namespace_spec.rb +19 -0
- data/spec/client/repository_spec.rb +39 -0
- data/spec/client/session_spec.rb +165 -0
- data/spec/client/user_spec.rb +16 -0
- data/spec/client_spec.rb +17 -0
- data/spec/pro_spec.rb +10 -0
- data/spec/spec_helper.rb +29 -0
- data/spec/support/fake_api.rb +731 -0
- data/spec/support/fake_github.rb +24 -0
- data/spec/support/fake_travis_config.yml +14 -0
- data/spec/support/helpers.rb +45 -0
- data/spec/travis_spec.rb +10 -0
- data/travis.gemspec +371 -0
- metadata +534 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::ApiCommand do
|
|
4
|
+
describe 'enterprise' do
|
|
5
|
+
travis_config_path = ENV['TRAVIS_CONFIG_PATH']
|
|
6
|
+
|
|
7
|
+
before do
|
|
8
|
+
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)
|
|
11
|
+
|
|
12
|
+
subject.api_endpoint = 'https://travis-ci-enterprise/api'
|
|
13
|
+
subject.enterprise_name = 'default'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
after do
|
|
17
|
+
ENV['TRAVIS_CONFIG_PATH'] = travis_config_path
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe '#setup_enterprise' do
|
|
21
|
+
before do
|
|
22
|
+
subject.send(:setup_enterprise)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'keeps verifying peers' do
|
|
26
|
+
subject.insecure.should be_falsey
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'uses default CAs' do
|
|
30
|
+
subject.session.ssl.should_not include(:ca_file)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'flags endpoint' do
|
|
34
|
+
subject.endpoint_config.should include('enterprise' => true)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Cancel do
|
|
4
|
+
example 'travis cancel' do
|
|
5
|
+
run_cli('cancel', '-t', 'token').should be_success
|
|
6
|
+
$params['id'].should be == "4125095"
|
|
7
|
+
$params['entity'].should be == "builds"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
example 'travis cancel 6180.1' do
|
|
11
|
+
run_cli('cancel', '6180.1', '-t', 'token').should be_success
|
|
12
|
+
$params['id'].should be == "4125096"
|
|
13
|
+
$params['entity'].should be == "jobs"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Encrypt do
|
|
4
|
+
example "travis encrypt foo" do
|
|
5
|
+
run_cli('encrypt', 'foo').should be_success
|
|
6
|
+
stdout.should match(/^".{60,}"\n$/)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
example "travis encrypt foo -r rails/rails" do
|
|
10
|
+
run_cli('encrypt', 'foo', '-r', 'rails/rails').should be_success
|
|
11
|
+
stdout.should match(/^".{60,}"\n$/)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
example "travis encrypt foo -i" do
|
|
15
|
+
run_cli('encrypt', 'foo', '-i', '--skip-completion-check', '-r', 'travis-ci/travis.rb').should be_success
|
|
16
|
+
stdout.should start_with("Please add the following to your .travis.yml file:\n\n secure: ")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
example "cat foo | travis encrypt" do
|
|
20
|
+
run_cli('encrypt') { |i| i.puts('foo') }
|
|
21
|
+
stdout.should match(/\A".{60,}"\n\Z/)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
example "cat foo\\nbar | travis encrypt -s" do
|
|
25
|
+
run_cli('encrypt', '-s') { |i| i.puts("foo\nbar") }
|
|
26
|
+
stdout.should match(/\A(".{60,}"\n){2}\Z/)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
example "cat foo\\nbar | travis encrypt" do
|
|
30
|
+
run_cli('encrypt') { |i| i.puts("foo\nbar") }
|
|
31
|
+
stdout.should match(/\A".{60,}"\n\Z/)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
example "travis encrypt rails/rails foo" do
|
|
35
|
+
run_cli('encrypt', 'rails/rails', 'foo').should be_success
|
|
36
|
+
stderr.should match(/WARNING/)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
example "travis encrypt foo=foo/bar" do
|
|
40
|
+
run_cli("encrypt", "foo=foo/bar").should be_success
|
|
41
|
+
stderr.should_not match(/WARNING/)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
example "travis encrypt FOO bar -a" do
|
|
45
|
+
described_class.any_instance.stub(:save_travis_config)
|
|
46
|
+
run_cli("encrypt", "FOO", "bar", "-a").should be_success
|
|
47
|
+
stderr.should match(/Environment variables in env\.global should be formatted as FOO=bar/)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Endpoint do
|
|
4
|
+
example "travis endpoint" do
|
|
5
|
+
run_cli('endpoint').should be_success
|
|
6
|
+
stdout.should be == "https://api.travis-ci.org/\n"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
example "travis endpoint --pro" do
|
|
10
|
+
run_cli('endpoint', '--pro').should be_success
|
|
11
|
+
stdout.should be == "https://api.travis-ci.com/\n"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
example "travis endpoint --com" do
|
|
15
|
+
run_cli('endpoint', '--com').should be_success
|
|
16
|
+
stdout.should be == "https://api.travis-ci.com/\n"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
example "travis endpoint -e http://localhost:3000/" do
|
|
20
|
+
run_cli('endpoint', '-e', 'http://localhost:3000/').should be_success
|
|
21
|
+
stdout.should be == "http://localhost:3000/\n"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
example "TRAVIS_ENDPOINT=http://localhost:3000/ travis endpoint" do
|
|
25
|
+
ENV['TRAVIS_ENDPOINT'] = "http://localhost:3000/"
|
|
26
|
+
run_cli('endpoint').should be_success
|
|
27
|
+
stdout.should be == "http://localhost:3000/\n"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
example "travis endpoint --github" do
|
|
31
|
+
run_cli('endpoint', '--github').should be_success
|
|
32
|
+
stdout.should be == "https://api.github.com\n"
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
example "travis endpoint -i" do
|
|
36
|
+
run_cli('endpoint', '-i').should be_success
|
|
37
|
+
stdout.should be == "API endpoint: https://api.travis-ci.org/\n"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Help do
|
|
4
|
+
example "travis help" do
|
|
5
|
+
run_cli('help').should be_success
|
|
6
|
+
stdout.should include("Usage: travis COMMAND")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
example "travis --help" do
|
|
10
|
+
run_cli('--help').should be_success
|
|
11
|
+
stdout.should include("Usage: travis COMMAND")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
example "travis -h" do
|
|
15
|
+
run_cli('-h').should be_success
|
|
16
|
+
stdout.should include("Usage: travis COMMAND")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
example "travis -?" do
|
|
20
|
+
run_cli('-?').should be_success
|
|
21
|
+
stdout.should include("Usage: travis COMMAND")
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
example "travis help endpoint" do
|
|
25
|
+
run_cli('help', 'endpoint').should be_success
|
|
26
|
+
stdout.should include("Usage: travis endpoint [OPTIONS]")
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
example "travis endpoint --help" do
|
|
30
|
+
run_cli('endpoint', '--help').should be_success
|
|
31
|
+
stdout.should include("Usage: travis endpoint [OPTIONS]")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::History do
|
|
4
|
+
example 'travis history' do
|
|
5
|
+
run_cli('history').should be_success
|
|
6
|
+
stdout.should be == "#6180 failed: master Associaton -> Association\n"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
example 'travis history -d' do
|
|
10
|
+
run_cli('history', '-d').should be_success
|
|
11
|
+
stdout.should be =~ /2013-01-13 \d+:55:17 #6180 failed: master Associaton -> Association/
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
example 'travis history -a 6180' do
|
|
15
|
+
run_cli('history', '-a', '6180').should be_success
|
|
16
|
+
stdout.should be == ''
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
example 'travis history -b master' do
|
|
20
|
+
run_cli('history', '-b', 'master').should be_success
|
|
21
|
+
stdout.should be == "#6180 failed: master Associaton -> Association\n"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
example 'travis history -b not-master' do
|
|
25
|
+
run_cli('history', '-b', 'not-master').should be_success
|
|
26
|
+
stdout.should be_empty
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
example 'travis history -p 5' do
|
|
30
|
+
run_cli('history', '-p', '5').should be_success
|
|
31
|
+
stdout.should be_empty
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
example 'travis history -c' do
|
|
35
|
+
run_cli('history', '-c').should be_success
|
|
36
|
+
stdout.should be == "#6180 failed: master Steve Klabnik Associaton -> Association\n"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Init do
|
|
4
|
+
old_path = Dir.pwd
|
|
5
|
+
tmp_path = File.expand_path('travis-spec-init', Dir.tmpdir)
|
|
6
|
+
|
|
7
|
+
before(:each) do
|
|
8
|
+
FileUtils.mkdir_p(tmp_path)
|
|
9
|
+
Dir.chdir(tmp_path)
|
|
10
|
+
FileUtils.rm('.travis.yml') if File.exist?('.travis.yml')
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
after(:each) do
|
|
14
|
+
Dir.chdir(old_path)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
example "travis init fakelanguage" do
|
|
18
|
+
run_cli('init', 'fakelanguage', '--skip-enable', '-r', 'travis-ci/travis.rb').should_not be_success
|
|
19
|
+
stderr.should be == "unknown language fakelanguage\n"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
shared_examples_for 'travis init' do |language|
|
|
23
|
+
example "travis init #{language} (empty directory)" do
|
|
24
|
+
File.exist?('.travis.yml').should be_false
|
|
25
|
+
run_cli('init', language, '--skip-enable', '-r', 'travis-ci/travis.rb').should be_success
|
|
26
|
+
stdout.should be == ".travis.yml file created!\n"
|
|
27
|
+
File.exist?('.travis.yml').should be_true
|
|
28
|
+
File.read('.travis.yml').should include("language: #{language}")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
example "travis init #{language} (.travis.yml already exists, using --force)" do
|
|
32
|
+
File.open(".travis.yml", "w") { |f| f << "old file" }
|
|
33
|
+
run_cli('init', language, '--force', '--skip-enable', '-r', 'travis-ci/travis.rb').should be_success
|
|
34
|
+
stdout.should be == ".travis.yml file created!\n"
|
|
35
|
+
File.read(".travis.yml").should_not be == "old file"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
example "travis init #{language} (.travis.yml already exists, not using --force)" do
|
|
39
|
+
File.open(".travis.yml", "w") { |f| f << "old file" }
|
|
40
|
+
run_cli('init', language, '--skip-enable', '-r', 'travis-ci/travis.rb').should_not be_success
|
|
41
|
+
stderr.should be == ".travis.yml already exists, use --force to override\n"
|
|
42
|
+
File.read('.travis.yml').should be == "old file"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
describe 'travis init c' do
|
|
47
|
+
it_should_behave_like 'travis init', 'c'
|
|
48
|
+
|
|
49
|
+
let :result do
|
|
50
|
+
run_cli('init', 'c', '--skip-enable', '-r', 'travis-ci/travis.rb')
|
|
51
|
+
YAML.load_file('.travis.yml')
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'sets compiler' do
|
|
55
|
+
result.should include('compiler')
|
|
56
|
+
result['compiler'].should include('clang')
|
|
57
|
+
result['compiler'].should include('gcc')
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe 'travis init clojure' do
|
|
62
|
+
it_should_behave_like 'travis init', 'clojure'
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
describe 'travis init cpp' do
|
|
66
|
+
it_should_behave_like 'travis init', 'cpp'
|
|
67
|
+
|
|
68
|
+
let :result do
|
|
69
|
+
run_cli('init', 'cpp', '--skip-enable', '-r', 'travis-ci/travis.rb')
|
|
70
|
+
YAML.load_file('.travis.yml')
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it 'sets compiler' do
|
|
74
|
+
result.should include('compiler')
|
|
75
|
+
result['compiler'].should include('clang')
|
|
76
|
+
result['compiler'].should include('gcc')
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
describe 'travis init erlang' do
|
|
81
|
+
it_should_behave_like 'travis init', 'erlang'
|
|
82
|
+
|
|
83
|
+
let :result do
|
|
84
|
+
run_cli('init', 'erlang', '--skip-enable', '-r', 'travis-ci/travis.rb')
|
|
85
|
+
YAML.load_file('.travis.yml')
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it 'sets compiler' do
|
|
89
|
+
result.should include('otp_release')
|
|
90
|
+
result['otp_release'].should include('R16B')
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
describe 'travis init go' do
|
|
95
|
+
it_should_behave_like 'travis init', 'go'
|
|
96
|
+
|
|
97
|
+
let :result do
|
|
98
|
+
run_cli('init', 'go', '--skip-enable', '-r', 'travis-ci/travis.rb')
|
|
99
|
+
YAML.load_file('.travis.yml')
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
it 'sets compiler' do
|
|
103
|
+
result.should include('go')
|
|
104
|
+
result['go'].should include('1.0')
|
|
105
|
+
result['go'].should include('1.3')
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
describe 'travis init groovy' do
|
|
110
|
+
it_should_behave_like 'travis init', 'groovy'
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
describe 'travis init haskell' do
|
|
114
|
+
it_should_behave_like 'travis init', 'haskell'
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
describe 'travis init java' do
|
|
118
|
+
it_should_behave_like 'travis init', 'java'
|
|
119
|
+
|
|
120
|
+
let :result do
|
|
121
|
+
run_cli('init', 'java', '--skip-enable', '-r', 'travis-ci/travis.rb')
|
|
122
|
+
YAML.load_file('.travis.yml')
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it 'sets compiler' do
|
|
126
|
+
result.should include('jdk')
|
|
127
|
+
result['jdk'].should include('oraclejdk7')
|
|
128
|
+
result['jdk'].should include('openjdk6')
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
describe 'travis init node_js' do
|
|
133
|
+
it_should_behave_like 'travis init', 'node_js'
|
|
134
|
+
|
|
135
|
+
let :result do
|
|
136
|
+
run_cli('init', 'node_js', '--skip-enable', '-r', 'travis-ci/travis.rb')
|
|
137
|
+
YAML.load_file('.travis.yml')
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
it 'sets compiler' do
|
|
141
|
+
result.should include('node_js')
|
|
142
|
+
result['node_js'].should include('stable')
|
|
143
|
+
result['node_js'].should include('6')
|
|
144
|
+
result['node_js'].should include('4')
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
describe 'travis init objective-c' do
|
|
149
|
+
it_should_behave_like 'travis init', 'objective-c'
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
describe 'travis init perl' do
|
|
153
|
+
it_should_behave_like 'travis init', 'perl'
|
|
154
|
+
|
|
155
|
+
let :result do
|
|
156
|
+
run_cli('init', 'perl', '--skip-enable', '-r', 'travis-ci/travis.rb')
|
|
157
|
+
YAML.load_file('.travis.yml')
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
it 'sets compiler' do
|
|
161
|
+
result.should include('perl')
|
|
162
|
+
result['perl'].should include('5.16')
|
|
163
|
+
result['perl'].should include('5.14')
|
|
164
|
+
end
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
describe 'travis init php' do
|
|
168
|
+
it_should_behave_like 'travis init', 'php'
|
|
169
|
+
|
|
170
|
+
let :result do
|
|
171
|
+
run_cli('init', 'php', '--skip-enable', '-r', 'travis-ci/travis.rb')
|
|
172
|
+
YAML.load_file('.travis.yml')
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
it 'sets compiler' do
|
|
176
|
+
result.should include('php')
|
|
177
|
+
result['php'].should include('5.5')
|
|
178
|
+
result['php'].should include('5.4')
|
|
179
|
+
end
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
describe 'travis init python' do
|
|
183
|
+
it_should_behave_like 'travis init', 'python'
|
|
184
|
+
|
|
185
|
+
let :result do
|
|
186
|
+
run_cli('init', 'python', '--skip-enable', '-r', 'travis-ci/travis.rb')
|
|
187
|
+
YAML.load_file('.travis.yml')
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
it 'sets compiler' do
|
|
191
|
+
result.should include('python')
|
|
192
|
+
result['python'].should include('2.7')
|
|
193
|
+
result['python'].should include('3.3')
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
describe 'travis init ruby' do
|
|
198
|
+
it_should_behave_like 'travis init', 'ruby'
|
|
199
|
+
|
|
200
|
+
let :result do
|
|
201
|
+
run_cli('init', 'ruby', '--skip-enable', '-r', 'travis-ci/travis.rb')
|
|
202
|
+
YAML.load_file('.travis.yml')
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
it 'sets compiler' do
|
|
206
|
+
result.should include('rvm')
|
|
207
|
+
result['rvm'].should include('1.9.3')
|
|
208
|
+
result['rvm'].should include('2.0.0')
|
|
209
|
+
result['rvm'].should_not include('1.8.7')
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
describe 'travis init scala' do
|
|
214
|
+
it_should_behave_like 'travis init', 'scala'
|
|
215
|
+
|
|
216
|
+
let :result do
|
|
217
|
+
run_cli('init', 'scala', '--skip-enable', '-r', 'travis-ci/travis.rb')
|
|
218
|
+
YAML.load_file('.travis.yml')
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
it 'sets compiler' do
|
|
222
|
+
result.should include('scala')
|
|
223
|
+
result['scala'].should include('2.10.1')
|
|
224
|
+
result['scala'].should include('2.9.3')
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Login do
|
|
4
|
+
example "travis login", :unless => Travis::Tools::System.windows? do
|
|
5
|
+
run_cli('login', '-E', '--skip-token-check') { |i| i.puts('rkh', 'password') }.should be_success
|
|
6
|
+
run_cli('whoami').out.should be == "rkh\n"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
example "travis login (with bad credentials)", :unless => Travis::Tools::System.windows? do
|
|
10
|
+
run_cli('login') { |i| i.puts('rkh', 'wrong password') }.should_not be_success
|
|
11
|
+
run_cli('whoami').should_not be_success
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Open do
|
|
4
|
+
example 'travis open -p' do
|
|
5
|
+
run_cli('open', '-p').should be_success
|
|
6
|
+
stdout.should match(/https:\/\/travis-ci.org\/[\w\W]*\/travis\.rb/)
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
example 'travis open 6180 -p' do
|
|
10
|
+
run_cli('open', '6180', '-p').should be_success
|
|
11
|
+
stdout.should match(/https:\/\/travis-ci.org\/[\w\W]*\/travis\.rb\/builds\/4125095/)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
example 'travis open 6180.1 -p' do
|
|
15
|
+
run_cli('open', '6180.1', '-p').should be_success
|
|
16
|
+
stdout.should match(/https:\/\/travis-ci.org\/[\w\W]*\/travis\.rb\/jobs\/4125096/)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
example 'travis open -pg' do
|
|
20
|
+
run_cli('open', '-pg').should be_success
|
|
21
|
+
stdout.should match(/https:\/\/github.com\/[\w\W]*\/travis\.rb/)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
example 'travis open 6180 -pg' do
|
|
25
|
+
run_cli('open', '6180', '-pg').should be_success
|
|
26
|
+
stdout.should be == "https://github.com/rails/rails/compare/6581d798e830...a0265b98f16c\n"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
example 'travis open 6180.1 -pg' do
|
|
30
|
+
run_cli('open', '6180.1', '-pg').should be_success
|
|
31
|
+
stdout.should be == "https://github.com/rails/rails/compare/6581d798e830...a0265b98f16c\n"
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'uri'
|
|
3
|
+
|
|
4
|
+
describe Travis::CLI::RepoCommand do
|
|
5
|
+
describe '#parse_remote' do
|
|
6
|
+
it 'handles git@github.com URIs' do
|
|
7
|
+
path = subject.send(:parse_remote, 'git@github.com:travis-ci/travis.rb.git')
|
|
8
|
+
path.should be == '/travis-ci/travis.rb.git'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'handles GitHub Enterprise URIS' do
|
|
12
|
+
path = subject.send(:parse_remote, 'git@example.com:travis-ci/travis.rb.git')
|
|
13
|
+
path.should be == '/travis-ci/travis.rb.git'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'handles HTTPS URIs' do
|
|
17
|
+
path = subject.send(:parse_remote, 'https://github.com/travis-ci/travis.rb.git')
|
|
18
|
+
path.should be == '/travis-ci/travis.rb.git'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
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)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Restart do
|
|
4
|
+
example 'travis restart' do
|
|
5
|
+
run_cli('restart', '-t', 'token').should be_success
|
|
6
|
+
$params['build_id'].should be == "4125095"
|
|
7
|
+
$params['job_id'].should be_nil
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
example 'travis restart 6180.1' do
|
|
11
|
+
run_cli('restart', '6180.1', '-t', 'token').should be_success
|
|
12
|
+
$params['build_id'].should be_nil
|
|
13
|
+
$params['job_id'].should be == "4125096"
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Status do
|
|
4
|
+
example "travis status" do
|
|
5
|
+
run_cli('status').should be_success
|
|
6
|
+
stdout.should be == "failed\n"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
example "travis status -x" do
|
|
10
|
+
run_cli('status', '-x').should_not be_success
|
|
11
|
+
stdout.should be == "failed\n"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
example "travis status -q" do
|
|
15
|
+
run_cli('status', '-q').should be_success
|
|
16
|
+
stdout.should be_empty
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
example "travis status -pqx" do
|
|
20
|
+
run_cli('endpoint', '-pqx').should_not be_success
|
|
21
|
+
stdout.should be_empty
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
example "travis status -i" do
|
|
25
|
+
run_cli('status', '-i', '--skip-completion-check', '-r', 'travis-ci/travis.rb').should be_success
|
|
26
|
+
stdout.should be == "build #6180 failed\n"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Token do
|
|
4
|
+
example "travis token (access token set)" do
|
|
5
|
+
run_cli('token', '-t', 'super-secret').should be_success
|
|
6
|
+
stdout.should == "super-secret\n"
|
|
7
|
+
stderr.should be_empty
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
example "travis token -i (access token set)" do
|
|
11
|
+
run_cli('token', '-it', 'super-secret').should be_success
|
|
12
|
+
stdout.should == "Your access token is super-secret\n"
|
|
13
|
+
stderr.should be_empty
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
example 'travis token (no access token set)' do
|
|
17
|
+
run_cli('token').should_not be_success
|
|
18
|
+
|
|
19
|
+
stdout.should be_empty
|
|
20
|
+
stderr.should == "not logged in, please run #{File.basename($0)} login\n"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Version do
|
|
4
|
+
example do
|
|
5
|
+
run_cli('-v').should be_success
|
|
6
|
+
stdout.should be == "#{Travis::VERSION}\n"
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
example do
|
|
10
|
+
run_cli('--version').should be_success
|
|
11
|
+
stdout.should be == "#{Travis::VERSION}\n"
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
example do
|
|
15
|
+
run_cli('version').should be_success
|
|
16
|
+
stdout.should be == "#{Travis::VERSION}\n"
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe Travis::CLI::Whoami do
|
|
4
|
+
example "travis whoami" do
|
|
5
|
+
run_cli('whoami').should_not be_success
|
|
6
|
+
stdout.should be_empty
|
|
7
|
+
stderr.should be == "not logged in, please run #{File.basename $0} login\n"
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
example "travis whoami --pro" do
|
|
11
|
+
run_cli('whoami', '--pro').should_not be_success
|
|
12
|
+
stdout.should be_empty
|
|
13
|
+
stderr.should be == "not logged in, please run #{File.basename $0} login --pro\n"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
example "travis whoami -t token" do
|
|
17
|
+
run_cli('whoami', '-t', 'token').should be_success
|
|
18
|
+
stdout.should be == "rkh\n"
|
|
19
|
+
stderr.should be_empty
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
example "TRAVIS_TOKEN=token travis whoami" do
|
|
23
|
+
ENV['TRAVIS_TOKEN'] = 'token'
|
|
24
|
+
run_cli('whoami').should be_success
|
|
25
|
+
stdout.should be == "rkh\n"
|
|
26
|
+
stderr.should be_empty
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
example "travis whoami -t token -i" do
|
|
30
|
+
run_cli('whoami', '-t', 'token', '-i').should be_success
|
|
31
|
+
stdout.should be == "You are rkh (Konstantin Haase)\n"
|
|
32
|
+
stderr.should be_empty
|
|
33
|
+
end
|
|
34
|
+
end
|