[rspec-users] Bash shim for Rspec

Peter Fitzgibbons peter.fitzgibbons at gmail.com
Wed May 16 09:56:53 UTC 2012


HI Folks,
The following script is *supposed* to run rspec under Jruby with the proper
Java-switch for using SWT with OSX (-XstartOnFirstThread).
The issue is that this script doesn't actually run any of the specs!
Example:
$ bin/rspec_auto_jvm spec/swt_shoes/app_spec.rb
spec/swt_shoes/app_spec.rb
args are  spec/swt_shoes/app_spec.rb
$

Can anyone point out the flaw?

Peter Fitzgibbons
(847) 859-9550
Email: peter.fitzgibbons at gmail.com
IM GTalk: peter.fitzgibbons
IM AOL: peter.fitzgibbons at gmail.com


#!/usr/bin/env bash
# !/usr/bin/env jruby --1.9 --debug
#
# This file was generated by Bundler.
#
# The application 'rspec' is installed as part of a gem, and
# this file is here to facilitate running it.
#

echo "$@" | grep 'swt'

if [[ $@ == *swt* ]]; then
  swt_opt="-J-XstartOnFirstThread"
fi

echo 'args are ' $*

run_rspec="
# http://jira.codehaus.org/browse/JRUBY-6324
# random seed for srand is not initialized properly
# call once and throw-away nil default first value
x = srand

require 'rubygems'

version = \">= 0\"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

gem 'rspec-core', version
load Gem.bin_path('rspec-core', 'rspec', version)

exit 0
"

jruby --1.9 --debug ${swt_opt} -e ${run_rspec} $*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120516/7e6a179f/attachment.html>


More information about the rspec-users mailing list