spork 1.0.0rc2-x86-mswin32 → 1.0.0rc4-x86-mswin32

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bf84276b846d526b9c44bdcebf1b3e53a4441212
4
+ data.tar.gz: dc63d581fde6cb9b5e88b252edfbe5351063a8ac
5
+ SHA512:
6
+ metadata.gz: aa9500a70e3a522320000ecf0e5f592125870f24e4f98c17c7aa5ff20d923e2ba779b7a8acd541f722317fbe19a14f46440ff4eef2b10cee35de1b78c612cff6
7
+ data.tar.gz: e9f8559eb56aed5a5f2a750651cb025d59629660f440942aa20ed49dc7ce8064c44372db536d0b975ab87bc76b72f09b3e5ab66846dd3f78aefc4e9dfa2efdfa
data/Gemfile CHANGED
@@ -1,12 +1,12 @@
1
- source :gemcutter
1
+ source 'https://rubygems.org'
2
2
  gemspec
3
- gem 'cucumber', '~> 1.0.0'
4
- gem 'rspec', '~> 2.8'
3
+ gem 'cucumber', '~>1.3.2'
4
+ gem 'rspec', '~>2.13.0'
5
5
  gem 'rake'
6
6
  gem "spork", :path => File.expand_path("../", __FILE__)
7
7
 
8
- if RUBY_VERSION =~ /^1\.9/
9
- gem 'ruby-debug19'
8
+ if RUBY_VERSION =~ /^2\.0|^1\.9/
9
+ gem 'debugger'
10
10
  else
11
11
  gem 'ruby-debug'
12
12
  end
