Created
June 11, 2012 10:15
-
-
Save jeffkreeftmeijer/2909445 to your computer and use it in GitHub Desktop.
Preloading dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'drb' | |
runner = DRbObject.new nil, 'druby://:4321' | |
runner.run(ARGV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'drb' | |
ARGV.each { |file| require File.expand_path file } | |
Rails.env = 'test' if defined? Rails | |
class Runner | |
def run(files) | |
fork do | |
files.each { |file| require File.expand_path file } | |
end | |
Process.wait | |
end | |
end | |
DRb.start_service 'druby://:4321', Runner.new | |
DRb.thread.join |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sleep 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path 'slow' | |
100.times do | |
sleep rand * 0.01 | |
print '.' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path 'slow' | |
3.times do | |
fork do | |
require File.expand_path 'test' | |
end | |
Process.wait | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment