spork 0.9.2 → 1.0.0rc0
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/Gemfile +3 -1
- data/README.rdoc +22 -18
- data/features/diagnostic_mode.feature +1 -2
- data/features/support/bundler_helpers.rb +2 -8
- data/features/support/env.rb +7 -94
- data/features/support/spork_world.rb +84 -0
- data/features/unknown_app_framework.feature +5 -7
- data/lib/spork.rb +3 -10
- data/lib/spork/app_framework.rb +16 -30
- data/lib/spork/app_framework/unknown.rb +5 -1
- data/lib/spork/diagnoser.rb +1 -1
- data/lib/spork/run_strategy/magazine.rb +0 -0
- data/lib/spork/run_strategy/magazine/magazine_slave.rb +0 -0
- data/lib/spork/run_strategy/magazine/magazine_slave_provider.rb +0 -0
- data/lib/spork/run_strategy/magazine/ring_server.rb +0 -0
- data/lib/spork/runner.rb +1 -1
- data/lib/spork/test/cucumber_helpers.rb +5 -0
- data/lib/spork/test/test_helpers.rb +2 -0
- data/lib/spork/test_framework.rb +9 -9
- data/spec/spec_helper.rb +7 -88
- data/spec/spork/app_framework_spec.rb +0 -7
- data/spec/spork/diagnoser_spec.rb +0 -1
- data/spec/spork/test_framework_spec.rb +3 -3
- data/spec/support/fake_framework.rb +3 -1
- data/spec/support/should_include_a_string_like.rb +31 -0
- data/spec/support/test_io_streams.rb +17 -0
- data/spec/support/tmp_project_helpers.rb +30 -0
- metadata +24 -33
- data/assets/bootstrap.rb +0 -49
- data/features/cucumber_rails_integration.feature +0 -107
- data/features/gemfiles/rails3.0/Gemfile +0 -14
- data/features/gemfiles/rails3.0/Gemfile.lock +0 -139
- data/features/rails_delayed_loading_workarounds.feature +0 -177
- data/features/rspec_rails_integration.feature +0 -92
- data/features/steps/rails_steps.rb +0 -67
- data/lib/spork/app_framework/padrino.rb +0 -22
- data/lib/spork/app_framework/rails.rb +0 -82
- data/lib/spork/ext/rails-reloader.rb +0 -14
- data/lib/spork/gem_helpers.rb +0 -38
- data/spec/spork/app_framework/rails_spec.rb +0 -22
data/lib/spork/diagnoser.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/spork/runner.rb
CHANGED
@@ -56,7 +56,7 @@ module Spork
|
|
56
56
|
def run
|
57
57
|
return false unless test_framework = find_test_framework
|
58
58
|
ENV["DRB"] = 'true'
|
59
|
-
@error.puts "Using #{test_framework.short_name}"
|
59
|
+
@error.puts "Using #{test_framework.short_name}, #{test_framework.app_framework.short_name}"
|
60
60
|
@error.flush
|
61
61
|
|
62
62
|
case
|
@@ -0,0 +1,5 @@
|
|
1
|
+
SPORK_CUCUMBER_DIR = File.expand_path( "../../../features/", File.dirname(__FILE__))
|
2
|
+
require("#{SPORK_CUCUMBER_DIR}/support/background_job.rb")
|
3
|
+
require("#{SPORK_CUCUMBER_DIR}/support/spork_world.rb")
|
4
|
+
require("#{SPORK_CUCUMBER_DIR}/support/bundler_helpers.rb")
|
5
|
+
Dir.glob("#{SPORK_CUCUMBER_DIR}/steps/**/*.rb").each { |f| load f }
|
data/lib/spork/test_framework.rb
CHANGED
@@ -122,16 +122,16 @@ class Spork::TestFramework
|
|
122
122
|
stderr.puts "#{helper_file} has not been bootstrapped. Run spork --bootstrap to do so."
|
123
123
|
stderr.flush
|
124
124
|
|
125
|
-
if
|
126
|
-
stderr.puts "I can't do anything for you by default for the framework you're using: #{
|
125
|
+
if app_framework.bootstrap_required?
|
126
|
+
stderr.puts "I can't do anything for you by default for the app framework you're using: #{app_framework.short_name}.\nYou must bootstrap #{helper_file} to continue."
|
127
127
|
stderr.flush
|
128
128
|
return false
|
129
129
|
else
|
130
|
-
load(
|
130
|
+
load(app_framework.entry_point)
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
-
|
134
|
+
app_framework.preload do
|
135
135
|
if bootstrapped?
|
136
136
|
stderr.puts "Loading Spork.prefork block..."
|
137
137
|
stderr.flush
|
@@ -147,21 +147,21 @@ class Spork::TestFramework
|
|
147
147
|
end
|
148
148
|
|
149
149
|
def entry_point
|
150
|
-
bootstrapped? ? helper_file :
|
150
|
+
bootstrapped? ? helper_file : app_framework.entry_point
|
151
151
|
end
|
152
152
|
|
153
153
|
def default_port
|
154
154
|
self.class.default_port
|
155
155
|
end
|
156
156
|
|
157
|
+
def app_framework
|
158
|
+
@app_framework ||= Spork::AppFramework.detect_framework
|
159
|
+
end
|
160
|
+
|
157
161
|
protected
|
158
162
|
def self.inherited(subclass)
|
159
163
|
@@supported_test_frameworks << subclass
|
160
164
|
end
|
161
|
-
|
162
|
-
def framework
|
163
|
-
@framework ||= Spork::AppFramework.detect_framework
|
164
|
-
end
|
165
165
|
end
|
166
166
|
|
167
167
|
Spork.detect_and_require('spork/test_framework/*.rb')
|
data/spec/spec_helper.rb
CHANGED
@@ -6,102 +6,21 @@ require 'stringio'
|
|
6
6
|
require 'fileutils'
|
7
7
|
require 'rspec'
|
8
8
|
|
9
|
+
Dir.glob("#{File.dirname(__FILE__)}/support/*.rb").each { |f| require(f) }
|
10
|
+
|
9
11
|
RSpec.configure do |config|
|
12
|
+
include(TmpProjectHelpers)
|
13
|
+
|
10
14
|
config.before(:each) do
|
11
|
-
|
12
|
-
|
15
|
+
TestIOStreams.set_streams(StringIO.new, StringIO.new)
|
16
|
+
|
13
17
|
@current_dir = nil
|
14
|
-
|
15
|
-
|
16
|
-
config.after(:each) do
|
17
|
-
FileUtils.rm_rf(SPEC_TMP_DIR) if File.directory?(SPEC_TMP_DIR)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def create_file(filename, contents)
|
22
|
-
FileUtils.mkdir_p(SPEC_TMP_DIR) unless File.directory?(SPEC_TMP_DIR)
|
23
|
-
|
24
|
-
in_current_dir do
|
25
|
-
FileUtils.mkdir_p(File.dirname(filename))
|
26
|
-
File.open(filename, 'wb') { |f| f << contents }
|
18
|
+
clear_tmp_dir
|
27
19
|
end
|
28
20
|
end
|
29
21
|
|
30
|
-
def create_helper_file(test_framework = FakeFramework)
|
31
|
-
create_file(test_framework.helper_file, "# stub spec helper file")
|
32
|
-
end
|
33
|
-
|
34
|
-
def in_current_dir(&block)
|
35
|
-
Dir.chdir(current_dir, &block)
|
36
|
-
end
|
37
|
-
|
38
|
-
def current_dir
|
39
|
-
@current_dir ||= SPEC_TMP_DIR
|
40
|
-
end
|
41
|
-
|
42
|
-
def change_current_dir(sub_path)
|
43
|
-
@current_dir = File.expand_path(sub_path, SPEC_TMP_DIR)
|
44
|
-
end
|
45
22
|
|
46
23
|
def windows?
|
47
24
|
ENV['OS'] == 'Windows_NT'
|
48
25
|
end
|
49
26
|
|
50
|
-
|
51
|
-
module RSpec
|
52
|
-
module Matchers
|
53
|
-
class IncludeAStringLike
|
54
|
-
def initialize(substring_or_regex)
|
55
|
-
case substring_or_regex
|
56
|
-
when String
|
57
|
-
@regex = Regexp.new(Regexp.escape(substring_or_regex))
|
58
|
-
when Regexp
|
59
|
-
@regex = substring_or_regex
|
60
|
-
else
|
61
|
-
raise ArgumentError, "don't know what to do with the #{substring_or_regex.class} you provided"
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def matches?(list_of_strings)
|
66
|
-
@list_of_strings = list_of_strings
|
67
|
-
@list_of_strings.any? { |s| s =~ @regex }
|
68
|
-
end
|
69
|
-
def failure_message
|
70
|
-
"#{@list_of_strings.inspect} expected to include a string like #{@regex.inspect}"
|
71
|
-
end
|
72
|
-
def negative_failure_message
|
73
|
-
"#{@list_of_strings.inspect} expected to not include a string like #{@regex.inspect}, but did"
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
def include_a_string_like(substring_or_regex)
|
78
|
-
IncludeAStringLike.new(substring_or_regex)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
module Spork::TestIOStreams
|
84
|
-
def self.included(klass)
|
85
|
-
klass.send(:extend, ::Spork::TestIOStreams::ClassMethods)
|
86
|
-
end
|
87
|
-
|
88
|
-
def stderr
|
89
|
-
self.class.stderr
|
90
|
-
end
|
91
|
-
|
92
|
-
def stdout
|
93
|
-
self.class.stdout
|
94
|
-
end
|
95
|
-
|
96
|
-
module ClassMethods
|
97
|
-
def stderr
|
98
|
-
$test_stderr
|
99
|
-
end
|
100
|
-
|
101
|
-
def stdout
|
102
|
-
$test_stdout
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
Dir.glob(File.dirname(__FILE__) + "/support/*.rb").each { |f| require(f) }
|
@@ -2,13 +2,6 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Spork::AppFramework do
|
4
4
|
describe ".detect_framework" do
|
5
|
-
it "detects when rails is installed and available" do
|
6
|
-
create_file("config/environment.rb", "RAILS_GEM_VERSION = '2.1.0'")
|
7
|
-
in_current_dir do
|
8
|
-
Spork::AppFramework.detect_framework.short_name.should == "Rails"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
5
|
it "returns Unknown when no framework known detected" do
|
13
6
|
Spork::AppFramework.detect_framework.short_name.should == "Unknown"
|
14
7
|
end
|
@@ -66,9 +66,9 @@ describe Spork::TestFramework do
|
|
66
66
|
create_helper_file
|
67
67
|
@fake.bootstrap
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
TestIOStreams.stderr.string.should include("Bootstrapping")
|
70
|
+
TestIOStreams.stderr.string.should include("Edit")
|
71
|
+
TestIOStreams.stderr.string.should include("favorite text editor")
|
72
72
|
|
73
73
|
File.read(@fake.helper_file).should include(File.read(FakeFramework::BOOTSTRAP_FILE))
|
74
74
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module RSpec
|
2
|
+
module Matchers
|
3
|
+
class IncludeAStringLike
|
4
|
+
def initialize(substring_or_regex)
|
5
|
+
case substring_or_regex
|
6
|
+
when String
|
7
|
+
@regex = Regexp.new(Regexp.escape(substring_or_regex))
|
8
|
+
when Regexp
|
9
|
+
@regex = substring_or_regex
|
10
|
+
else
|
11
|
+
raise ArgumentError, "don't know what to do with the #{substring_or_regex.class} you provided"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def matches?(list_of_strings)
|
16
|
+
@list_of_strings = list_of_strings
|
17
|
+
@list_of_strings.any? { |s| s =~ @regex }
|
18
|
+
end
|
19
|
+
def failure_message
|
20
|
+
"#{@list_of_strings.inspect} expected to include a string like #{@regex.inspect}"
|
21
|
+
end
|
22
|
+
def negative_failure_message
|
23
|
+
"#{@list_of_strings.inspect} expected to not include a string like #{@regex.inspect}, but did"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def include_a_string_like(substring_or_regex)
|
28
|
+
IncludeAStringLike.new(substring_or_regex)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module TestIOStreams
|
2
|
+
def stderr
|
3
|
+
::TestIOStreams.stderr
|
4
|
+
end
|
5
|
+
|
6
|
+
def stdout
|
7
|
+
::TestIOStreams.stdout
|
8
|
+
end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
attr_accessor :stderr, :stdout
|
12
|
+
|
13
|
+
def set_streams(stderr, stdout)
|
14
|
+
self.stderr, self.stdout = stderr, stdout
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module TmpProjectHelpers
|
2
|
+
def clear_tmp_dir
|
3
|
+
FileUtils.rm_rf(SPEC_TMP_DIR) if File.directory?(SPEC_TMP_DIR)
|
4
|
+
end
|
5
|
+
|
6
|
+
def create_file(filename, contents)
|
7
|
+
FileUtils.mkdir_p(SPEC_TMP_DIR) unless File.directory?(SPEC_TMP_DIR)
|
8
|
+
|
9
|
+
in_current_dir do
|
10
|
+
FileUtils.mkdir_p(File.dirname(filename))
|
11
|
+
File.open(filename, 'wb') { |f| f << contents }
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def create_helper_file(test_framework = FakeFramework)
|
16
|
+
create_file(test_framework.helper_file, "# stub spec helper file")
|
17
|
+
end
|
18
|
+
|
19
|
+
def in_current_dir(&block)
|
20
|
+
Dir.chdir(current_dir, &block)
|
21
|
+
end
|
22
|
+
|
23
|
+
def current_dir
|
24
|
+
@current_dir ||= SPEC_TMP_DIR
|
25
|
+
end
|
26
|
+
|
27
|
+
def change_current_dir(sub_path)
|
28
|
+
@current_dir = File.expand_path(sub_path, SPEC_TMP_DIR)
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.0rc0
|
5
|
+
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tim Harper
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-01-22 00:00:00.000000000Z
|
14
14
|
dependencies: []
|
15
15
|
description: A forking Drb spec server
|
16
16
|
email:
|
@@ -25,16 +25,12 @@ files:
|
|
25
25
|
- Gemfile
|
26
26
|
- README.rdoc
|
27
27
|
- MIT-LICENSE
|
28
|
-
- lib/spork/app_framework/padrino.rb
|
29
|
-
- lib/spork/app_framework/rails.rb
|
30
28
|
- lib/spork/app_framework/unknown.rb
|
31
29
|
- lib/spork/app_framework.rb
|
32
30
|
- lib/spork/custom_io_streams.rb
|
33
31
|
- lib/spork/diagnoser.rb
|
34
|
-
- lib/spork/ext/rails-reloader.rb
|
35
32
|
- lib/spork/ext/ruby-debug.rb
|
36
33
|
- lib/spork/forker.rb
|
37
|
-
- lib/spork/gem_helpers.rb
|
38
34
|
- lib/spork/run_strategy/forking.rb
|
39
35
|
- lib/spork/run_strategy/magazine/magazine_slave.rb
|
40
36
|
- lib/spork/run_strategy/magazine/magazine_slave_provider.rb
|
@@ -43,28 +39,13 @@ files:
|
|
43
39
|
- lib/spork/run_strategy.rb
|
44
40
|
- lib/spork/runner.rb
|
45
41
|
- lib/spork/server.rb
|
42
|
+
- lib/spork/test/cucumber_helpers.rb
|
43
|
+
- lib/spork/test/test_helpers.rb
|
46
44
|
- lib/spork/test_framework/cucumber.rb
|
47
45
|
- lib/spork/test_framework/rspec.rb
|
48
46
|
- lib/spork/test_framework.rb
|
49
47
|
- lib/spork.rb
|
50
|
-
- assets/bootstrap.rb
|
51
|
-
- features/at_exit_during_each_run.feature
|
52
|
-
- features/cucumber_rails_integration.feature
|
53
|
-
- features/diagnostic_mode.feature
|
54
|
-
- features/gemfiles/rails3.0/Gemfile
|
55
|
-
- features/gemfiles/rails3.0/Gemfile.lock
|
56
|
-
- features/rails_delayed_loading_workarounds.feature
|
57
|
-
- features/rspec_rails_integration.feature
|
58
|
-
- features/spork_debugger.feature
|
59
|
-
- features/steps/general_steps.rb
|
60
|
-
- features/steps/rails_steps.rb
|
61
|
-
- features/steps/sandbox_steps.rb
|
62
|
-
- features/support/background_job.rb
|
63
|
-
- features/support/bundler_helpers.rb
|
64
|
-
- features/support/env.rb
|
65
|
-
- features/unknown_app_framework.feature
|
66
48
|
- spec/spec_helper.rb
|
67
|
-
- spec/spork/app_framework/rails_spec.rb
|
68
49
|
- spec/spork/app_framework/unknown_spec.rb
|
69
50
|
- spec/spork/app_framework_spec.rb
|
70
51
|
- spec/spork/diagnoser_spec.rb
|
@@ -79,8 +60,21 @@ files:
|
|
79
60
|
- spec/spork_spec.rb
|
80
61
|
- spec/support/fake_framework.rb
|
81
62
|
- spec/support/fake_run_strategy.rb
|
63
|
+
- spec/support/should_include_a_string_like.rb
|
64
|
+
- spec/support/test_io_streams.rb
|
65
|
+
- spec/support/tmp_project_helpers.rb
|
66
|
+
- features/at_exit_during_each_run.feature
|
67
|
+
- features/diagnostic_mode.feature
|
68
|
+
- features/spork_debugger.feature
|
69
|
+
- features/steps/general_steps.rb
|
70
|
+
- features/steps/sandbox_steps.rb
|
71
|
+
- features/support/background_job.rb
|
72
|
+
- features/support/bundler_helpers.rb
|
73
|
+
- features/support/env.rb
|
74
|
+
- features/support/spork_world.rb
|
75
|
+
- features/unknown_app_framework.feature
|
82
76
|
- bin/spork
|
83
|
-
homepage: http://github.com/
|
77
|
+
homepage: http://github.com/sporkrb/spork
|
84
78
|
licenses: []
|
85
79
|
post_install_message:
|
86
80
|
rdoc_options:
|
@@ -101,29 +95,23 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
95
|
- !ruby/object:Gem::Version
|
102
96
|
version: '0'
|
103
97
|
requirements: []
|
104
|
-
rubyforge_project:
|
98
|
+
rubyforge_project:
|
105
99
|
rubygems_version: 1.8.7
|
106
100
|
signing_key:
|
107
101
|
specification_version: 3
|
108
102
|
summary: spork
|
109
103
|
test_files:
|
110
104
|
- features/at_exit_during_each_run.feature
|
111
|
-
- features/cucumber_rails_integration.feature
|
112
105
|
- features/diagnostic_mode.feature
|
113
|
-
- features/gemfiles/rails3.0/Gemfile
|
114
|
-
- features/gemfiles/rails3.0/Gemfile.lock
|
115
|
-
- features/rails_delayed_loading_workarounds.feature
|
116
|
-
- features/rspec_rails_integration.feature
|
117
106
|
- features/spork_debugger.feature
|
118
107
|
- features/steps/general_steps.rb
|
119
|
-
- features/steps/rails_steps.rb
|
120
108
|
- features/steps/sandbox_steps.rb
|
121
109
|
- features/support/background_job.rb
|
122
110
|
- features/support/bundler_helpers.rb
|
123
111
|
- features/support/env.rb
|
112
|
+
- features/support/spork_world.rb
|
124
113
|
- features/unknown_app_framework.feature
|
125
114
|
- spec/spec_helper.rb
|
126
|
-
- spec/spork/app_framework/rails_spec.rb
|
127
115
|
- spec/spork/app_framework/unknown_spec.rb
|
128
116
|
- spec/spork/app_framework_spec.rb
|
129
117
|
- spec/spork/diagnoser_spec.rb
|
@@ -138,4 +126,7 @@ test_files:
|
|
138
126
|
- spec/spork_spec.rb
|
139
127
|
- spec/support/fake_framework.rb
|
140
128
|
- spec/support/fake_run_strategy.rb
|
129
|
+
- spec/support/should_include_a_string_like.rb
|
130
|
+
- spec/support/test_io_streams.rb
|
131
|
+
- spec/support/tmp_project_helpers.rb
|
141
132
|
has_rdoc:
|