@@ -1,4 +1,4 @@
1
- = Spork
1
+ = Spork {<img src="https://travis-ci.org/sporkrb/spork.png" alt="Build Status" />}[https://travis-ci.org/sporkrb/spork]
2
2
 
3
3
  * Repository: http://github.com/sporkrb/spork
4
4
  * Issues: http://github.com/sporkrb/spork/issues
@@ -2,8 +2,10 @@ module BundlerHelpers
2
2
  extend self
3
3
  def install_bundle(dir)
4
4
  Dir.chdir(dir) do
5
- command = "env RUBYOPT= BUNDLE_GEMFILE=Gemfile bundle install"
6
- system(command)
5
+ command = "bundle install --gemfile=#{Dir.pwd}/Gemfile --path=#{Dir.pwd}/.bundle"
6
+ Bundler.with_clean_env do
7
+ system(command)
8
+ end
7
9
  $?.exitstatus
8
10
  end
9
11
  end
@@ -53,7 +53,15 @@ class SporkWorld
53
53
  stderr_file = Tempfile.new('spork')
54
54
  stderr_file.close
55
55
  in_current_dir do
56
- @last_stdout = `env RUBYOPT= bundle exec #{command} 2> #{stderr_file.path}`
56
+ if command.start_with?("rails new")
57
+ @last_stdout = `bundle exec #{command} 2> #{stderr_file.path}`
58
+ else
59
+ gemfile = ENV['BUNDLE_GEMFILE']
60
+ Bundler.with_clean_env do
61
+ ENV['BUNDLE_GEMFILE'] = gemfile
62
+ @last_stdout = `bundle exec #{command} 2> #{stderr_file.path}`
63
+ end
64
+ end
57
65
  @last_exit_status = $?.exitstatus
58
66
  end
59
67
  @last_stderr = IO.read(stderr_file.path)
@@ -61,7 +69,11 @@ class SporkWorld
61
69
 
62
70
  def run_in_background(command)
63
71
  in_current_dir do
64
- @background_job = BackgroundJob.run("env RUBYOPT= bundle exec " + command)
72
+ gemfile = ENV['BUNDLE_GEMFILE']
73
+ Bundler.with_clean_env do
74
+ ENV['BUNDLE_GEMFILE'] = gemfile
75
+ @background_job = BackgroundJob.run("bundle exec " + command)
76
+ end
65
77
  end
66
78
  @background_jobs << @background_job
67
79
  @background_job
@@ -32,7 +32,7 @@ class Spork::Diagnoser
32
32
  end
33
33
  private :require
34
34
 
35
- def load(string)
35
+ def load(string, wrap = false)
36
36
  ::Spork::Diagnoser.add_included_file(string, caller)
37
37
  load_without_diagnoser(string)
38
38
  end
@@ -6,10 +6,10 @@
6
6
  # sleep 3
7
7
  # "success"
8
8
  # end
9
- #
9
+ #
10
10
  # forker.result # => "success"
11
11
  class Spork::Forker
12
-
12
+
13
13
  # Raised if the fork died (was killed) before it sent it's response back.
14
14
  class ForkDiedException < Exception; end
15
15
  def initialize(&block)
@@ -23,35 +23,38 @@ class Spork::Forker
23
23
  master_response = Marshal.load(@child_io)
24
24
  rescue EOFError
25
25
  nil
26
+ rescue SystemExit => e
27
+ puts "Error: exit code #{e.status}" unless e.status == 0
26
28
  rescue Exception => e
27
29
  puts "Exception encountered: #{e.inspect}\nbacktrace:\n#{e.backtrace * %(\n)}"
28
30
  end
29
-
31
+
30
32
  # terminate, skipping any at_exit blocks.
31
33
  exit!(0)
32
34
  end
33
35
  @child_io.close
34
36
  end
35
-
37
+
36
38
  # Wait for the fork to finish running, and then return its return value.
37
39
  #
38
40
  # If the fork was aborted, then result returns nil.
39
41
  def result
40
- return unless running?
42
+ return @result if defined?(@result) || ! running?
41
43
  result_thread = Thread.new do
42
44
  begin
43
45
  @result = Marshal.load(@server_io)
44
46
  Marshal.dump('ACK', @server_io)
45
- rescue ForkDiedException, EOFError
47
+ rescue EOFError
46
48
  @result = nil
49
+ rescue ForkDiedException
47
50
  end
48
51
  end
49
52
  Process.wait(@child_pid)
50
- result_thread.raise(ForkDiedException) if @result.nil?
53
+ result_thread.raise(ForkDiedException) if result_thread.status == "sleep"
51
54
  @child_pid = nil
52
55
  @result
53
56
  end
54
-
57
+
55
58
  # abort the current running fork
56
59
  def abort
57
60
  if running?
@@ -60,7 +63,7 @@ class Spork::Forker
60
63
  true
61
64
  end
62
65
  end
63
-
66
+
64
67
  def running?
65
68
  return false unless @child_pid
66
69
  Process.getpgid(@child_pid)
@@ -2,6 +2,7 @@
2
2
  # to boldly just run test after test
3
3
  # as they come in
4
4
  require 'drb'
5
+ require 'timeout'
5
6
  require 'rinda/ring'
6
7
  if RUBY_PLATFORM =~ /mswin|mingw/ and RUBY_VERSION < '1.9.1'
7
8
  begin
@@ -16,6 +17,7 @@ require 'rubygems' # used for Gem.ruby
16
17
 
17
18
  $:.unshift(File.dirname(__FILE__))
18
19
  require 'magazine/magazine_slave'
20
+ require 'magazine/rinda_ring_finger_patch' if RUBY_VERSION > '1.9.1'
19
21
 
20
22
  class Spork::RunStrategy::Magazine < Spork::RunStrategy
21
23
 
@@ -84,24 +86,21 @@ class Spork::RunStrategy::Magazine < Spork::RunStrategy
84
86
  end
85
87
 
86
88
  def run(argv, stderr, stdout)
87
- DRb.start_service
88
- ts = Rinda::RingFinger.primary
89
- if ts.read_all([:name, :MagazineSlave, nil, nil]).size > 0
90
- print ' <-- take tuple'; stdout.flush
91
- tuple = ts.take([:name, :MagazineSlave, nil, nil])
92
- slave = tuple[2]
93
- id = tuple[3]
94
-
95
- puts "(#{slave.id_num}); slave.run..."; $stdout.flush
96
- begin
97
- slave.run(argv,stderr,stdout)
98
- puts " -- (#{slave.id_num});run done"; $stdout.flush
99
- ensure
100
- restart_slave(id)
101
- end
102
- else
103
- puts '- NO tuple'; $stdout.flush
104
- end
89
+ DRb.start_service
90
+ ts = Rinda::RingFinger.primary
91
+ Timeout.timeout(60) {sleep 0.1 until ts.read_all([:name, :MagazineSlave, nil, nil]).size > 0}
92
+ print ' <-- take tuple'; stdout.flush
93
+ tuple = ts.take([:name, :MagazineSlave, nil, nil])
94
+ slave = tuple[2]
95
+ id = tuple[3]
96
+
97
+ puts "(#{slave.id_num}); slave.run..."; $stdout.flush
98
+ begin
99
+ slave.run(argv,stderr,stdout)
100
+ puts " -- (#{slave.id_num});run done"; $stdout.flush
101
+ ensure
102
+ restart_slave(id)
103
+ end
105
104
  end
106
105
 
107
106
  def restart_slave(id)
@@ -1,6 +1,7 @@
1
1
  # magazine_slave_provider.rb
2
2
  require 'drb'
3
3
  require 'rinda/ring'
4
+ require './rinda_ring_finger_patch' if RUBY_VERSION > '1.9.1'
4
5
  require 'rinda/tuplespace'
5
6
  require './magazine_slave'
6
7
 
@@ -0,0 +1,26 @@
1
+ # Patch for Rinda::RingFinger.primary hanging forever on Ruby 1.9.2 & 1.9.3
2
+ # from http://www.ruby-forum.com/topic/4229908
3
+ require 'rinda/ring'
4
+
5
+ module Rinda
6
+ class RingFinger
7
+ def lookup_ring_any(timeout=5)
8
+ queue = Queue.new
9
+
10
+ Thread.new do
11
+ self.lookup_ring(timeout) do |ts|
12
+ queue.push(ts)
13
+ end
14
+ queue.push(nil)
15
+ end
16
+
17
+ @primary = queue.pop
18
+ raise('RingNotFound') if @primary.nil?
19
+ while it = queue.pop
20
+ @rings.push(it)
21
+ end
22
+
23
+ @primary
24
+ end
25
+ end
26
+ end
@@ -1,5 +1,6 @@
1
1
  # ring_server.rb
2
2
  require 'rinda/ring'
3
+ require './rinda_ring_finger_patch' if RUBY_VERSION > '1.9.1'
3
4
  require 'rinda/tuplespace'
4
5
 
5
6
  DRb.start_service
@@ -22,6 +22,7 @@ module Spork
22
22
  opt.on("-b", "--bootstrap") {|ignore| @options[:bootstrap] = true }
23
23
  opt.on("-d", "--diagnose") {|ignore| @options[:diagnose] = true }
24
24
  opt.on("-h", "--help") {|ignore| @options[:help] = true }
25
+ opt.on("-q", "--quiet") {|ignore| @options[:quiet] = true }
25
26
  opt.on("-p", "--port [PORT]") {|port| @options[:port] = port }
26
27
  non_option_args = args.select { |arg| ! args[0].match(/^-/) }
27
28
  @options[:server_matcher] = non_option_args[0]
@@ -72,7 +73,7 @@ module Spork
72
73
  else
73
74
  run_strategy = Spork::RunStrategy.factory(test_framework)
74
75
  return(false) unless run_strategy.preload
75
- Spork::Server.run(:port => @options[:port] || test_framework.default_port, :run_strategy => run_strategy)
76
+ Spork::Server.run(:port => @options[:port] || test_framework.default_port, :run_strategy => run_strategy, :quiet => @options[:quiet])
76
77
  return true
77
78
  end
78
79
  end
@@ -14,6 +14,7 @@ class Spork::Server
14
14
  def initialize(options = {})
15
15
  @run_strategy = options[:run_strategy]
16
16
  @port = options[:port]
17
+ @quiet = options[:quiet]
17
18
  end
18
19
 
19
20
  def self.run(options = {})
@@ -44,9 +45,9 @@ class Spork::Server
44
45
  #
45
46
  # When implementing a test server, don't override this method: override run_tests instead.
46
47
  def run(argv, stderr, stdout)
47
- puts "Running tests with args #{argv.inspect}..."
48
+ puts "Running tests with args #{argv.inspect}..." unless @quiet
48
49
  result = run_strategy.run(argv, stderr, stdout)
49
- puts "Done.\n\n"
50
+ puts "Done.\n\n" unless @quiet
50
51
  result
51
52
  end
52
53
 
@@ -29,7 +29,12 @@ describe Spork::Forker do
29
29
  it "aborts a fork and returns nil for the result" do
30
30
  started_at = Time.now
31
31
  ended_at = nil
32
- forker = Spork::Forker.new { sleep 5 }
32
+ forker = Spork::Forker.new do
33
+ begin
34
+ sleep 5
35
+ rescue SignalException
36
+ end
37
+ end
33
38
  Thread.new do
34
39
  forker.result.should == nil
35
40
  ended_at = Time.now
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spork
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0rc2
5
- prerelease: 5
4
+ version: 1.0.0rc4
6
5
  platform: x86-mswin32
7
6
  authors:
8
7
  - Tim Harper
@@ -10,19 +9,22 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-02-08 00:00:00.000000000Z
12
+ date: 2013-09-14 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: win32-process
17
- requirement: &70287441826420 !ruby/object:Gem::Requirement
18
- none: false
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  requirements:
20
- - - ! '>='
18
+ - - '>='
21
19
  - !ruby/object:Gem::Version
22
20
  version: '0'
23
21
  type: :runtime
24
22
  prerelease: false
25
- version_requirements: *70287441826420
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
26
28
  description: A forking Drb spec server
27
29
  email:
28
30
  - timcharper+spork@gmail.com
@@ -46,6 +48,7 @@ files:
46
48
  - lib/spork/run_strategy/forking.rb
47
49
  - lib/spork/run_strategy/magazine/magazine_slave.rb
48
50
  - lib/spork/run_strategy/magazine/magazine_slave_provider.rb
51
+ - lib/spork/run_strategy/magazine/rinda_ring_finger_patch.rb
49
52
  - lib/spork/run_strategy/magazine/ring_server.rb
50
53
  - lib/spork/run_strategy/magazine.rb
51
54
  - lib/spork/run_strategy.rb
@@ -89,6 +92,7 @@ files:
89
92
  - bin/spork
90
93
  homepage: http://github.com/sporkrb/spork
91
94
  licenses: []
95
+ metadata: {}
92
96
  post_install_message:
93
97
  rdoc_options:
94
98
  - --main
@@ -96,20 +100,18 @@ rdoc_options:
96
100
  require_paths:
97
101
  - lib
98
102
  required_ruby_version: !ruby/object:Gem::Requirement
99
- none: false
100
103
  requirements:
101
- - - ! '>='
104
+ - - '>='
102
105
  - !ruby/object:Gem::Version
103
106
  version: '0'
104
107
  required_rubygems_version: !ruby/object:Gem::Requirement
105
- none: false
106
108
  requirements:
107
- - - ! '>='
109
+ - - '>='
108
110
  - !ruby/object:Gem::Version
109
111
  version: '0'
110
112
  requirements: []
111
113
  rubyforge_project:
112
- rubygems_version: 1.8.7
114
+ rubygems_version: 2.1.3
113
115
  signing_key:
114
116
  specification_version: 3
115
117
  summary: spork
@@ -142,4 +144,3 @@ test_files:
142
144
  - spec/support/should_include_a_string_like.rb
143
145
  - spec/support/test_io_streams.rb
144
146
  - spec/support/tmp_project_helpers.rb
145
- has_rdoc: