rainforest-cli 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YjNhOTdmMWViMTU0OTIwNzE1NTI5YzkzZTc3NzgxZjIyY2Y3MTY2OQ==
5
+ data.tar.gz: !binary |-
6
+ Y2MwYTljZWQ2Zjg5ODE0ZmIzMTM3M2E2Y2MwYWM4MzFkMDk5ZWFjOQ==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ODlmZTMzNjIzMzQ1NjhiYTM0ZTZiNWQ5Nzk2ZjE0N2RmODI2Y2VmMGMyNWZl
10
+ ZDQ0ODljM2FlZDM0OWMxN2E3NjBiNjNkZTQ2MTE2ZGQ5NWRiM2NiYjhjOTA0
11
+ YTllZWMwMGQwYzQxODI0YTA3NTQ1ODc5YTU5ZmQxMmI2OWRlZWI=
12
+ data.tar.gz: !binary |-
13
+ ZTgzN2M1NzE3N2U1NjQ5Yzg0NmVhNjM3MmFkZTI1YzA3MzhhZTk1YTY4ZDQ0
14
+ YjQ4OTljZDQ2ZWYwM2QyYTUxMDM5OWIxNWZkMzYwMjQ0ZDA4ZWI5NmQzYmRh
15
+ Y2Y2ODhmNGYzYTVmZTk4ZDczYzkwYjVhNzBiODY3ZmNlMzIyYzI=
data/.travis.yml CHANGED
@@ -1,4 +1,10 @@
1
+ language: ruby
1
2
  rvm:
2
3
  - 2.0.0
3
4
  - 1.9.3
4
- - 1.8.7
5
+ - jruby-19mode
6
+ - rbx-2.1.1
7
+ - ruby-head
8
+ - jruby-head
9
+
10
+ script: bundle exec rspec spec
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Rainforest CLI Changelog
2
+
3
+ ## 0.0.11 - 30th Sept 2013
4
+ - First changelog entry.
5
+ - Fixed travis config (9f74cb37bc451356458d8087ebd2694271eedfc2)
@@ -27,7 +27,7 @@ module Rainforest
27
27
 
28
28
  if response['error']
29
29
  puts "Error starting your run: #{response['error']}"
30
- exit
30
+ exit 1
31
31
  end
32
32
 
33
33
  run_id = response["id"]
@@ -36,20 +36,23 @@ module Rainforest
36
36
  return unless @options.foreground?
37
37
 
38
38
  while running
39
- sleep 5
39
+ Kernel.sleep 5
40
40
  response = get "#{API_URL}/#{run_id}?gem_version=#{Rainforest::Cli::VERSION}"
41
- if %w(queued in_progress sending_webhook waiting_for_callback).include?(response["state"])
42
- puts "Run #{run_id} is #{response['state']} and is #{response['current_progress']['percent']}% complete"
43
- running = false if response["result"] == 'failed' && @options.failfast?
44
- else
45
- puts "Run #{run_id} is now #{response["state"]} and has #{response["result"]}"
46
- running = false
41
+ if response
42
+ if %w(queued in_progress sending_webhook waiting_for_callback).include?(response["state"])
43
+ puts "Run #{run_id} is #{response['state']} and is #{response['current_progress']['percent']}% complete"
44
+ running = false if response["result"] == 'failed' && @options.failfast?
45
+ else
46
+ puts "Run #{run_id} is now #{response["state"]} and has #{response["result"]}"
47
+ running = false
48
+ end
47
49
  end
48
50
  end
49
51
 
50
52
  if response["result"] != "passed"
51
53
  exit 1
52
54
  end
55
+ true
53
56
  end
54
57
 
55
58
  def self.post(url, body = {})
@@ -67,7 +70,11 @@ module Rainforest
67
70
  headers: {"CLIENT_TOKEN" => @options.token}
68
71
  }
69
72
 
70
- JSON.parse(response.body)
73
+ if response.code == 200
74
+ JSON.parse(response.body)
75
+ else
76
+ nil
77
+ end
71
78
  end
72
79
  end
73
80
  end
@@ -1,5 +1,5 @@
1
1
  module Rainforest
2
2
  module Cli
3
- VERSION = "0.0.11"
3
+ VERSION = "0.0.12"
4
4
  end
5
5
  end
