]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/gems/rspec-1.1.2/spec/ruby_forker.rb
added RSpec and RSpec on Rails
[rails.git] / vendor / gems / rspec-1.1.2 / spec / ruby_forker.rb
diff --git a/vendor/gems/rspec-1.1.2/spec/ruby_forker.rb b/vendor/gems/rspec-1.1.2/spec/ruby_forker.rb
new file mode 100644 (file)
index 0000000..6ab0387
--- /dev/null
@@ -0,0 +1,13 @@
+require 'rbconfig'
+
+module RubyForker
+  # Forks a ruby interpreter with same type as ourself.
+  # juby will fork jruby, ruby will fork ruby etc.
+  def ruby(args, stderr=nil)
+    config       = ::Config::CONFIG
+    interpreter  = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
+    cmd = "#{interpreter} #{args}"
+    cmd << " 2> #{stderr}" unless stderr.nil?
+    `#{cmd}`
+  end
+end
\ No newline at end of file