Script/runner: what the...!?

What’s wrong here? script/runner looks okay, but doesn’t run as
advertised. Check it out:

./script/runner --help
Usage: ./script/runner [options] (‘Some.ruby(code)’ or a filename)

-e, --environment=name           Specifies the environment for the

runner to operate under (test/development/production).
Default: development

-h, --help                       Show this help message.

You can also use runner as a shebang line for your scripts like this:

#!/usr/bin/env /home/mark/ariel/script/runner

Product.find(:all).each { |p| p.price *= 2 ; p.save! }

./script/runner -e production ‘TourDateMailing.generate_new’
invalid option: -e
Test::Unit automatic runner.
Usage: ./script/runner [options] [-- untouched arguments]

-r, --runner=RUNNER              Use the given RUNNER.
                                 (c[onsole], f[ox], g[tk], g[tk]2,

t[k])
-n, --name=NAME Runs tests matching NAME.
(patterns may be used).
-t, --testcase=TESTCASE Runs tests in TestCases matching
TESTCASE.
(patterns may be used).
-v, --verbose=[LEVEL] Set the output level (default is
verbose).
(s[ilent], p[rogress], n[ormal],
v[erbose])
– Stop processing options so that
the
remaining options will be passed
to the
test.
-h, --help Display this help.

Deprecated options:
–console Console runner (use --runner).
–gtk GTK runner (use --runner).
–fox Fox runner (use --runner).

Any ideas?

Thanks.
–mark

I’m having the same exact problem. Please post the solution if you found
it.

Just wanted to update what my solution was. I was using the file_column
plugin and it had the following line in the init.rb file:

require ‘test_case’

That apparently confused runner and passed the request to the
Test::Unit::AutoRunner. Once removed, the problem was solved. I’ve
submitted a patch to Sebastian that should resolve the issue. YMMV.

–Ryan

I’m having the same issue after upgrading a Rails app to v1.2.3. I can
work around it by adding an explicit exit call to the end of the runner
text. Any ideas what’s going on here?

–Ryan

I’m a little confused about the require ‘test_case’ and how that
affects runner. Same thing happened to me all of a sudden a while back
and my only resolution was to run it with RAILS_ENV=production script/
runner “SomeModel.run”.

Thanks,
Fredrik

On Apr 17, 8:10 am, Ryan W. [email protected]