# Script/runner: what the...!?

**URL:** <https://www.ruby-forum.com/t/script-runner-what-the/82027>\
**Category:** Rails\
**Created:** [January 16, 2007, 10:38pm UTC](https://www.ruby-forum.com/t/script-runner-what-the/82027 "2007-01-16T22:38:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Larimer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@Mark\_Larimer](https://www.ruby-forum.com/u/Mark_Larimer)\
**Post date:** [January 16, 2007, 10:38pm UTC](https://www.ruby-forum.com/t/script-runner-what-the/82027/1 "2007-01-16T22:38:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mark\_Larimer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@Mark\_Larimer](https://www.ruby-forum.com/u/Mark_Larimer)\
**Post date:** [April 12, 2007, 10:05pm UTC](https://www.ruby-forum.com/t/script-runner-what-the/82027/2 "2007-04-12T22:05:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mark\_Larimer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@Mark\_Larimer](https://www.ruby-forum.com/u/Mark_Larimer)\
**Post date:** [April 17, 2007, 3:10pm UTC](https://www.ruby-forum.com/t/script-runner-what-the/82027/3 "2007-04-17T15:10:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mark\_Larimer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@Mark\_Larimer](https://www.ruby-forum.com/u/Mark_Larimer)\
**Post date:** [April 15, 2007, 7:57pm UTC](https://www.ruby-forum.com/t/script-runner-what-the/82027/4 "2007-04-15T19:57:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Mark\_Larimer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f4b2a3/32.png) [@Mark\_Larimer](https://www.ruby-forum.com/u/Mark_Larimer)\
**Post date:** [April 17, 2007, 3:45pm UTC](https://www.ruby-forum.com/t/script-runner-what-the/82027/5 "2007-04-17T15:45:25Z")

</div>

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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
