belly 0.5.0 → 0.5.1

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,2 +1,5 @@
1
1
  hub: belly.heroku.com:80
2
- project: belly-gem
2
+ project: belly-gem
3
+ user:
4
+ name: Matt Wynne
5
+ email: matt@mattwynne.net
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
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.0"
8
+ s.version = "0.5.1"
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-22}
12
+ s.date = %q{2010-08-23}
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,7 +51,6 @@ 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",
55
54
  "spec/belly/project_initializer_spec.rb",
56
55
  "spec/spec_helper.rb"
57
56
  ]
@@ -1 +1 @@
1
- require File.dirname(__FILE__) + '/../../lib/belly/for/cucumber'
1
+ require 'belly/for/cucumber'
@@ -14,5 +14,3 @@ 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'
@@ -7,29 +7,60 @@ Usage: belly init
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
- 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
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.
27
-
28
- Here's an example:
13
+ require 'belly/client/default_config'
14
+ module Belly
15
+ class Init
16
+
17
+ def initialize(options)
18
+ @options = options
19
+ end
20
+
21
+ def run(ui)
22
+ unless File.exists?('features/support')
23
+ ui.die("It doesn't look like you are in a project with Cucumber features")
24
+ end
29
25
 
30
- project: #{Belly.config.project}
26
+ create_file('features/support/belly.rb') do
27
+ <<-EOF
28
+ require 'belly/for/cucumber'
29
+ EOF
30
+ end
31
+
32
+ create_file('.belly') do
33
+ <<-EOF
34
+ hub: #{default_config.host}:#{default_config.port}
35
+ project: #{default_config.project}
31
36
  user:
32
- name: #{Belly.config.user[:name]}
33
- email: #{Belly.config.user[:email]}
37
+ name: #{default_config.user[:name]}
38
+ email: #{default_config.user[:email]}
34
39
  EOF
35
- end
40
+ end
41
+
42
+ puts
43
+ puts "Lovely. Your project is now initialized for use with Belly."
44
+ puts "You can edit your project's settings by editing the .belly file in this folder."
45
+ end
46
+
47
+ private
48
+
49
+ def default_config
50
+ @default_config ||= Belly::Client::DefaultConfig.new
51
+ end
52
+
53
+ def create_file(target)
54
+ FileUtils.rm_rf(target) if @options[:force]
55
+ if File.exists?(target)
56
+ Trollop.die("#{target} already exists. Use --force to make me overwrite it")
57
+ end
58
+ File.open(target, 'w') do |f|
59
+ f.puts yield
60
+ end
61
+ puts "Created #{target}"
62
+ end
63
+ end
64
+ end
65
+
66
+ Belly::Init.new(options).run(Trollop)
@@ -1,4 +1,4 @@
1
- require 'belly/rerun'
1
+ require 'belly/client'
2
2
 
3
3
  options = Trollop::options do
4
4
  banner <<-EOF
@@ -12,4 +12,18 @@ 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
+ Belly.hub.get_failing_scenarios_for_project_named(Belly.config.project).each do |scenario|
23
+ puts "#{scenario["file_name"]}:#{scenario["line_number"]}"
24
+ end
25
+ end
26
+ end
27
+ end
28
+
15
29
  Belly::Rerun.new(options).run(Trollop)
@@ -1,4 +1,5 @@
1
1
  require 'belly'
2
+ require 'belly/client'
2
3
 
3
4
  Before do |scenario|
4
5
  Belly.log %{about to run scenario "#{scenario.name}"}
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 0
9
- version: 0.5.0
8
+ - 1
9
+ version: 0.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt Wynne
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-22 00:00:00 +01:00
17
+ date: 2010-08-23 00:00:00 +01:00
18
18
  default_executable: belly
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -83,7 +83,6 @@ files:
83
83
  - lib/belly/client/hub_proxy.rb
84
84
  - lib/belly/for/cucumber.rb
85
85
  - lib/belly/messages/cucumber_scenario_result_message.rb
86
- - lib/belly/rerun.rb
87
86
  - spec/belly/project_initializer_spec.rb
88
87
  - spec/spec_helper.rb
89
88
  has_rdoc: true
@@ -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