aslakhellesoy-cucumber 0.3.94.1 → 0.3.95

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
- == (In Git)
1
+ == 0.3.95 2009-08-13
2
2
 
3
- This release improves Webrat support for table-like HTML markup. This means that you can easily get the
4
- 2-dimensional data from HTML table, dl, ol and ul elements. This is particularly useful for comparing
3
+ This release improves Webrat support for table-like HTML markup. Now you can easily turn the HTML
4
+ elements table, dl, ol and ul elements into a 2D array. This is particularly useful for comparing
5
5
  data in your HTML with a Cucumber table using Cucumber::Ast::Table#diff!
6
6
 
7
7
  This release also fixes several bugs related to --drb (Spork) and profiles (cucumber.yml)
@@ -321,6 +321,7 @@ lib/cucumber/cli/language_help_formatter.rb
321
321
  lib/cucumber/cli/main.rb
322
322
  lib/cucumber/cli/options.rb
323
323
  lib/cucumber/cli/profile_loader.rb
324
+ lib/cucumber/cli/rb_step_def_loader.rb
324
325
  lib/cucumber/core_ext/exception.rb
325
326
  lib/cucumber/core_ext/instance_exec.rb
326
327
  lib/cucumber/core_ext/proc.rb
@@ -1,5 +1,5 @@
1
1
  require 'spec/expectations'
2
- $:.unshift(File.dirname(__FILE__) + '/../../lib') # This line is not needed in your own project
2
+ $:.unshift(File.dirname(__FILE__) + '/../../') # This line is not needed in your own project
3
3
  require 'Calculator' # Calculator.dll
4
4
 
5
5
  Before do
@@ -4,9 +4,9 @@ require 'spec/expectations'
4
4
  require 'fileutils'
5
5
  require 'forwardable'
6
6
  begin
7
- gem "spork", ">= 0.5.1" # Ensure correct spork version number to avoid false-negatives.
7
+ require 'spork'
8
8
  rescue Gem::LoadError => ex
9
- warn "WARNING: #{ex.message} You need to have the spork gem installed to run the DRb feature properly!"
9
+ gem 'spork', '>= 0.5.7' # Ensure correct spork version number to avoid false-negatives.
10
10
  end
11
11
 
12
12
  class CucumberWorld
@@ -92,8 +92,7 @@ class CucumberWorld
92
92
  else
93
93
  # STDOUT.close
94
94
  # STDERR.close
95
- spork = `which spork`.strip
96
- cmd = "#{Cucumber::RUBY_BINARY} -I #{Cucumber::LIBDIR} #{spork} cuc"
95
+ cmd = "#{Cucumber::RUBY_BINARY} -I #{Cucumber::LIBDIR} #{Spork::BINARY} cuc"
97
96
  exec cmd
98
97
  end
99
98
  end
@@ -87,18 +87,18 @@ module Cucumber
87
87
  end
88
88
  end
89
89
 
90
- def files_to_require
90
+ def step_defs_to_load
91
91
  requires = @options[:require].empty? ? require_dirs : @options[:require]
92
92
  files = requires.map do |path|
93
93
  path = path.gsub(/\\/, '/') # In case we're on windows. Globs don't work with backslashes.
94
94
  path = path.gsub(/\/$/, '') # Strip trailing slash.
95
- File.directory?(path) ? Dir["#{path}/**/*.rb"] : path
95
+ File.directory?(path) ? Dir["#{path}/**/*"] : path
96
96
  end.flatten.uniq
97
- sorted_files = files.sort { |a,b| (b =~ %r{/support/} || -1) <=> (a =~ %r{/support/} || -1) }.reject{|f| f =~ /^http/}
98
- env_files = sorted_files.select {|f| f =~ %r{/support/env.rb} }
99
- files = env_files + sorted_files.reject {|f| f =~ %r{/support/env.rb} }
97
+ sorted_files = files.sort { |a,b| (b =~ %r{/support/} || -1) <=> (a =~ %r{/support/} || -1) }.reject{|f| f =~ /^http/}
98
+ env_files = sorted_files.select {|f| f =~ %r{/support/env\..*} }
99
+ files = env_files + sorted_files.reject {|f| f =~ %r{/support/env\..*} }
100
100
  remove_excluded_files_from(files)
101
- files.reject! {|f| f =~ %r{/support/env.rb} } if @options[:dry_run]
101
+ files.reject! {|f| f =~ %r{/support/env\..*} } if @options[:dry_run]
102
102
  files
103
103
  end
104
104
 
@@ -112,6 +112,22 @@ module Cucumber
112
112
  potential_feature_files
113
113
  end
114
114
 
115
+ def constantize(camel_cased_word)
116
+ begin
117
+ names = camel_cased_word.split('::')
118
+ names.shift if names.empty? || names.first.empty?
119
+
120
+ constant = Object
121
+ names.each do |name|
122
+ constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
123
+ end
124
+ constant
125
+ rescue NameError
126
+ require underscore(camel_cased_word)
127
+ retry
128
+ end
129
+ end
130
+
115
131
  private
116
132
 
117
133
  def paths
@@ -144,22 +160,6 @@ module Cucumber
144
160
  feature_dirs + Dir['vendor/{gems,plugins}/*/cucumber']
145
161
  end
146
162
 
147
- def constantize(camel_cased_word)
148
- begin
149
- names = camel_cased_word.split('::')
150
- names.shift if names.empty? || names.first.empty?
151
-
152
- constant = Object
153
- names.each do |name|
154
- constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
155
- end
156
- constant
157
- rescue NameError
158
- require underscore(camel_cased_word)
159
- retry
160
- end
161
- end
162
-
163
163
  # Snagged from active_support
164
164
  def underscore(camel_cased_word)
165
165
  camel_cased_word.to_s.gsub(/::/, '/').
@@ -51,7 +51,7 @@ module Cucumber
51
51
  # features are loaded. If we swap the order, the requires
52
52
  # will fail.
53
53
  features = load_plain_text_features
54
- require_files
54
+ load_step_defs
55
55
  enable_diffing
56
56
 
57
57
  visitor = configuration.build_formatter_broadcaster(step_mother)
@@ -108,33 +108,56 @@ module Cucumber
108
108
  @configuration
109
109
  end
110
110
 
111
- def load_files
112
- each_lib{|lib| load(lib)}
111
+ def verbose_log(string)
112
+ @out_stream.puts(string) if configuration.verbose?
113
113
  end
114
114
 
115
115
  private
116
116
 
117
- def require_files
118
- each_lib{|lib| require lib}
117
+ def load_step_defs
118
+ step_def_files = configuration.step_defs_to_load
119
+ verbose_log("Step Definitions Files:")
120
+ step_def_files.each do |step_def_file|
121
+ load_step_def(step_def_file)
122
+ end
123
+ end
124
+
125
+ def load_step_def(step_def_file)
126
+ if loader = step_def_loader_for(step_def_file)
127
+ verbose_log(" * #{step_def_file}")
128
+ loader.load_step_def_file(self, step_def_file)
129
+ end
119
130
  end
120
131
 
121
- def each_lib
122
- requires = configuration.files_to_require
123
- verbose_log("Ruby files required:")
124
- verbose_log(requires.map{|lib| " * #{lib}"}.join("\n"))
132
+ def step_def_loader_for(step_def_file)
133
+ @sted_def_loaders ||= {}
134
+ if ext = File.extname(step_def_file)[1..-1]
135
+ loader = @sted_def_loaders[ext]
136
+ return nil if loader == :missing
137
+ return loader if loader
138
+ begin
139
+ loader_class = configuration.constantize("Cucumber::Cli::#{ext.capitalize}StepDefLoader")
140
+ return @sted_def_loaders[ext] = loader_class.new
141
+ rescue LoadError
142
+ @sted_def_loaders[ext] = :missing
143
+ nil
144
+ end
145
+ end
146
+ nil
147
+ end
148
+
149
+ def step_def_files
150
+ main.verbose_log("Ruby files required:")
151
+ main.verbose_log(requires.map{|lib| " * #{lib}"}.join("\n"))
125
152
  requires.each do |lib|
126
153
  begin
127
- yield lib
154
+ require lib
128
155
  rescue LoadError => e
129
156
  e.message << "\nFailed to load #{lib}"
130
157
  raise e
131
158
  end
132
159
  end
