This project is archived and is in readonly mode.
Comments and changes to this ticket
-
Steve St. Martin April 15th, 2010 @ 09:39 PM
- Assigned user set to Ryan Bigg
please submit a patch. mark as incomplete
-
Ryan Bigg April 15th, 2010 @ 10:37 PM
- State changed from new to incomplete
-
Rohit Arondekar June 19th, 2010 @ 09:17 AM
- State changed from incomplete to open
I've attached a patch that does what Kiyoshi has asked for.
-
Rohit Arondekar June 19th, 2010 @ 11:34 AM
- Tag changed from runner, script to patch, runner, script
Ignore previous patch. This one properly sets $0 and $PROGRAM_NAME to the filename.
-
David Trasbo June 20th, 2010 @ 03:12 PM
+1
I tried it with a fresh Rails 3 app and it works.
I think the variables should be set like
app/models/person.rb
instead of justperson.rb
(relatively toRails.root
) to be consistent with normal$0
and$PROGRAM_NAME
behavior.
If you, for example, runruby foo/bar/baz.rb
the two variables will both be set tofoo/bar/baz.rb
. -
Rohit Arondekar June 20th, 2010 @ 03:21 PM
- Assigned user changed from Ryan Bigg to José Valim
Thanks David. Actually the first patch behaves like that. It will set $0 and $PROGRAM_NAME to the argument passed to runner, in case the file exists.
-
Rohit Arondekar June 21st, 2010 @ 02:08 AM
I couldn't find any tests for Rails Runner. Does it need tests? I wouldn't mind having a go at writing some.
-
José Valim June 21st, 2010 @ 10:08 AM
Hey Rohit, please do add a few tests (at least one for filename and another one for simply passing a string). You can take as base this rake test in Railties:
http://github.com/rails/rails/blob/master/railties/test/application...
-
Rohit Arondekar June 22nd, 2010 @ 06:01 AM
I just started on this, but another ticket #4249 has opened up which may change a few things. So I think it's best if I wait?
-
Rohit Arondekar June 22nd, 2010 @ 02:18 PM
Attached patch that resolves the issue and also adds 4 tests for runner.
-
Repository June 22nd, 2010 @ 02:22 PM
(from [9be0b509628388a290b117e6b02df871d97f8c2d]) Added 4 tests for Rails Runner. 2 failing tests for $0 and $PROGRAM_NAME [#2244 state:open]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/9be0b509628388a290b117e6b02df8... -
Repository June 22nd, 2010 @ 02:22 PM
- State changed from open to resolved
(from [40bf76165c392a15cd74321dd7d1cbc96c77bd27]) Rails Runner now sets $0 and $PROGRAM_NAME to name of file being run [#2244 state:resolved]
Signed-off-by: José Valim jose.valim@gmail.com
http://github.com/rails/rails/commit/40bf76165c392a15cd74321dd7d1cb...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 4249 [rails3 beta] "rails runner" can't be used in shebang lines Yehuda, will you be working on this? There is this one mo...
- 2244 script runner should overwrite $0 (from [9be0b509628388a290b117e6b02df871d97f8c2d]) Added 4...
- 2244 script runner should overwrite $0 (from [40bf76165c392a15cd74321dd7d1cbc96c77bd27]) Rails R...