spork 0.9.0.rc5 → 0.9.0.rc6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -4
- data/README.rdoc +3 -1
- data/features/gemfiles/rails3.0/Gemfile +11 -7
- data/features/gemfiles/rails3.0/Gemfile.lock +81 -77
- data/features/rails_delayed_loading_workarounds.feature +27 -0
- data/features/support/bundler_helpers.rb +1 -1
- data/lib/spork.rb +5 -5
- data/lib/spork/diagnoser.rb +1 -1
- data/lib/spork/gem_helpers.rb +34 -0
- data/spec/spork/diagnoser_spec.rb +5 -5
- metadata +4 -18
data/Gemfile
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
source :gemcutter
|
2
|
-
gem 'cucumber', '0.
|
3
|
-
gem
|
4
|
-
gem "rspec", "2.0.0.beta.20"
|
2
|
+
gem 'cucumber', '0.10.2'
|
3
|
+
gem "rspec", "2.5.0"
|
5
4
|
gem 'rake'
|
6
|
-
|
5
|
+
|
6
|
+
if RUBY_VERSION =~ /^1\.9/
|
7
|
+
gem 'ruby-debug19'
|
8
|
+
else
|
9
|
+
gem 'ruby-debug'
|
10
|
+
end
|
data/README.rdoc
CHANGED
@@ -68,6 +68,8 @@ Initially, you may find that a few files don't reload automatically. This is be
|
|
68
68
|
|
69
69
|
It will output a lot of stuff. At the top you'll find a summary of all project files loaded. Down below, the stack trace for each file (how it got loaded). Spork hooks into Rails and does some magic (TM) to prevent ApplicationController observers, etc from pre-loading. Similar hooks for other ruby frameworks may come as support demands.
|
70
70
|
|
71
|
+
Some project changes will require a spork restart, and you shouldn't expect them to not (IE: modifying your project gem dependencies or core application config). Any file that is loaded during Spork start-up will be cached until Spork is restarted. You can restart spork by sending a USR2 signal to the server process. This could be automated with a gem such as Kicker (https://github.com/alloy/kicker). Since a native hook is required for each operating system to efficiently watch for filesystem changes, automatic restarting has not been built into Spork.
|
72
|
+
|
71
73
|
You may find this wiki page useful for common ways to battle a variety of common pre-loading issues: http://github.com/timcharper/spork/wiki/Spork.trap_method-Jujutsu
|
72
74
|
|
73
75
|
== Running specs over Spork
|
@@ -82,7 +84,7 @@ To run from the command line, use:
|
|
82
84
|
|
83
85
|
rspec --drb spec/lib/my_spec.rb
|
84
86
|
|
85
|
-
Or, you could add the following flag to your +spec.opts+ file.
|
87
|
+
Or, you could add the following flag to your +spec.opts+ (or +.rspec+ depending on your version of rspec) file.
|
86
88
|
|
87
89
|
--drb
|
88
90
|
|
@@ -1,10 +1,14 @@
|
|
1
1
|
source :gemcutter
|
2
2
|
gem 'sqlite3-ruby', '1.2.5'
|
3
|
-
gem 'cucumber', '0.
|
4
|
-
gem 'cucumber-rails', '0.
|
5
|
-
gem "
|
6
|
-
gem
|
7
|
-
gem '
|
8
|
-
|
9
|
-
|
3
|
+
gem 'cucumber', '0.10.2'
|
4
|
+
gem 'cucumber-rails', '0.4.1'
|
5
|
+
gem "rspec", "2.5.0"
|
6
|
+
gem 'rspec-rails', "2.5.0"
|
7
|
+
gem 'rails', '3.0.7'
|
8
|
+
|
9
|
+
if RUBY_VERSION =~ /^1\.9/
|
10
|
+
gem 'ruby-debug19'
|
11
|
+
else
|
12
|
+
gem 'ruby-debug', '>= 0.10.3'
|
13
|
+
end
|
10
14
|
gem 'spork', :path => File.expand_path("../../..", File.dirname(__FILE__))
|
@@ -7,110 +7,114 @@ GEM
|
|
7
7
|
remote: http://rubygems.org/
|
8
8
|
specs:
|
9
9
|
abstract (1.0.0)
|
10
|
-
actionmailer (3.0.
|
11
|
-
actionpack (= 3.0.
|
12
|
-
mail (~> 2.2.
|
13
|
-
actionpack (3.0.
|
14
|
-
activemodel (= 3.0.
|
15
|
-
activesupport (= 3.0.
|
10
|
+
actionmailer (3.0.7)
|
11
|
+
actionpack (= 3.0.7)
|
12
|
+
mail (~> 2.2.15)
|
13
|
+
actionpack (3.0.7)
|
14
|
+
activemodel (= 3.0.7)
|
15
|
+
activesupport (= 3.0.7)
|
16
16
|
builder (~> 2.1.2)
|
17
17
|
erubis (~> 2.6.6)
|
18
|
-
i18n (~> 0.
|
18
|
+
i18n (~> 0.5.0)
|
19
19
|
rack (~> 1.2.1)
|
20
|
-
rack-mount (~> 0.6.
|
21
|
-
rack-test (~> 0.5.
|
20
|
+
rack-mount (~> 0.6.14)
|
21
|
+
rack-test (~> 0.5.7)
|
22
22
|
tzinfo (~> 0.3.23)
|
23
|
-
activemodel (3.0.
|
24
|
-
activesupport (= 3.0.
|
23
|
+
activemodel (3.0.7)
|
24
|
+
activesupport (= 3.0.7)
|
25
25
|
builder (~> 2.1.2)
|
26
|
-
i18n (~> 0.
|
27
|
-
activerecord (3.0.
|
28
|
-
activemodel (= 3.0.
|
29
|
-
activesupport (= 3.0.
|
30
|
-
arel (~>
|
26
|
+
i18n (~> 0.5.0)
|
27
|
+
activerecord (3.0.7)
|
28
|
+
activemodel (= 3.0.7)
|
29
|
+
activesupport (= 3.0.7)
|
30
|
+
arel (~> 2.0.2)
|
31
31
|
tzinfo (~> 0.3.23)
|
32
|
-
activeresource (3.0.
|
33
|
-
activemodel (= 3.0.
|
34
|
-
activesupport (= 3.0.
|
35
|
-
activesupport (3.0.
|
36
|
-
arel (
|
37
|
-
activesupport (~> 3.0.0)
|
32
|
+
activeresource (3.0.7)
|
33
|
+
activemodel (= 3.0.7)
|
34
|
+
activesupport (= 3.0.7)
|
35
|
+
activesupport (3.0.7)
|
36
|
+
arel (2.0.9)
|
38
37
|
builder (2.1.2)
|
39
|
-
columnize (0.3.
|
40
|
-
cucumber (0.
|
41
|
-
builder (
|
42
|
-
diff-lcs (
|
43
|
-
gherkin (
|
44
|
-
|
45
|
-
term-ansicolor (
|
46
|
-
cucumber-rails (0.
|
47
|
-
cucumber (>= 0.
|
38
|
+
columnize (0.3.2)
|
39
|
+
cucumber (0.10.2)
|
40
|
+
builder (>= 2.1.2)
|
41
|
+
diff-lcs (>= 1.1.2)
|
42
|
+
gherkin (>= 2.3.5)
|
43
|
+
json (>= 1.4.6)
|
44
|
+
term-ansicolor (>= 1.0.5)
|
45
|
+
cucumber-rails (0.4.1)
|
46
|
+
cucumber (>= 0.10.1)
|
47
|
+
nokogiri (>= 1.4.4)
|
48
|
+
rack-test (>= 0.5.7)
|
48
49
|
diff-lcs (1.1.2)
|
49
50
|
erubis (2.6.6)
|
50
51
|
abstract (>= 1.0.0)
|
51
|
-
gherkin (2.
|
52
|
-
|
53
|
-
i18n (0.
|
54
|
-
|
52
|
+
gherkin (2.3.7)
|
53
|
+
json (>= 1.4.6)
|
54
|
+
i18n (0.5.0)
|
55
|
+
json (1.5.1)
|
55
56
|
linecache (0.43)
|
56
|
-
mail (2.2.
|
57
|
+
mail (2.2.19)
|
57
58
|
activesupport (>= 2.3.6)
|
58
|
-
|
59
|
-
|
59
|
+
i18n (>= 0.4.0)
|
60
|
+
mime-types (~> 1.16)
|
61
|
+
treetop (~> 1.4.8)
|
60
62
|
mime-types (1.16)
|
63
|
+
nokogiri (1.4.4)
|
61
64
|
polyglot (0.3.1)
|
62
|
-
rack (1.2.
|
63
|
-
rack-mount (0.6.
|
65
|
+
rack (1.2.2)
|
66
|
+
rack-mount (0.6.14)
|
64
67
|
rack (>= 1.0.0)
|
65
|
-
rack-test (0.5.
|
68
|
+
rack-test (0.5.7)
|
66
69
|
rack (>= 1.0)
|
67
|
-
rails (3.0.
|
68
|
-
actionmailer (= 3.0.
|
69
|
-
actionpack (= 3.0.
|
70
|
-
activerecord (= 3.0.
|
71
|
-
activeresource (= 3.0.
|
72
|
-
activesupport (= 3.0.
|
73
|
-
bundler (~> 1.0
|
74
|
-
railties (= 3.0.
|
75
|
-
railties (3.0.
|
76
|
-
actionpack (= 3.0.
|
77
|
-
activesupport (= 3.0.
|
78
|
-
rake (>= 0.8.
|
79
|
-
thor (~> 0.14.
|
70
|
+
rails (3.0.7)
|
71
|
+
actionmailer (= 3.0.7)
|
72
|
+
actionpack (= 3.0.7)
|
73
|
+
activerecord (= 3.0.7)
|
74
|
+
activeresource (= 3.0.7)
|
75
|
+
activesupport (= 3.0.7)
|
76
|
+
bundler (~> 1.0)
|
77
|
+
railties (= 3.0.7)
|
78
|
+
railties (3.0.7)
|
79
|
+
actionpack (= 3.0.7)
|
80
|
+
activesupport (= 3.0.7)
|
81
|
+
rake (>= 0.8.7)
|
82
|
+
thor (~> 0.14.4)
|
80
83
|
rake (0.8.7)
|
81
|
-
rspec (2.
|
82
|
-
rspec-core (
|
83
|
-
rspec-expectations (
|
84
|
-
rspec-mocks (
|
85
|
-
rspec-core (2.
|
86
|
-
rspec-expectations (2.
|
87
|
-
diff-lcs (
|
88
|
-
rspec-mocks (2.
|
89
|
-
rspec-rails (2.
|
90
|
-
|
91
|
-
|
84
|
+
rspec (2.5.0)
|
85
|
+
rspec-core (~> 2.5.0)
|
86
|
+
rspec-expectations (~> 2.5.0)
|
87
|
+
rspec-mocks (~> 2.5.0)
|
88
|
+
rspec-core (2.5.2)
|
89
|
+
rspec-expectations (2.5.0)
|
90
|
+
diff-lcs (~> 1.1.2)
|
91
|
+
rspec-mocks (2.5.0)
|
92
|
+
rspec-rails (2.5.0)
|
93
|
+
actionpack (~> 3.0)
|
94
|
+
activesupport (~> 3.0)
|
95
|
+
railties (~> 3.0)
|
96
|
+
rspec (~> 2.5.0)
|
97
|
+
ruby-debug (0.10.4)
|
92
98
|
columnize (>= 0.1)
|
93
|
-
ruby-debug-base (~> 0.10.
|
94
|
-
ruby-debug-base (0.10.
|
99
|
+
ruby-debug-base (~> 0.10.4.0)
|
100
|
+
ruby-debug-base (0.10.4)
|
95
101
|
linecache (>= 0.3)
|
96
102
|
sqlite3-ruby (1.2.5)
|
97
103
|
term-ansicolor (1.0.5)
|
98
|
-
thor (0.14.
|
99
|
-
treetop (1.4.
|
104
|
+
thor (0.14.6)
|
105
|
+
treetop (1.4.9)
|
100
106
|
polyglot (>= 0.3.1)
|
101
|
-
|
102
|
-
tzinfo (0.3.23)
|
107
|
+
tzinfo (0.3.27)
|
103
108
|
|
104
109
|
PLATFORMS
|
105
110
|
ruby
|
106
111
|
|
107
112
|
DEPENDENCIES
|
108
|
-
cucumber (= 0.
|
109
|
-
cucumber-rails (= 0.
|
110
|
-
|
111
|
-
|
112
|
-
rspec (= 2.
|
113
|
-
rspec-rails (= 2.0.0.beta.20)
|
113
|
+
cucumber (= 0.10.2)
|
114
|
+
cucumber-rails (= 0.4.1)
|
115
|
+
rails (= 3.0.7)
|
116
|
+
rspec (= 2.5.0)
|
117
|
+
rspec-rails (= 2.5.0)
|
114
118
|
ruby-debug (>= 0.10.3)
|
115
119
|
spork!
|
116
120
|
sqlite3-ruby (= 1.2.5)
|
@@ -67,6 +67,33 @@ Feature: Rails Delayed Work arounds
|
|
67
67
|
"""
|
68
68
|
Original View
|
69
69
|
"""
|
70
|
+
Scenario: respecting custom autoload paths
|
71
|
+
Given the following code appears in "config/application.rb" after /class Application < Rails::Application/:
|
72
|
+
"""
|
73
|
+
config.autoload_paths << 'app/models/non_standard'
|
74
|
+
"""
|
75
|
+
|
76
|
+
And a file named "app/models/non_standard/boogie.rb" with:
|
77
|
+
"""
|
78
|
+
class Boogie
|
79
|
+
def boogie
|
80
|
+
'Boogie Robots!'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
"""
|
84
|
+
And a file named "spec/models/non_standard/boogie_spec.rb" with:
|
85
|
+
"""
|
86
|
+
describe Boogie do
|
87
|
+
it 'knows how to boogie' do
|
88
|
+
Boogie.new.boogie.should include('Boogie')
|
89
|
+
puts 'BOOGIE!!!'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
"""
|
93
|
+
When I fire up a spork instance with "spork rspec"
|
94
|
+
And I run rspec --drb spec/models/non_standard/boogie_spec.rb
|
95
|
+
Then the output should contain "BOOGIE!!!"
|
96
|
+
|
70
97
|
Scenario: within a view rendered by a controller, calling helper methods from an included module in ApplicationHelper
|
71
98
|
Given a file named "spec/controllers/users_controller_spec.rb" with:
|
72
99
|
"""
|
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.
|
@@ -102,12 +103,11 @@ module Spork
|
|
102
103
|
end
|
103
104
|
end
|
104
105
|
|
106
|
+
# This method is used to auto-discover peer plugins such as spork-testunit.
|
105
107
|
def other_spork_gem_load_paths
|
106
|
-
@other_spork_gem_load_paths ||= (
|
107
|
-
|
108
|
-
|
109
|
-
end
|
110
|
-
)
|
108
|
+
@other_spork_gem_load_paths ||= Spork::GemHelpers.latest_load_paths.grep(/spork/).select do |g|
|
109
|
+
not g.match(%r{/spork-[0-9\-.]+/lib}) # don't include other versions of spork
|
110
|
+
end
|
111
111
|
end
|
112
112
|
|
113
113
|
private
|
data/lib/spork/diagnoser.rb
CHANGED
@@ -48,7 +48,7 @@ class Spork::Diagnoser
|
|
48
48
|
|
49
49
|
# Uninstall the hook. Generally useful only for testing the Diagnoser.
|
50
50
|
def remove_hook!
|
51
|
-
return unless Kernel.private_instance_methods.include?(
|
51
|
+
return unless Kernel.private_instance_methods.map(&:to_sym).include?(:require_without_diagnoser)
|
52
52
|
Kernel.class_eval do
|
53
53
|
alias :require :require_without_diagnoser
|
54
54
|
alias :load :load_without_diagnoser
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Spork::GemHelpers
|
2
|
+
extend self
|
3
|
+
|
4
|
+
class GemPath
|
5
|
+
attr_reader :name, :version, :path, :version_numbers
|
6
|
+
include Comparable
|
7
|
+
def initialize(p)
|
8
|
+
@path = p
|
9
|
+
@name, @version = File.basename(p).scan(/^(.+?)-([^-]+)$/).flatten
|
10
|
+
@version_numbers = @version.split(/[^0-9]+/).map(&:to_i)
|
11
|
+
end
|
12
|
+
|
13
|
+
def <=>(other)
|
14
|
+
raise "Not comparable gem paths ('#{name}' is not '#{other.name}')" unless name == other.name
|
15
|
+
@version_numbers <=> other.version_numbers
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def latest_load_paths
|
20
|
+
if defined?(Bundler)
|
21
|
+
$LOAD_PATH.uniq
|
22
|
+
else
|
23
|
+
Dir["{#{Gem.paths.path.join(',')}}" + "/gems/*"].inject({}) do |h,f|
|
24
|
+
gem_path = GemPath.new(f)
|
25
|
+
if h[gem_path.name]
|
26
|
+
h[gem_path.name] = gem_path if gem_path > h[gem_path.name]
|
27
|
+
else
|
28
|
+
h[gem_path.name] = gem_path
|
29
|
+
end
|
30
|
+
h
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -13,7 +13,7 @@ describe Spork::Diagnoser do
|
|
13
13
|
if filename
|
14
14
|
File.open(filename, 'wb') { |f| f << contents }
|
15
15
|
Spork::Diagnoser.install_hook!
|
16
|
-
require filename
|
16
|
+
require "./#{filename}"
|
17
17
|
end
|
18
18
|
yield if block_given?
|
19
19
|
end
|
@@ -79,11 +79,11 @@ describe Spork::Diagnoser do
|
|
79
79
|
|
80
80
|
it "filters backtrace beyond the last line matching the entry point" do
|
81
81
|
Spork::Diagnoser.install_hook!("test_filter/environment.rb")
|
82
|
-
create_file("test_filter/environment.rb", "require 'test_filter/app.rb'")
|
83
|
-
create_file("test_filter/app.rb", "require 'test_filter/my_model.rb'")
|
82
|
+
create_file("test_filter/environment.rb", "require './test_filter/app.rb'")
|
83
|
+
create_file("test_filter/app.rb", "require './test_filter/my_model.rb'")
|
84
84
|
create_file("test_filter/my_model.rb", "'my model here'")
|
85
85
|
in_current_dir do
|
86
|
-
require 'test_filter/environment.rb'
|
86
|
+
require './test_filter/environment.rb'
|
87
87
|
end
|
88
88
|
f = Spork::Diagnoser.loaded_files
|
89
89
|
f[f.keys.grep(/app.rb/).first].last.should include('test_filter/environment.rb')
|
@@ -93,7 +93,7 @@ describe Spork::Diagnoser do
|
|
93
93
|
|
94
94
|
describe ".output_results" do
|
95
95
|
it "outputs the results relative to the current directory" do
|
96
|
-
Spork::Diagnoser.loaded_files["/project_path/lib/file.rb"] = "/project_path/lib/parent_file.rb:35"
|
96
|
+
Spork::Diagnoser.loaded_files["/project_path/lib/file.rb"] = ["/project_path/lib/parent_file.rb:35"]
|
97
97
|
Dir.stub!(:pwd).and_return("/project_path")
|
98
98
|
out = StringIO.new
|
99
99
|
Spork::Diagnoser.output_results(out)
|
metadata
CHANGED
@@ -1,15 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 15424143
|
5
4
|
prerelease: 6
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 9
|
9
|
-
- 0
|
10
|
-
- rc
|
11
|
-
- 5
|
12
|
-
version: 0.9.0.rc5
|
5
|
+
version: 0.9.0.rc6
|
13
6
|
platform: ruby
|
14
7
|
authors:
|
15
8
|
- Tim Harper
|
@@ -18,8 +11,7 @@ autorequire:
|
|
18
11
|
bindir: bin
|
19
12
|
cert_chain: []
|
20
13
|
|
21
|
-
date: 2011-
|
22
|
-
default_executable: spork
|
14
|
+
date: 2011-05-06 00:00:00 Z
|
23
15
|
dependencies: []
|
24
16
|
|
25
17
|
description: A forking Drb spec server
|
@@ -45,6 +37,7 @@ files:
|
|
45
37
|
- lib/spork/ext/rails-reloader.rb
|
46
38
|
- lib/spork/ext/ruby-debug.rb
|
47
39
|
- lib/spork/forker.rb
|
40
|
+
- lib/spork/gem_helpers.rb
|
48
41
|
- lib/spork/run_strategy/forking.rb
|
49
42
|
- lib/spork/run_strategy/magazine/magazine_slave.rb
|
50
43
|
- lib/spork/run_strategy/magazine/magazine_slave_provider.rb
|
@@ -91,7 +84,6 @@ files:
|
|
91
84
|
- spec/support/fake_run_strategy.rb
|
92
85
|
- bin/spork
|
93
86
|
- ext/mkrf_conf.rb
|
94
|
-
has_rdoc: true
|
95
87
|
homepage: http://github.com/timcharper/spork
|
96
88
|
licenses: []
|
97
89
|
|
@@ -106,23 +98,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
98
|
requirements:
|
107
99
|
- - ">="
|
108
100
|
- !ruby/object:Gem::Version
|
109
|
-
hash: 3
|
110
|
-
segments:
|
111
|
-
- 0
|
112
101
|
version: "0"
|
113
102
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
103
|
none: false
|
115
104
|
requirements:
|
116
105
|
- - ">="
|
117
106
|
- !ruby/object:Gem::Version
|
118
|
-
hash: 3
|
119
|
-
segments:
|
120
|
-
- 0
|
121
107
|
version: "0"
|
122
108
|
requirements: []
|
123
109
|
|
124
110
|
rubyforge_project: spork
|
125
|
-
rubygems_version: 1.
|
111
|
+
rubygems_version: 1.8.1
|
126
112
|
signing_key:
|
127
113
|
specification_version: 3
|
128
114
|
summary: spork
|