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 CHANGED
@@ -1,5 +1,2 @@
1
1
  hub: belly.heroku.com:80
2
- project: belly-gem
3
- user:
4
- name: Matt Wynne
5
- email: matt@mattwynne.net
2
+ project: belly-gem
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
+ source :gemcutter
2
+
1
3
  gem "rest-client"
2
- gem "jeweler"
3
4
  gem "rspec", ">= 2.0.0.beta.19"
5
+ gem "aruba"
6
+ gem "sinatra"
7
+ gem "json"
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.4
1
+ 0.5.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{belly}
8
- s.version = "0.5.4"
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-23}
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
@@ -1 +1 @@
1
- require 'belly/for/cucumber'
1
+ require File.dirname(__FILE__) + '/../../lib/belly/for/cucumber'
@@ -14,3 +14,5 @@ module Belly
14
14
  end
15
15
 
16
16
  Belly.log "Belly version #{Belly.version} starting in #{File.expand_path(File.dirname(__FILE__))}"
17
+
18
+ require 'belly/client'
@@ -1,5 +1,5 @@
1
1
  module Belly
2
2
  module Cli
3
- COMMANDS = %w(init rerun)
3
+ COMMANDS = %w(init rerun steps)
4
4
  end
5
5
  end
@@ -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 available, type belly --help
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
- require 'belly/client/default_config'
14
- require 'fileutils'
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
- 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
23
+ Your project is now initialized for working with Belly.
27
24
 
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}
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: #{default_config.user[:name]}
40
- email: #{default_config.user[:email]}
32
+ name: #{Belly.config.user[:name]}
33
+ email: #{Belly.config.user[:email]}
41
34
  EOF
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)
35
+ end
@@ -1,8 +1,8 @@
1
- require 'belly/client'
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 available, type belly --help
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)
@@ -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
- 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}")
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 NoSuchProjectError unless projects.any?
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 = [url]
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
- request_block = lambda { RestClient.send(method, *args) }
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)
@@ -1,5 +1,4 @@
1
1
  require 'belly'
2
- require 'belly/client'
3
2
 
4
3
  Before do |scenario|
5
4
  Belly.log %{about to run scenario "#{scenario.name}"}
@@ -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
- - 4
9
- version: 0.5.4
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-23 00:00:00 +01:00
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: &id003 !ruby/object:Gem::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: *id003
34
+ version_requirements: *id001
56
35
  - !ruby/object:Gem::Dependency
57
36
  name: cucumber
58
37
  prerelease: false
59
- requirement: &id004 !ruby/object:Gem::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: *id004
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.6
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.