Skip to content

Instantly share code, notes, and snippets.

@jugyo
Created October 11, 2010 04:35
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jugyo/619977 to your computer and use it in GitHub Desktop.
Save jugyo/619977 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
##
# script/spec_server_irb
require 'drb'
require 'irb'
begin
begin
DRb.start_service("druby://localhost:0")
rescue SocketError, Errno::EADDRNOTAVAIL
DRb.start_service("druby://:0")
end
$spec_server = DRbObject.new_with_uri("druby://127.0.0.1:8989")
rescue DRb::DRbConnError
err.puts "No DRb server is running. Running in local process instead ..."
end
def rspec(file)
$spec_server.run(["--color", "--format", "s", file], STDERR, STDOUT)
end
puts <<DESC
Example:
> rspec 'spec/models/user_spec.rb'
DESC
IRB.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment