spork 1.0.0rc1-x86-mswin32 → 1.0.0rc2-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,7 +31,7 @@ Given /^the following code appears in "([^\"]*)" after \/([^\/]*)\/:$/ do |file_
31
31
  end
32
32
  end
33
33
 
34
- When /^I run (spork|rspec|cucumber)(| .*)$/ do |command, args|
34
+ When /^I run (spork|rspec|spec|cucumber)(| .*)$/ do |command, args|
35
35
  run("#{command} #{args}")
36
36
  end
37
37
 
data/lib/spork.rb CHANGED
@@ -11,6 +11,7 @@ module Spork
11
11
  autoload :Runner, (LIBDIR + 'spork/runner').to_s
12
12
  autoload :Forker, (LIBDIR + 'spork/forker').to_s
13
13
  autoload :Diagnoser, (LIBDIR + 'spork/diagnoser').to_s
14
+ autoload :GemHelpers, (LIBDIR + 'spork/gem_helpers').to_s
14
15
 
15
16
  class << self
16
17
  # Run a block, during prefork mode. By default, if prefork is called twice in the same file and line number, the supplied block will only be ran once.
@@ -96,8 +97,8 @@ module Spork
96
97
  trap_method((class << klass; self; end), method_name)
97
98
  end
98
99
 
99
- def detect_and_require(subfolder)
100
- Gem.find_files(subfolder).uniq.each do |path|
100
+ def detect_and_require(pattern)
101
+ GemHelpers.find_files_using_latest_spec(pattern).uniq.each do |path|
101
102
  next if path.match(/_spec\.rb/)
102
103
  require path
103
104
  end
@@ -0,0 +1,22 @@
1
+ module Spork::GemHelpers
2
+ extend self
3
+
4
+ def latest_specs
5
+ Gem::Specification.inject({}) do |h, spec|
6
+ h[spec.name] = spec if h[spec.name].nil? || (spec.version > h[spec.name].version)
7
+ h
8
+ end.values
9
+ end
10
+
11
+ def find_files_using_latest_spec(pattern)
12
+ case
13
+ when defined?(Bundler)
14
+ Gem.find_files(pattern)
15
+ when Gem.respond_to?(:find_files)
16
+ latest_specs.map { |spec| spec.matches_for_glob(pattern) }.flatten
17
+ else
18
+ STDERR.puts "No mechanism available to scan for other gems implementing Spork extensions."
19
+ return []
20
+ end
21
+ end
22
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0rc1
4
+ version: 1.0.0rc2
5
5
  prerelease: 5
6
6
  platform: x86-mswin32
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-01-28 00:00:00.000000000Z
13
+ date: 2012-02-08 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: win32-process
17
- requirement: &70316617432020 !ruby/object:Gem::Requirement
17
+ requirement: &70287441826420 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,7 +22,7 @@ dependencies:
22
22
  version: '0'
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70316617432020
25
+ version_requirements: *70287441826420
26
26
  description: A forking Drb spec server
27
27
  email:
28
28
  - timcharper+spork@gmail.com
@@ -42,6 +42,7 @@ files:
42
42
  - lib/spork/diagnoser.rb
43
43
  - lib/spork/ext/ruby-debug.rb
44
44
  - lib/spork/forker.rb
45
+ - lib/spork/gem_helpers.rb
45
46
  - lib/spork/run_strategy/forking.rb
46
47
  - lib/spork/run_strategy/magazine/magazine_slave.rb
47
48
  - lib/spork/run_strategy/magazine/magazine_slave_provider.rb