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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OWIxOWM5OTA5MjRkN2ZiMGQ3NzY4YTcxZDRlNmY4NTQwNmM5NWIxMw==
4
+ NDY4YmViMTU2MTQ0Y2RhNWMyMDE5N2FkODdiZjRmMDNmZTFlMDI1NA==
5
5
  data.tar.gz: !binary |-
6
- ZDU1ZDU0ZWIxNzliMTlhY2ZkNmI2ZDQ0ZGZjMzVmMDg0MGY3ZTMwZg==
6
+ M2EzNTU0ZTFjMGYxOTkxY2ZiNjM0NWJjMTQxYTBlOWE4ODExNjllYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MGFjMjk2Zjg1MWE1N2Y1MGUxYzZkMmFkMmFlNDQ1MWQyNzI3NmEyNzA2Njlk
10
- MGQ4ZTYwZDExOGRmZTRkMTg5NjJlOGJiNGM4YmYxYTNjZTBmMGFmMmY0MzQz
11
- NzE1NTA5NjBhZTZjMDE4YzlmNjBjZTUxNjk1MjczODNlYzEyOWQ=
9
+ YzBhMGM1MzY0MTdlY2M5MzQ4NWIzM2M1ODZhZDc1OWRlNzA4ZWM3YWM2NmM0
10
+ ZDcxNDc2MTQ5NjI1Yzc0Yzg1NjEwODZjNGEwNDEwOGFiODczNGVmOTNlYzVi
11
+ NjI4NWUyNTkwYTk4YzFiYmE4MjM2NGNkNTZlYTVmM2QxNjBjYWE=
12
12
  data.tar.gz: !binary |-
13
- NmRiMTYwZmVjNmE1Y2FiODNkN2I5MTAxNTg2MzdlMGY4ODRmYzdiZDRlNmUw
14
- MjhkN2EwOGIyMzY2ZDE0NGIzZjgyYjljNWE3NDY4YWE3MjAyYzRmMWU2YTQ3
15
- ODhiZjYxYzIzZDg3N2JkYjNmZjZiNjQ0OWRmOTgzYjU3NGFhMzA=
13
+ NTE1MGRmYjc3Y2I0MTNjYWZiNTRiNjFlNTA0MTc0MGMxNjY5MjQ1M2M1NThl
14
+ ZjJiMDYxNjBhYjVhYzcwYzM3Zjk4MTc4OGY3ODFhY2I1ZThjYjNkZmYyYTJi
15
+ YThlMTk3YjUwMzU1OTMzODkyNjQ2OWNhM2EzYTBiMGJlZDE3N2Y=
data/README.md CHANGED
@@ -16,6 +16,10 @@ Run and report
16
16
 
17
17
  rainforest run --fg all
18
18
 
19
+ Run all tests with tag 'run-me' and abort previous in-progress runs.
20
+
21
+ rainforest run --token a8b2fe2dd7360ec72aaef0a0312fa7fa --tag run-me --conflict abort
22
+
19
23
  ## Contributing
20
24
 
21
25
  1. Fork it
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Rainforest
2
2
  module Cli
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
@@ -10,11 +10,22 @@ module Rainforest
10
10
  def self.start(args)
11
11
  @options = OptionParser.new(args)
12
12
 
13
- response = post(API_URL, tests: @options.tests)
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
- while running
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.1
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-08 00:00:00.000000000 Z
11
+ date: 2013-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty