travis 1.0.3 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/README.md +786 -86
  2. data/Rakefile +3 -0
  3. data/lib/travis/cli/api_command.rb +22 -0
  4. data/lib/travis/cli/command.rb +36 -15
  5. data/lib/travis/cli/console.rb +13 -0
  6. data/lib/travis/cli/disable.rb +13 -0
  7. data/lib/travis/cli/enable.rb +29 -0
  8. data/lib/travis/cli/encrypt.rb +17 -4
  9. data/lib/travis/cli/history.rb +43 -0
  10. data/lib/travis/cli/logs.rb +18 -0
  11. data/lib/travis/cli/open.rb +36 -0
  12. data/lib/travis/cli/parser.rb +3 -3
  13. data/lib/travis/cli/repo_command.rb +16 -1
  14. data/lib/travis/cli/restart.rb +14 -0
  15. data/lib/travis/cli/show.rb +50 -0
  16. data/lib/travis/cli/status.rb +17 -0
  17. data/lib/travis/cli/sync.rb +28 -0
  18. data/lib/travis/cli/whatsup.rb +16 -0
  19. data/lib/travis/cli.rb +11 -0
  20. data/lib/travis/client/artifact.rb +25 -0
  21. data/lib/travis/client/build.rb +41 -0
  22. data/lib/travis/client/commit.rb +26 -0
  23. data/lib/travis/client/entity.rb +47 -3
  24. data/lib/travis/client/job.rb +52 -0
  25. data/lib/travis/client/methods.rb +22 -1
  26. data/lib/travis/client/repository.rb +70 -5
  27. data/lib/travis/client/session.rb +40 -8
  28. data/lib/travis/client/states.rb +85 -0
  29. data/lib/travis/client/user.rb +6 -0
  30. data/lib/travis/client.rb +5 -0
  31. data/lib/travis/tools/formatter.rb +38 -0
  32. data/lib/travis/version.rb +1 -1
  33. data/spec/cli/encrypt_spec.rb +16 -1
  34. data/spec/cli/history_spec.rb +28 -0
  35. data/spec/cli/logs_spec.rb +8 -0
  36. data/spec/cli/open_spec.rb +33 -0
  37. data/spec/cli/restart_spec.rb +15 -0
  38. data/spec/cli/show_spec.rb +9 -0
  39. data/spec/cli/status_spec.rb +28 -0
  40. data/spec/client/build_spec.rb +31 -0
  41. data/spec/client/commit_spec.rb +18 -0
  42. data/spec/client/job_spec.rb +30 -0
  43. data/spec/client/repository_spec.rb +15 -0
  44. data/spec/client/session_spec.rb +4 -0
  45. data/spec/spec_helper.rb +4 -1
  46. data/spec/support/fake_api.rb +616 -1
  47. data/travis.gemspec +37 -3
  48. metadata +66 -2
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe Travis::CLI::Open do
4
+ example 'travis restart' do
5
+ run_cli('restart').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').should be_success
12
+ $params['build_id'].should be_nil
13
+ $params['job_id'].should be == "4125096"
14
+ end
15
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe Travis::CLI::Show do
4
+ example 'show 6180.1' do
5
+ run_cli('show', '6180.1').should be_success
6
+ stdout.should include("Config: ")
7
+ stdout.should include("env: GEM=railties")
8
+ end
9
+ 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').should be_success
26
+ stdout.should be == "build #6180 failed\n"
27
+ end
28
+ end
@@ -0,0 +1,31 @@
1
+ require 'spec_helper'
2
+
3
+ describe Travis::Client::Build do
4
+ let(:session) { Travis::Client.new }
5
+ subject { session.build(4125095) }
6
+ its(:number) { should be == '6180' }
7
+ its(:state) { should be == 'failed' }
8
+ its(:duration) { should be == 5019 }
9
+ its(:started_at) { should be_a(Time) }
10
+ its(:finished_at) { should be_nil }
11
+ its(:inspect) { should be == "#<Travis::Client::Build: rails/rails#6180>" }
12
+ its(:color) { should be == 'red' }
13
+ its(:commit) { should be_a(Travis::Client::Commit) }
14
+ its(:jobs) { should be_an(Array) }
15
+ its(:repository) { should be == session.repo('rails/rails') }
16
+
17
+ it { should be == subject.repository.last_build }
18
+
19
+ it { should_not be_pending }
20
+ it { should be_started }
21
+ it { should be_finished }
22
+ it { should_not be_passed }
23
+ it { should_not be_errored }
24
+ it { should be_failed }
25
+ it { should_not be_canceled }
26
+ it { should be_created }
27
+ it { should be_red }
28
+ it { should_not be_green }
29
+ it { should_not be_yellow }
30
+ it { should be_unsuccessful }
31
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ describe Travis::Client::Build do
4
+ let(:session) { Travis::Client.new }
5
+ subject { session.build(4125095).commit }
6
+
7
+ its(:sha) { should be == 'a0265b98f16c6e33be32aa3f57231d1189302400' }
8
+ its(:short_sha) { should be == 'a0265b9' }
9
+ its(:branch) { should be == 'master' }
10
+ its(:message) { should be == 'Associaton -> Association' }
11
+ its(:committed_at) { should be_a(Time) }
12
+ its(:author_name) { should be == 'Steve Klabnik' }
13
+ its(:author_email) { should be == 'steve@steveklabnik.com' }
14
+ its(:committer_name) { should be == 'Steve Klabnik' }
15
+ its(:committer_email) { should be == 'steve@steveklabnik.com' }
16
+ its(:compare_url) { should be == 'https://github.com/rails/rails/compare/6581d798e830...a0265b98f16c' }
17
+ its(:subject) { should be == 'Associaton -> Association' }
18
+ end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe Travis::Client::Job do
4
+ let(:session) { Travis::Client.new }
5
+ subject { session.job(4125097) }
6
+ its(:number) { should be == '6180.2' }
7
+ its(:state) { should be == 'passed' }
8
+ its(:started_at) { should be_a(Time) }
9
+ its(:finished_at) { should be_a(Time) }
10
+ its(:inspect) { should be == "#<Travis::Client::Job: rails/rails#6180.2>" }
11
+ its(:color) { should be == 'green' }
12
+ its(:commit) { should be_a(Travis::Client::Commit) }
13
+ its(:repository) { should be == session.repo('rails/rails') }
14
+ its(:duration) { should be == 905 }
15
+
16
+ it { should be == subject.build.jobs[1] }
17
+
18
+ it { should_not be_pending }
19
+ it { should be_started }
20
+ it { should be_finished }
21
+ it { should be_passed }
22
+ it { should_not be_errored }
23
+ it { should_not be_failed }
24
+ it { should_not be_canceled }
25
+ it { should be_created }
26
+ it { should_not be_red }
27
+ it { should be_green }
28
+ it { should_not be_yellow }
29
+ it { should_not be_unsuccessful }
30
+ end
@@ -12,4 +12,19 @@ describe Travis::Client::Repository do
12
12
  its(:last_build_finished_at) { should be_nil }
