rainforest-cli 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/.rspec +3 -0
- data/.rvmrc +1 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +25 -0
- data/Rakefile +1 -0
- data/bin/rainforest +7 -0
- data/lib/rainforest/cli.rb +51 -0
- data/lib/rainforest/cli/options.rb +35 -0
- data/lib/rainforest/cli/version.rb +5 -0
- data/rainforest-cli.gemspec +24 -0
- data/spec/options_spec.rb +19 -0
- data/spec/spec_helper.rb +20 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OWIxOWM5OTA5MjRkN2ZiMGQ3NzY4YTcxZDRlNmY4NTQwNmM5NWIxMw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDU1ZDU0ZWIxNzliMTlhY2ZkNmI2ZDQ0ZGZjMzVmMDg0MGY3ZTMwZg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MGFjMjk2Zjg1MWE1N2Y1MGUxYzZkMmFkMmFlNDQ1MWQyNzI3NmEyNzA2Njlk
|
10
|
+
MGQ4ZTYwZDExOGRmZTRkMTg5NjJlOGJiNGM4YmYxYTNjZTBmMGFmMmY0MzQz
|
11
|
+
NzE1NTA5NjBhZTZjMDE4YzlmNjBjZTUxNjk1MjczODNlYzEyOWQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NmRiMTYwZmVjNmE1Y2FiODNkN2I5MTAxNTg2MzdlMGY4ODRmYzdiZDRlNmUw
|
14
|
+
MjhkN2EwOGIyMzY2ZDE0NGIzZjgyYjljNWE3NDY4YWE3MjAyYzRmMWU2YTQ3
|
15
|
+
ODhiZjYxYzIzZDg3N2JkYjNmZjZiNjQ0OWRmOTgzYjU3NGFhMzA=
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.3@rainforest-cli
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Simon Mathieu
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# Rainforest-cli
|
2
|
+
|
3
|
+
A command line interface to interact with RainforestQA.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
$ gem install rainforest-cli
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Run all of your tests
|
12
|
+
|
13
|
+
rainforest run all
|
14
|
+
|
15
|
+
Run and report
|
16
|
+
|
17
|
+
rainforest run --fg all
|
18
|
+
|
19
|
+
## Contributing
|
20
|
+
|
21
|
+
1. Fork it
|
22
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
23
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
24
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
25
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/rainforest
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require "rainforest/cli/version"
|
2
|
+
require "rainforest/cli/options"
|
3
|
+
require 'httparty'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module Rainforest
|
7
|
+
module Cli
|
8
|
+
API_URL = 'https://app.rainforestqa.com/api/1/runs'
|
9
|
+
|
10
|
+
def self.start(args)
|
11
|
+
@options = OptionParser.new(args)
|
12
|
+
|
13
|
+
response = post(API_URL, tests: @options.tests)
|
14
|
+
run_id = response["id"]
|
15
|
+
running = true
|
16
|
+
|
17
|
+
while running
|
18
|
+
sleep 5
|
19
|
+
response = get "#{API_URL}/#{run_id}"
|
20
|
+
if %w(queued in_progress sending_webhook waiting_for_callback).include?(response["state"])
|
21
|
+
puts "Run #{run_id} is still running"
|
22
|
+
else
|
23
|
+
puts "Run #{run_id} is now #{response["state"]} and has #{response["result"]}"
|
24
|
+
running = false
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if response["result"] != "passed"
|
29
|
+
exit 1
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.post(url, body = {})
|
34
|
+
response = HTTParty.post url, {
|
35
|
+
body: body,
|
36
|
+
headers: {"CLIENT_TOKEN" => @options.token}
|
37
|
+
}
|
38
|
+
|
39
|
+
JSON.parse(response.body)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.get(url, body = {})
|
43
|
+
response = HTTParty.get url, {
|
44
|
+
body: body,
|
45
|
+
headers: {"CLIENT_TOKEN" => @options.token}
|
46
|
+
}
|
47
|
+
|
48
|
+
JSON.parse(response.body)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
3
|
+
module Rainforest
|
4
|
+
module Cli
|
5
|
+
class OptionParser
|
6
|
+
attr_reader :command, :token
|
7
|
+
|
8
|
+
def initialize(args)
|
9
|
+
@args = args.dup
|
10
|
+
|
11
|
+
@parsed = ::OptionParser.new do |opts|
|
12
|
+
opts.on("--fg", "Run the tests in foreground.") do |value|
|
13
|
+
@foreground = value
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on("--token TOKEN", String, "Your rainforest API token.") do |value|
|
17
|
+
@token = value
|
18
|
+
end
|
19
|
+
end.parse!(@args)
|
20
|
+
|
21
|
+
@command = @args.shift
|
22
|
+
@tests = @args.dup
|
23
|
+
end
|
24
|
+
|
25
|
+
def tests
|
26
|
+
@tests
|
27
|
+
end
|
28
|
+
|
29
|
+
def foreground?
|
30
|
+
@foreground
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rainforest/cli/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rainforest-cli"
|
8
|
+
spec.version = Rainforest::Cli::VERSION
|
9
|
+
spec.authors = ["Simon Mathieu"]
|
10
|
+
spec.email = ["simon.math@gmail.com"]
|
11
|
+
spec.description = %q{Command line utility for RainforestQA}
|
12
|
+
spec.summary = %q{Command line utility for RainforestQA}
|
13
|
+
spec.homepage = "http://rainforestqa.com"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "httparty"
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
describe Rainforest::Cli::OptionParser do
|
2
|
+
subject { Rainforest::Cli::OptionParser.new(args) }
|
3
|
+
|
4
|
+
context "run all tests" do
|
5
|
+
let(:args) { ["run", "all"] }
|
6
|
+
its(:tests) { should == ["all"]}
|
7
|
+
end
|
8
|
+
|
9
|
+
context "it parses the --fg flag" do
|
10
|
+
let(:args) { ["run", "--fg", "all"] }
|
11
|
+
its(:tests) { should == ["all"]}
|
12
|
+
its(:foreground?) { should be_true }
|
13
|
+
end
|
14
|
+
|
15
|
+
context "it parses the api token" do
|
16
|
+
let(:args) { ["run", "--token", "abc", "all"] }
|
17
|
+
its(:token) { should == "abc"}
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
4
|
+
# loaded once.
|
5
|
+
#
|
6
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
7
|
+
|
8
|
+
require "rainforest/cli"
|
9
|
+
|
10
|
+
RSpec.configure do |config|
|
11
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
12
|
+
config.run_all_when_everything_filtered = true
|
13
|
+
config.filter_run :focus
|
14
|
+
|
15
|
+
# Run specs in random order to surface order dependencies. If you find an
|
16
|
+
# order dependency and want to debug it, you can fix the order by providing
|
17
|
+
# the seed, which is printed after each run.
|
18
|
+
# --seed 1234
|
19
|
+
config.order = 'random'
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rainforest-cli
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Simon Mathieu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-08-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Command line utility for RainforestQA
|
56
|
+
email:
|
57
|
+
- simon.math@gmail.com
|
58
|
+
executables:
|
59
|
+
- rainforest
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- .gitignore
|
64
|
+
- .rspec
|
65
|
+
- .rvmrc
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/rainforest
|
71
|
+
- lib/rainforest/cli.rb
|
72
|
+
- lib/rainforest/cli/options.rb
|
73
|
+
- lib/rainforest/cli/version.rb
|
74
|
+
- rainforest-cli.gemspec
|
75
|
+
- spec/options_spec.rb
|
76
|
+
- spec/spec_helper.rb
|
77
|
+
homepage: http://rainforestqa.com
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.0.5
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Command line utility for RainforestQA
|
101
|
+
test_files:
|
102
|
+
- spec/options_spec.rb
|
103
|
+
- spec/spec_helper.rb
|