belly 0.5.4 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.belly +1 -4
- data/Gemfile +5 -1
- data/Rakefile +0 -2
- data/VERSION +1 -1
- data/belly.gemspec +3 -8
- data/features/support/belly.rb +1 -1
- data/lib/belly.rb +2 -0
- data/lib/belly/cli.rb +1 -1
- data/lib/belly/cli/init.rb +21 -54
- data/lib/belly/cli/rerun.rb +2 -19
- data/lib/belly/client/config.rb +14 -0
- data/lib/belly/client/hub_proxy.rb +7 -8
- data/lib/belly/for/cucumber.rb +0 -1
- data/lib/belly/rerun.rb +13 -0
- metadata +18 -32
data/.belly
CHANGED
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -10,8 +10,6 @@ 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"
|
15
13
|
gem.add_development_dependency "rspec"
|
16
14
|
gem.add_development_dependency "cucumber"
|
17
15
|
# 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.1
|
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.5"
|
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-08-
|
12
|
+
s.date = %q{2010-08-22}
|
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}
|
@@ -51,6 +51,7 @@ Gem::Specification.new do |s|
|
|
51
51
|
"lib/belly/client/hub_proxy.rb",
|
52
52
|
"lib/belly/for/cucumber.rb",
|
53
53
|
"lib/belly/messages/cucumber_scenario_result_message.rb",
|
54
|
+
"lib/belly/rerun.rb",
|
54
55
|
"spec/belly/project_initializer_spec.rb",
|
55
56
|
"spec/spec_helper.rb"
|
56
57
|
]
|
@@ -69,19 +70,13 @@ Gem::Specification.new do |s|
|
|
69
70
|
s.specification_version = 3
|
70
71
|
|
71
72
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
72
|
-
s.add_runtime_dependency(%q<trollop>, [">= 0"])
|
73
|
-
s.add_runtime_dependency(%q<rest-client>, [">= 0"])
|
74
73
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
75
74
|
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
76
75
|
else
|
77
|
-
s.add_dependency(%q<trollop>, [">= 0"])
|
78
|
-
s.add_dependency(%q<rest-client>, [">= 0"])
|
79
76
|
s.add_dependency(%q<rspec>, [">= 0"])
|
80
77
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
81
78
|
end
|
82
79
|
else
|
83
|
-
s.add_dependency(%q<trollop>, [">= 0"])
|
84
|
-
s.add_dependency(%q<rest-client>, [">= 0"])
|
85
80
|
s.add_dependency(%q<rspec>, [">= 0"])
|
86
81
|
s.add_dependency(%q<cucumber>, [">= 0"])
|
87
82
|
end
|
data/features/support/belly.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require 'belly/for/cucumber'
|
1
|
+
require File.dirname(__FILE__) + '/../../lib/belly/for/cucumber'
|
data/lib/belly.rb
CHANGED
data/lib/belly/cli.rb
CHANGED
data/lib/belly/cli/init.rb
CHANGED
@@ -1,68 +1,35 @@
|
|
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 availlable, 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
|
11
10
|
end
|
12
11
|
|
13
|
-
|
14
|
-
|
12
|
+
if File.exists?('features/support')
|
13
|
+
target = 'features/support/belly.rb'
|
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
|
15
22
|
|
16
|
-
|
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
|
23
|
+
Your project is now initialized for working with Belly.
|
27
24
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
create_file('.belly') do
|
35
|
-
<<-EOF
|
36
|
-
hub: #{default_config.host}:#{default_config.port}
|
37
|
-
project: #{default_config.project}
|
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.
|
27
|
+
|
28
|
+
Here's an example:
|
29
|
+
|
30
|
+
project: #{Belly.config.project}
|
38
31
|
user:
|
39
|
-
name: #{
|
40
|
-
email: #{
|
32
|
+
name: #{Belly.config.user[:name]}
|
33
|
+
email: #{Belly.config.user[:email]}
|
41
34
|
EOF
|
42
|
-
|
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)
|
35
|
+
end
|
data/lib/belly/cli/rerun.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'belly/
|
1
|
+
require 'belly/rerun'
|
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 availlable, type belly --help
|
6
6
|
|
7
7
|
Usage: belly rerun
|
8
8
|
|
@@ -12,21 +12,4 @@ 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
|
-
|
32
15
|
Belly::Rerun.new(options).run(Trollop)
|
data/lib/belly/client/config.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'belly/client/default_config'
|
2
|
+
require 'belly/credentials'
|
2
3
|
require 'yaml'
|
3
4
|
|
4
5
|
module Belly::Client
|
@@ -33,8 +34,21 @@ module Belly::Client
|
|
33
34
|
config_file['user'] || @default.user
|
34
35
|
end
|
35
36
|
|
37
|
+
def username
|
38
|
+
credentials.username
|
39
|
+
end
|
40
|
+
|
41
|
+
def password
|
42
|
+
credentials.password
|
43
|
+
end
|
44
|
+
|
36
45
|
private
|
37
46
|
|
47
|
+
def credentials
|
48
|
+
return @credenitals if @credenitals
|
49
|
+
@credenitals = Belly::Credentials.new
|
50
|
+
end
|
51
|
+
|
38
52
|
def config_file
|
39
53
|
return @file if @file
|
40
54
|
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
|
5
4
|
class HubProxy
|
6
|
-
|
7
5
|
def initialize(config)
|
8
6
|
@config = config
|
7
|
+
@username = @config.username
|
8
|
+
@password = @config.password
|
9
9
|
end
|
10
10
|
|
11
11
|
def post_test_result(json_data)
|
@@ -14,16 +14,14 @@ 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
|
-
|
18
|
-
status_querystring = rerun_statuses.map { |s| "status[]=#{s}"}.join("&")
|
19
|
-
response = request(:get, "/projects/#{project_id}/cucumber_scenarios.json?#{status_querystring}")
|
17
|
+
response = request(:get, "/projects/#{project_id}/cucumber_scenarios.json?status=todo")
|
20
18
|
JSON.parse(response)["cucumber_scenarios"]
|
21
19
|
end
|
22
20
|
|
23
21
|
def get_project_id_by_name(project_name)
|
24
22
|
response = request(:get, "/projects.json?name=#{project_name}")
|
25
23
|
projects = JSON.parse(response)["projects"]
|
26
|
-
raise
|
24
|
+
raise("Couldn't find a project named #{project_name}") unless projects.any?
|
27
25
|
projects.first["id"].to_i
|
28
26
|
end
|
29
27
|
|
@@ -35,11 +33,12 @@ module Belly::Client
|
|
35
33
|
|
36
34
|
def request(method, path, data = nil, options = nil)
|
37
35
|
url = @config.url + path
|
38
|
-
args = [
|
36
|
+
args = [method]
|
39
37
|
args << data if data
|
40
38
|
args << options if options
|
41
39
|
Belly.log("Sending #{method} request to #{url}")
|
42
|
-
|
40
|
+
p @username, @password
|
41
|
+
request_block = lambda { RestClient::Resource.new(url, @username, @password).send(*args) }
|
43
42
|
|
44
43
|
response = if @around_request_block
|
45
44
|
@around_request_block.call(request_block)
|
data/lib/belly/for/cucumber.rb
CHANGED
data/lib/belly/rerun.rb
ADDED
@@ -0,0 +1,13 @@
|
|
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
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: belly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
9
|
+
- 5
|
10
|
+
version: 0.5.5
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Matt Wynne
|
@@ -14,57 +15,37 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-22 00:00:00 +01:00
|
18
19
|
default_executable: belly
|
19
20
|
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
21
|
-
name: trollop
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
segments:
|
28
|
-
- 0
|
29
|
-
version: "0"
|
30
|
-
type: :runtime
|
31
|
-
version_requirements: *id001
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: rest-client
|
34
|
-
prerelease: false
|
35
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
segments:
|
40
|
-
- 0
|
41
|
-
version: "0"
|
42
|
-
type: :runtime
|
43
|
-
version_requirements: *id002
|
44
21
|
- !ruby/object:Gem::Dependency
|
45
22
|
name: rspec
|
46
23
|
prerelease: false
|
47
|
-
requirement: &
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
48
26
|
requirements:
|
49
27
|
- - ">="
|
50
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
51
30
|
segments:
|
52
31
|
- 0
|
53
32
|
version: "0"
|
54
33
|
type: :development
|
55
|
-
version_requirements: *
|
34
|
+
version_requirements: *id001
|
56
35
|
- !ruby/object:Gem::Dependency
|
57
36
|
name: cucumber
|
58
37
|
prerelease: false
|
59
|
-
requirement: &
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
60
40
|
requirements:
|
61
41
|
- - ">="
|
62
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
63
44
|
segments:
|
64
45
|
- 0
|
65
46
|
version: "0"
|
66
47
|
type: :development
|
67
|
-
version_requirements: *
|
48
|
+
version_requirements: *id002
|
68
49
|
description: Client app for the incredible new belly web service, coming soon.
|
69
50
|
email: matt@mattwynne.net
|
70
51
|
executables:
|
@@ -107,6 +88,7 @@ files:
|
|
107
88
|
- lib/belly/client/hub_proxy.rb
|
108
89
|
- lib/belly/for/cucumber.rb
|
109
90
|
- lib/belly/messages/cucumber_scenario_result_message.rb
|
91
|
+
- lib/belly/rerun.rb
|
110
92
|
- spec/belly/project_initializer_spec.rb
|
111
93
|
- spec/spec_helper.rb
|
112
94
|
has_rdoc: true
|
@@ -119,23 +101,27 @@ rdoc_options:
|
|
119
101
|
require_paths:
|
120
102
|
- lib
|
121
103
|
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
122
105
|
requirements:
|
123
106
|
- - ">="
|
124
107
|
- !ruby/object:Gem::Version
|
108
|
+
hash: 3
|
125
109
|
segments:
|
126
110
|
- 0
|
127
111
|
version: "0"
|
128
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
129
114
|
requirements:
|
130
115
|
- - ">="
|
131
116
|
- !ruby/object:Gem::Version
|
117
|
+
hash: 3
|
132
118
|
segments:
|
133
119
|
- 0
|
134
120
|
version: "0"
|
135
121
|
requirements: []
|
136
122
|
|
137
123
|
rubyforge_project:
|
138
|
-
rubygems_version: 1.3.
|
124
|
+
rubygems_version: 1.3.7
|
139
125
|
signing_key:
|
140
126
|
specification_version: 3
|
141
127
|
summary: Client app for the incredible new belly web service, coming soon.
|