rails / thor

Thor is a toolkit for building powerful command-line interfaces.
http://whatisthor.com/
MIT License
5.12k stars 553 forks source link

Thor::Util.ruby_command semi-issue #188

Open sgonyea opened 12 years ago

sgonyea commented 12 years ago

This is less an issue, and more of a question.

I generated a rails projects using Rubinius, and later switched to MRI (using RVM) to compare behavior... But what happens is:

$ rails c
/Users/sgonyea/.rvm/rubies/ruby-1.9.2-p290/bin/ruby: no Ruby script found in input (LoadError)

Reason being, the "script/rails" command looks like:

#!/usr/bin/env rbx
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.

APP_PATH = File.expand_path('../../config/application',  __FILE__)
require File.expand_path('../../config/boot',  __FILE__)
require 'rails/commands'

Notice line 1--it expects "rbx" to be my ruby executable.

What's nice about RVM is that it makes switching between rubies to be pretty transparent; had I created the rails project using MRI, I'd have never noticed the issue.

Are there any thoughts on how best to handle this? Or, a better way to phrase it: Who's problem is this?

It's a trivial issue, but it's tedious to debug and may be discouraging for people playing with non-MRI rubies.

Would a patch be accepted, that allows an ENV variable to override whatever is in RbConfig? Or, because this uses RbConfig, should RVM / rbenv be responsible for configuring this at compile time? Or should I just buzz off? :)

If nothing else, this issue will show up on Google and save that small group of people some time. Feel free to close this issue whenever.

josevalim commented 12 years ago

Thor::Util.ruby_command should return the currently running ruby command. Rails just happen to be using it for the shebang which makes this is more of a Rails issue. I am unsure how would be best to solve this from Rails side.