13
13
  its(:inspect) { should be == "#<Travis::Client::Repository: rails/rails>" }
14
14
  its(:key) { should be_a(Travis::Client::Repository::Key) }
15
+ its(:last_build) { should be_a(Travis::Client::Build) }
16
+ its(:color) { should be == 'red' }
17
+
18
+ it { should_not be_pending }
19
+ it { should be_started }
20
+ it { should be_finished }
21
+ it { should_not be_passed }
22
+ it { should_not be_errored }
23
+ it { should be_failed }
24
+ it { should_not be_canceled }
25
+ it { should be_created }
26
+ it { should be_red }
27
+ it { should_not be_green }
28
+ it { should_not be_yellow }
29
+ it { should be_unsuccessful }
15
30
  end
@@ -142,4 +142,8 @@ describe Travis::Client::Session do
142
142
  describe "session" do
143
143
  its(:session) { should eq(subject) }
144
144
  end
145
+
146
+ describe "config" do
147
+ its(:config) { should be == {"host" => "travis-ci.org"}}
148
+ end
145
149
  end
data/spec/spec_helper.rb CHANGED
@@ -6,14 +6,17 @@ require 'fileutils'
6
6
  require 'travis'
7
7
  require 'highline'
8
8
  require 'tmpdir'
9
+ require 'pry' # pry doesn't like us mocking $stdout
9
10
 
10
11
  temp_dir = nil
11
12
 
13
+ HighLine.use_color = false
14
+ HighLine.define_singleton_method(:use_color=) { |_| }
15
+
12
16
  RSpec.configure do |c|
13
17
  c.include Helpers
14
18
 
15
19
  c.before do
16
- HighLine.use_color = false
17
20
  temp_dir = File.expand_path('travis-spec', Dir.tmpdir)
18
21
  FileUtils.rm_rf(temp_dir)
19
22
  FileUtils.mkdir_p(temp_dir)