133
- verbose_log("\n")
134
- end
135
-
136
- def verbose_log(string)
137
- @out_stream.puts(string) if configuration.verbose?
160
+ main.verbose_log("\n")
138
161
  end
139
162
 
140
163
  def enable_diffing
@@ -0,0 +1,14 @@
1
+ module Cucumber
2
+ module Cli
3
+ class RbStepDefLoader
4
+ def load_step_def_file(main, step_def_file)
5
+ begin
6
+ require step_def_file
7
+ rescue LoadError => e
8
+ e.message << "\nFailed to load #{step_def_file}"
9
+ raise e
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -2,8 +2,8 @@ module Cucumber #:nodoc:
2
2
  class VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 94
6
- PATCH = 1 # Set to nil for official release
5
+ TINY = 95
6
+ PATCH = nil # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
9
9
  end
@@ -38,7 +38,7 @@ module Cli
38
38
 
39
39
  config.parse!(%w{--require /features})
40
40
 
41
- config.files_to_require.should == [
41
+ config.step_defs_to_load.should == [
42
42
  "/features/support/bar.rb",
43
43
  "/features/step_definitions/foo.rb"
44
44
  ]
@@ -49,7 +49,7 @@ module Cli
49
49
 
50
50
  config.parse!(%w{--require /features})
51
51
 
52
- config.files_to_require.should == [
52
+ config.step_defs_to_load.should == [
53
53
  "/features/support/env.rb",
54
54
  "/features/support/a_file.rb"
55
55
  ]
@@ -60,7 +60,7 @@ module Cli
60
60
 
61
61
  config.parse!(%w{--require /features --dry-run})
62
62
 
63
- config.files_to_require.should == [
63
+ config.step_defs_to_load.should == [
64
64
  "/features/support/a_file.rb"
65
65
  ]
66
66
  end
@@ -71,7 +71,7 @@ module Cli
71
71
 
72
72
  config.parse!(%w{--require /features})
73
73
 
74
- config.files_to_require.should == [
74
+ config.step_defs_to_load.should == [
75
75
  "/vendor/plugins/plugin_a/cucumber/foo.rb",
76
76
  "/vendor/gems/gem_a/cucumber/bar.rb"
77
77
  ]
@@ -84,7 +84,7 @@ module Cli
84
84
 
85
85
  config.parse!(%w{--require /features --exclude a_file.rb})
86
86
 
87
- config.files_to_require.should == [
87
+ config.step_defs_to_load.should == [
88
88
  "/features/support/env.rb"
89
89
  ]
90
90
  end
@@ -96,7 +96,7 @@ module Cli
96
96
 
97
97
  config.parse!(%w{--require /features --exclude foo[df] --exclude blah})
98
98
 
99
- config.files_to_require.should == [
99
+ config.step_defs_to_load.should == [
100
100
  "/features/support/bar.rb",
101
101
  "/features/support/fooz.rb"
102
102
  ]
@@ -23,15 +23,6 @@ module Cucumber
23
23
  @empty_feature = Ast::Feature.new(nil, Ast::Comment.new(''), Ast::Tags.new(2, []), "Feature", [])
24
24
  end
25
25
 
26
- it "should show ruby files required" do
27
- @cli = Main.new(%w{--verbose --require example.rb}, @out)
28
- @cli.stub!(:require)
29
-
30
- @cli.execute!(Object.new.extend(StepMother))
31
-
32
- @out.string.should include('example.rb')
33
- end
34
-
35
26
  it "should show feature files parsed" do
36
27
  @cli = Main.new(%w{--verbose example.feature}, @out)
37
28
  @cli.stub!(:require)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aslakhellesoy-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.94.1
4
+ version: 0.3.95
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aslak Helles\xC3\xB8y"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-10 00:00:00 -07:00
12
+ date: 2009-08-13 00:00:00 -07:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -388,6 +388,7 @@ files:
388
388
  - lib/cucumber/cli/main.rb
389
389
  - lib/cucumber/cli/options.rb
390
390
  - lib/cucumber/cli/profile_loader.rb
391
+ - lib/cucumber/cli/rb_step_def_loader.rb
391
392
  - lib/cucumber/core_ext/exception.rb
392
393
  - lib/cucumber/core_ext/instance_exec.rb
393
394
  - lib/cucumber/core_ext/proc.rb