belly 0.5.5 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- data/.belly +4 -1
- data/Gemfile.lock +32 -0
- data/Rakefile +2 -0
- data/VERSION +1 -1
- data/belly.gemspec +13 -5
- data/features/support/belly.rb +1 -1
- data/lib/belly.rb +0 -2
- data/lib/belly/cli/init.rb +54 -21
- data/lib/belly/cli/rerun.rb +19 -2
- data/lib/belly/cli/steps.rb +14 -0
- data/lib/belly/client/config.rb +0 -14
- data/lib/belly/client/hub_proxy.rb +8 -7
- data/lib/belly/for/cucumber.rb +1 -0
- data/lib/belly/steps_command.rb +12 -0
- metadata +39 -9
- data/lib/belly/rerun.rb +0 -13
data/.belly
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
aruba (0.2.1)
|
5
|
+
diff-lcs (1.1.2)
|
6
|
+
json (1.4.6)
|
7
|
+
mime-types (1.16)
|
8
|
+
rack (1.2.1)
|
9
|
+
rest-client (1.6.1)
|
10
|
+
mime-types (>= 1.16)
|
11
|
+
rspec (2.0.0.beta.22)
|
12
|
+
rspec-core (= 2.0.0.beta.22)
|
13
|
+
rspec-expectations (= 2.0.0.beta.22)
|
14
|
+
rspec-mocks (= 2.0.0.beta.22)
|
15
|
+
rspec-core (2.0.0.beta.22)
|
16
|
+
rspec-expectations (2.0.0.beta.22)
|
17
|
+
diff-lcs (>= 1.1.2)
|
18
|
+
rspec-mocks (2.0.0.beta.22)
|
19
|
+
rspec-core (= 2.0.0.beta.22)
|
20
|
+
rspec-expectations (= 2.0.0.beta.22)
|
21
|
+
sinatra (1.0)
|
22
|
+
rack (>= 1.0)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
aruba
|
29
|
+
json
|
30
|
+
rest-client
|
31
|
+
rspec (>= 2.0.0.beta.19)
|
32
|
+
sinatra
|
data/Rakefile
CHANGED
@@ -10,6 +10,8 @@ begin
|
|
10
10
|
gem.email = "matt@mattwynne.net"
|
11
11
|
gem.homepage = "http://belly.heroku.com"
|
12
12
|
gem.authors = ["Matt Wynne"]
|
13
|
+
gem.add_dependency "trollop"
|
14
|
+
gem.add_dependency "rest-client"
|
13
15
|
gem.add_development_dependency "rspec"
|
14
16
|
gem.add_development_dependency "cucumber"
|
15
17
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.6
|
data/belly.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{belly}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matt Wynne"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-27}
|
13
13
|
s.default_executable = %q{belly}
|
14
14
|
s.description = %q{Client app for the incredible new belly web service, coming soon.}
|
15
15
|
s.email = %q{matt@mattwynne.net}
|
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
".document",
|
25
25
|
".gitignore",
|
26
26
|
"Gemfile",
|
27
|
+
"Gemfile.lock",
|
27
28
|
"LICENSE",
|
28
29
|
"README.rdoc",
|
29
30
|
"Rakefile",
|
@@ -44,6 +45,7 @@ Gem::Specification.new do |s|
|
|
44
45
|
"lib/belly/cli.rb",
|
45
46
|
"lib/belly/cli/init.rb",
|
46
47
|
"lib/belly/cli/rerun.rb",
|
48
|
+
"lib/belly/cli/steps.rb",
|
47
49
|
"lib/belly/client.rb",
|
48
50
|
"lib/belly/client/config.rb",
|
49
51
|
"lib/belly/client/default_config.rb",
|
@@ -51,14 +53,14 @@ Gem::Specification.new do |s|
|
|
51
53
|
"lib/belly/client/hub_proxy.rb",
|
52
54
|
"lib/belly/for/cucumber.rb",
|
53
55
|
"lib/belly/messages/cucumber_scenario_result_message.rb",
|
54
|
-
"lib/belly/
|
56
|
+
"lib/belly/steps_command.rb",
|
55
57
|
"spec/belly/project_initializer_spec.rb",
|
56
58
|
"spec/spec_helper.rb"
|
57
59
|
]
|
58
60
|
s.homepage = %q{http://belly.heroku.com}
|
59
61
|
s.rdoc_options = ["--charset=UTF-8"]
|
60
62
|
s.require_paths = ["lib"]
|
61
|
-
s.rubygems_version = %q{1.3.
|
63
|
+
s.rubygems_version = %q{1.3.7}
|
62
64
|
s.summary = %q{Client app for the incredible new belly web service, coming soon.}
|
63
65
|
s.test_files = [
|
64
66
|
"spec/belly/project_initializer_spec.rb",
|
@@ -69,14 +71,20 @@ Gem::Specification.new do |s|
|
|
69
71
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
70
72
|
s.specification_version = 3
|
71
73
|
|
72
|
-
if Gem::Version.new(Gem::
|
74
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
75
|
+
s.add_runtime_dependency(%q<trollop>, [">= 0"])
|
76
|
+
s.add_runtime_dependency(%q<rest-client>, [">= 0"])
|
73
77
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
74
78
|
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
75
79
|
else
|
80
|
+
s.add_dependency(%q<trollop>, [">= 0"])
|
81
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
76
82
|
s.add_dependency(%q<rspec>, [">= 0"])
|
77
83
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
78
84
|
end
|
79
85
|
else
|
86
|
+
s.add_dependency(%q<trollop>, [">= 0"])
|
87
|
+
s.add_dependency(%q<rest-client>, [">= 0"])
|
80
88
|
s.add_dependency(%q<rspec>, [">= 0"])
|
81
89
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
82
90
|
end
|
data/features/support/belly.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require
|
1
|
+
require 'belly/for/cucumber'
|
data/lib/belly.rb
CHANGED
data/lib/belly/cli/init.rb
CHANGED
@@ -1,35 +1,68 @@
|
|
1
1
|
options = Trollop::options do
|
2
2
|
banner <<-EOF
|
3
|
-
This is the help for the init command. To see all commands
|
3
|
+
This is the help for the init command. To see all commands available, type belly --help
|
4
4
|
|
5
5
|
Usage: belly init
|
6
6
|
|
7
7
|
Initialize your project for use with the belly service
|
8
8
|
|
9
9
|
EOF
|
10
|
+
opt :force, 'Overwite files even if they already exist', :default => false
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
if File.exists?(target)
|
15
|
-
Trollop.die("There's already a #{target} which I was going to create. Not much for me to do")
|
16
|
-
end
|
17
|
-
File.open(target, 'w') do |f|
|
18
|
-
f.puts "require 'belly/for/cucumber'"
|
19
|
-
end
|
20
|
-
puts "Created #{target}"
|
21
|
-
puts <<-EOF
|
22
|
-
|
23
|
-
Your project is now initialized for working with Belly.
|
24
|
-
|
25
|
-
You can configure Belly's settings by creating a .belly file in root of your project.
|
26
|
-
If you don't create one, I'll just use some defaults.
|
13
|
+
require 'belly/client/default_config'
|
14
|
+
require 'fileutils'
|
27
15
|
|
28
|
-
|
16
|
+
module Belly
|
17
|
+
class Init
|
18
|
+
|
19
|
+
def initialize(options)
|
20
|
+
@options = options
|
21
|
+
end
|
22
|
+
|
23
|
+
def run(ui)
|
24
|
+
unless File.exists?('features/support')
|
25
|
+
ui.die("It doesn't look like you are in a project with Cucumber features")
|
26
|
+
end
|
29
27
|
|
30
|
-
|
28
|
+
create_file('features/support/belly.rb') do
|
29
|
+
<<-EOF
|
30
|
+
require 'belly/for/cucumber'
|
31
|
+
EOF
|
32
|
+
end
|
33
|
+
|
34
|
+
create_file('.belly') do
|
35
|
+
<<-EOF
|
36
|
+
hub: #{default_config.host}:#{default_config.port}
|
37
|
+
project: #{default_config.project}
|
31
38
|
user:
|
32
|
-
name: #{
|
33
|
-
email: #{
|
39
|
+
name: #{default_config.user[:name]}
|
40
|
+
email: #{default_config.user[:email]}
|
34
41
|
EOF
|
35
|
-
end
|
42
|
+
end
|
43
|
+
|
44
|
+
puts
|
45
|
+
puts "Lovely. Your project is now initialized for use with Belly."
|
46
|
+
puts "You can edit your project's settings by editing the .belly file in this folder."
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def default_config
|
52
|
+
@default_config ||= Belly::Client::DefaultConfig.new
|
53
|
+
end
|
54
|
+
|
55
|
+
def create_file(target)
|
56
|
+
FileUtils.rm_rf(target) if @options[:force]
|
57
|
+
if File.exists?(target)
|
58
|
+
Trollop.die("#{target} already exists. Use --force to make me overwrite it")
|
59
|
+
end
|
60
|
+
File.open(target, 'w') do |f|
|
61
|
+
f.puts yield
|
62
|
+
end
|
63
|
+
puts "Created #{target}"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
Belly::Init.new(options).run(Trollop)
|
data/lib/belly/cli/rerun.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'belly/
|
1
|
+
require 'belly/client'
|
2
2
|
|
3
3
|
options = Trollop::options do
|
4
4
|
banner <<-EOF
|
5
|
-
This is the help for the rerun command. To see all commands
|
5
|
+
This is the help for the rerun command. To see all commands available, type belly --help
|
6
6
|
|
7
7
|
Usage: belly rerun
|
8
8
|
|
@@ -12,4 +12,21 @@ EOF
|
|
12
12
|
opt :name, "Name of the project", :default => File.basename(Dir.pwd)
|
13
13
|
end
|
14
14
|
|
15
|
+
module Belly
|
16
|
+
class Rerun
|
17
|
+
def initialize(options)
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def run(ui)
|
22
|
+
scenarios = Belly.hub.get_failing_scenarios_for_project_named(Belly.config.project)
|
23
|
+
todos = scenarios.map { |scenario| "#{scenario["file_name"]}:#{scenario["line_number"]}" }
|
24
|
+
todos.sort.each { |todo| puts todo }
|
25
|
+
|
26
|
+
rescue Client::NoSuchProjectError
|
27
|
+
ui.die("Belly doesn't know enough about this project yet. Please run some tests, then try again.")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
15
32
|
Belly::Rerun.new(options).run(Trollop)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'belly/steps_command'
|
2
|
+
|
3
|
+
options = Trollop::options do
|
4
|
+
banner <<-EOF
|
5
|
+
This is the help for the steps command. To see all commands availlable, type belly --help
|
6
|
+
|
7
|
+
Usage: belly steps
|
8
|
+
|
9
|
+
Format your Cucumber step definitions as JSON
|
10
|
+
|
11
|
+
EOF
|
12
|
+
end
|
13
|
+
|
14
|
+
Belly::StepsCommand.new(options).run(Trollop)
|
data/lib/belly/client/config.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'belly/client/default_config'
|
2
|
-
require 'belly/credentials'
|
3
2
|
require 'yaml'
|
4
3
|
|
5
4
|
module Belly::Client
|
@@ -34,21 +33,8 @@ module Belly::Client
|
|
34
33
|
config_file['user'] || @default.user
|
35
34
|
end
|
36
35
|
|
37
|
-
def username
|
38
|
-
credentials.username
|
39
|
-
end
|
40
|
-
|
41
|
-
def password
|
42
|
-
credentials.password
|
43
|
-
end
|
44
|
-
|
45
36
|
private
|
46
37
|
|
47
|
-
def credentials
|
48
|
-
return @credenitals if @credenitals
|
49
|
-
@credenitals = Belly::Credentials.new
|
50
|
-
end
|
51
|
-
|
52
38
|
def config_file
|
53
39
|
return @file if @file
|
54
40
|
Belly.log("pwd is #{`pwd`}")
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'rest_client'
|
2
2
|
|
3
3
|
module Belly::Client
|
4
|
+
class NoSuchProjectError < StandardError; end
|
4
5
|
class HubProxy
|
6
|
+
|
5
7
|
def initialize(config)
|
6
8
|
@config = config
|
7
|
-
@username = @config.username
|
8
|
-
@password = @config.password
|
9
9
|
end
|
10
10
|
|
11
11
|
def post_test_result(json_data)
|
@@ -14,14 +14,16 @@ module Belly::Client
|
|
14
14
|
|
15
15
|
def get_failing_scenarios_for_project_named(project_name)
|
16
16
|
project_id = get_project_id_by_name(project_name)
|
17
|
-
|
17
|
+
rerun_statuses = [:pending, :undefined, :failed]
|
18
|
+
status_querystring = rerun_statuses.map { |s| "status[]=#{s}"}.join("&")
|
19
|
+
response = request(:get, "/projects/#{project_id}/cucumber_scenarios.json?#{status_querystring}")
|
18
20
|
JSON.parse(response)["cucumber_scenarios"]
|
19
21
|
end
|
20
22
|
|
21
23
|
def get_project_id_by_name(project_name)
|
22
24
|
response = request(:get, "/projects.json?name=#{project_name}")
|
23
25
|
projects = JSON.parse(response)["projects"]
|
24
|
-
raise
|
26
|
+
raise NoSuchProjectError unless projects.any?
|
25
27
|
projects.first["id"].to_i
|
26
28
|
end
|
27
29
|
|
@@ -33,12 +35,11 @@ module Belly::Client
|
|
33
35
|
|
34
36
|
def request(method, path, data = nil, options = nil)
|
35
37
|
url = @config.url + path
|
36
|
-
args = [
|
38
|
+
args = [url]
|
37
39
|
args << data if data
|
38
40
|
args << options if options
|
39
41
|
Belly.log("Sending #{method} request to #{url}")
|
40
|
-
|
41
|
-
request_block = lambda { RestClient::Resource.new(url, @username, @password).send(*args) }
|
42
|
+
request_block = lambda { RestClient.send(method, *args) }
|
42
43
|
|
43
44
|
response = if @around_request_block
|
44
45
|
@around_request_block.call(request_block)
|
data/lib/belly/for/cucumber.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: belly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 7
|
10
|
+
version: 0.5.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Wynne
|
@@ -15,11 +15,11 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-09-27 00:00:00 +01:00
|
19
19
|
default_executable: belly
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
|
-
name:
|
22
|
+
name: trollop
|
23
23
|
prerelease: false
|
24
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
@@ -30,10 +30,10 @@ dependencies:
|
|
30
30
|
segments:
|
31
31
|
- 0
|
32
32
|
version: "0"
|
33
|
-
type: :
|
33
|
+
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: rest-client
|
37
37
|
prerelease: false
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
@@ -44,8 +44,36 @@ dependencies:
|
|
44
44
|
segments:
|
45
45
|
- 0
|
46
46
|
version: "0"
|
47
|
-
type: :
|
47
|
+
type: :runtime
|
48
48
|
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: rspec
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
hash: 3
|
58
|
+
segments:
|
59
|
+
- 0
|
60
|
+
version: "0"
|
61
|
+
type: :development
|
62
|
+
version_requirements: *id003
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: cucumber
|
65
|
+
prerelease: false
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
type: :development
|
76
|
+
version_requirements: *id004
|
49
77
|
description: Client app for the incredible new belly web service, coming soon.
|
50
78
|
email: matt@mattwynne.net
|
51
79
|
executables:
|
@@ -61,6 +89,7 @@ files:
|
|
61
89
|
- .document
|
62
90
|
- .gitignore
|
63
91
|
- Gemfile
|
92
|
+
- Gemfile.lock
|
64
93
|
- LICENSE
|
65
94
|
- README.rdoc
|
66
95
|
- Rakefile
|
@@ -81,6 +110,7 @@ files:
|
|
81
110
|
- lib/belly/cli.rb
|
82
111
|
- lib/belly/cli/init.rb
|
83
112
|
- lib/belly/cli/rerun.rb
|
113
|
+
- lib/belly/cli/steps.rb
|
84
114
|
- lib/belly/client.rb
|
85
115
|
- lib/belly/client/config.rb
|
86
116
|
- lib/belly/client/default_config.rb
|
@@ -88,7 +118,7 @@ files:
|
|
88
118
|
- lib/belly/client/hub_proxy.rb
|
89
119
|
- lib/belly/for/cucumber.rb
|
90
120
|
- lib/belly/messages/cucumber_scenario_result_message.rb
|
91
|
-
- lib/belly/
|
121
|
+
- lib/belly/steps_command.rb
|
92
122
|
- spec/belly/project_initializer_spec.rb
|
93
123
|
- spec/spec_helper.rb
|
94
124
|
has_rdoc: true
|
data/lib/belly/rerun.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
module Belly
|
2
|
-
class Rerun
|
3
|
-
def initialize(options)
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
def run(ui)
|
8
|
-
Belly.hub.get_failing_scenarios_for_project_named(Belly.config.project).each do |scenario|
|
9
|
-
puts "#{scenario["file_name"]}:#{scenario["line_number"]}"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|