data/spec/cli_spec.rb ADDED
@@ -0,0 +1,45 @@
1
+ describe Rainforest::Cli do
2
+ before do
3
+ Kernel.stub(:sleep)
4
+ end
5
+
6
+ describe ".start" do
7
+ let(:valid_args) { %w(--token foo run --fg all) }
8
+ let(:ok_progress) { {"state" => "in_progress", "current_progress" => {"percent" => "1"} } }
9
+
10
+ context "a simple run" do
11
+ before do
12
+ described_class.stub(:post) { {"id" => 1} }
13
+ 3.times do
14
+ described_class.should_receive(:get) { ok_progress }
15
+ end
16
+ described_class.should_receive(:get) { {"state" => "complete", "result" => "passed" } }
17
+ end
18
+
19
+ it "should return true" do
20
+ described_class.start(valid_args).should be_true
21
+ end
22
+ end
23
+
24
+ context "a run where the server 500s after a while" do
25
+ before do
26
+ described_class.stub(:post) { {"id" => 1} }
27
+ 2.times do
28
+ described_class.should_receive(:get) { ok_progress }
29
+ end
30
+
31
+ described_class.should_receive(:get) { nil }
32
+
33
+ 2.times do
34
+ described_class.should_receive(:get) { ok_progress }
35
+ end
36
+
37
+ described_class.should_receive(:get) { {"state" => "complete", "result" => "passed" } }
38
+ end
39
+
40
+ it "should return true" do
41
+ described_class.start(valid_args).should be_true
42
+ end
43
+ end
44
+ end
45
+ end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rainforest-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
5
- prerelease:
4
+ version: 0.0.12
6
5
  platform: ruby
7
6
  authors:
8
7
  - Simon Mathieu
@@ -10,12 +9,11 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-10-01 00:00:00.000000000 Z
12
+ date: 2013-12-19 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: httparty
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
18
  - - ! '>='
21
19
  - !ruby/object:Gem::Version
@@ -23,7 +21,6 @@ dependencies:
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
25
  - - ! '>='
29
26
  - !ruby/object:Gem::Version
@@ -31,7 +28,6 @@ dependencies:
31
28
  - !ruby/object:Gem::Dependency
32
29
  name: bundler
33
30
  requirement: !ruby/object:Gem::Requirement
34
- none: false
35
31
  requirements:
36
32
  - - ~>
37
33
  - !ruby/object:Gem::Version
@@ -39,7 +35,6 @@ dependencies:
39
35
  type: :development
40
36
  prerelease: false
41
37
  version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
38
  requirements:
44
39
  - - ~>
45
40
  - !ruby/object:Gem::Version
@@ -47,7 +42,6 @@ dependencies:
47
42
  - !ruby/object:Gem::Dependency
48
43
  name: rake
49
44
  requirement: !ruby/object:Gem::Requirement
50
- none: false
51
45
  requirements:
52
46
  - - ! '>='
53
47
  - !ruby/object:Gem::Version
@@ -55,7 +49,6 @@ dependencies:
55
49
  type: :development
56
50
  prerelease: false
57
51
  version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
52
  requirements:
60
53
  - - ! '>='
61
54
  - !ruby/object:Gem::Version
@@ -73,6 +66,7 @@ files:
73
66
  - .rspec
74
67
  - .rvmrc
75
68
  - .travis.yml
69
+ - CHANGELOG.md
76
70
  - Gemfile
77
71
  - LICENSE.txt
78
72
  - README.md
@@ -82,33 +76,34 @@ files:
82
76
  - lib/rainforest/cli/options.rb
83
77
  - lib/rainforest/cli/version.rb
84
78
  - rainforest-cli.gemspec
79
+ - spec/cli_spec.rb
85
80
  - spec/options_spec.rb
86
81
  - spec/spec_helper.rb
87
82
  homepage: https://www.rainforestqa.com/
88
83
  licenses:
89
84
  - MIT
85
+ metadata: {}
90
86
  post_install_message:
91
87
  rdoc_options: []
92
88
  require_paths:
93
89
  - lib
94
90
  required_ruby_version: !ruby/object:Gem::Requirement
95
- none: false
96
91
  requirements:
97
92
  - - ! '>='
98
93
  - !ruby/object:Gem::Version
99
94
  version: '0'
100
95
  required_rubygems_version: !ruby/object:Gem::Requirement
101
- none: false
102
96
  requirements:
103
97
  - - ! '>='
104
98
  - !ruby/object:Gem::Version
105
99
  version: '0'
106
100
  requirements: []
107
101
  rubyforge_project:
108
- rubygems_version: 1.8.25
102
+ rubygems_version: 2.0.5
109
103
  signing_key:
110
- specification_version: 3
104
+ specification_version: 4
111
105
  summary: Command line utility for RainforestQA
112
106
  test_files:
107
+ - spec/cli_spec.rb
113
108
  - spec/options_spec.rb
114
109
  - spec/spec_helper.rb