rainforest-cli 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +4 -0
- data/lib/rainforest/cli/options.rb +10 -1
- data/lib/rainforest/cli/version.rb +1 -1
- data/lib/rainforest/cli.rb +13 -2
- data/spec/options_spec.rb +12 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDY4YmViMTU2MTQ0Y2RhNWMyMDE5N2FkODdiZjRmMDNmZTFlMDI1NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2EzNTU0ZTFjMGYxOTkxY2ZiNjM0NWJjMTQxYTBlOWE4ODExNjllYg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzBhMGM1MzY0MTdlY2M5MzQ4NWIzM2M1ODZhZDc1OWRlNzA4ZWM3YWM2NmM0
|
10
|
+
ZDcxNDc2MTQ5NjI1Yzc0Yzg1NjEwODZjNGEwNDEwOGFiODczNGVmOTNlYzVi
|
11
|
+
NjI4NWUyNTkwYTk4YzFiYmE4MjM2NGNkNTZlYTVmM2QxNjBjYWE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTE1MGRmYjc3Y2I0MTNjYWZiNTRiNjFlNTA0MTc0MGMxNjY5MjQ1M2M1NThl
|
14
|
+
ZjJiMDYxNjBhYjVhYzcwYzM3Zjk4MTc4OGY3ODFhY2I1ZThjYjNkZmYyYTJi
|
15
|
+
YThlMTk3YjUwMzU1OTMzODkyNjQ2OWNhM2EzYTBiMGJlZDE3N2Y=
|
data/README.md
CHANGED
@@ -3,10 +3,11 @@ require 'optparse'
|
|
3
3
|
module Rainforest
|
4
4
|
module Cli
|
5
5
|
class OptionParser
|
6
|
-
attr_reader :command, :token
|
6
|
+
attr_reader :command, :token, :tags, :conflict
|
7
7
|
|
8
8
|
def initialize(args)
|
9
9
|
@args = args.dup
|
10
|
+
@tags = []
|
10
11
|
|
11
12
|
@parsed = ::OptionParser.new do |opts|
|
12
13
|
opts.on("--fg", "Run the tests in foreground.") do |value|
|
@@ -16,6 +17,14 @@ module Rainforest
|
|
16
17
|
opts.on("--token TOKEN", String, "Your rainforest API token.") do |value|
|
17
18
|
@token = value
|
18
19
|
end
|
20
|
+
|
21
|
+
opts.on("--tag TOKEN", String, "A tag to run the tests with") do |value|
|
22
|
+
@tags << value
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on("--conflict MODE", String, "How should Rainforest handle existing in progress runs?") do |value|
|
26
|
+
@conflict = value
|
27
|
+
end
|
19
28
|
end.parse!(@args)
|
20
29
|
|
21
30
|
@command = @args.shift
|
data/lib/rainforest/cli.rb
CHANGED
@@ -10,11 +10,22 @@ module Rainforest
|
|
10
10
|
def self.start(args)
|
11
11
|
@options = OptionParser.new(args)
|
12
12
|
|
13
|
-
|
13
|
+
post_opts = {}
|
14
|
+
if !@options.tags.empty?
|
15
|
+
post_opts[:tags] = @options.tags
|
16
|
+
else
|
17
|
+
post_opts[:tests] = @options.tests
|
18
|
+
end
|
19
|
+
|
20
|
+
post_opts[:conflict] = @options.conflict if @options.conflict
|
21
|
+
|
22
|
+
response = post(API_URL, post_opts)
|
14
23
|
run_id = response["id"]
|
15
24
|
running = true
|
16
25
|
|
17
|
-
|
26
|
+
return unless @options.foreground?
|
27
|
+
|
28
|
+
while running
|
18
29
|
sleep 5
|
19
30
|
response = get "#{API_URL}/#{run_id}"
|
20
31
|
if %w(queued in_progress sending_webhook waiting_for_callback).include?(response["state"])
|
data/spec/options_spec.rb
CHANGED
@@ -4,6 +4,13 @@ describe Rainforest::Cli::OptionParser do
|
|
4
4
|
context "run all tests" do
|
5
5
|
let(:args) { ["run", "all"] }
|
6
6
|
its(:tests) { should == ["all"]}
|
7
|
+
its(:conflict) { should == nil}
|
8
|
+
end
|
9
|
+
|
10
|
+
context "run from tags" do
|
11
|
+
let(:args) { ["run", "--tag", "run-me"] }
|
12
|
+
its(:tests) { should == []}
|
13
|
+
its(:tags) { should == ["run-me"]}
|
7
14
|
end
|
8
15
|
|
9
16
|
context "it parses the --fg flag" do
|
@@ -16,4 +23,9 @@ describe Rainforest::Cli::OptionParser do
|
|
16
23
|
let(:args) { ["run", "--token", "abc", "all"] }
|
17
24
|
its(:token) { should == "abc"}
|
18
25
|
end
|
26
|
+
|
27
|
+
context "it parses the conflict flag" do
|
28
|
+
let(:args) { ["run", "--conflict", "abort", "all"] }
|
29
|
+
its(:conflict) { should == "abort"}
|
30
|
+
end
|
19
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rainforest-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Mathieu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|