Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

railties/bin/rails non-operational in current clone of master

#2938

The current railties/bin/rails has issues running on the latest version of master.

The script assumes bash because no interpreter is given in the file.

Following the example of other script files, I added

#!/usr/bin/env ruby

at the top of the script, and the script became functional again.

Reported by Kieran P · July 22nd, 2009 @ 10:48 AM

State: wontfix
Milestone: 3.0.2
Assigned to: José Valim José Valim
Importance: High

Activity

  1. Kieran P
    Kieran P

    This problem still exists in the latest clone of master.

    August 7th, 2009 @ 11:51 AM

  2. José Valim
    José Valim
    • Assigned user changed from Yehuda Katz (wycats) to José Valim
    • Milestone cleared.

    Kieran,

    I have them working on my ubuntu.
    Before you add the line above, what was the first line?

    August 7th, 2009 @ 04:09 PM

  3. Kieran P
    Kieran P

    The first line is

    require File.dirname(__FILE__) + '/../lib/ruby_version_check'
    

    Which is clearly ruby, but when I run ./rails/railties/bin/rails it interprets it as a bash script.

    The interpreter declaration (which is present in all other bin scripts within Rails that I've found, including the script files in a new Rails app) fixes this issue.

    The other solution is to use

    ruby rails/railties/bin/rails
    

    but I really don't think that is very friendly.

    August 7th, 2009 @ 09:09 PM

  4. José Valim
    José Valim
    • State changed from new to open

    Sorry, I got it wrong. For me you couldn't run RAILS_ROOT/scripts/* files.
    I will fix that. Thanks!

    August 7th, 2009 @ 09:17 PM

  5. Kieran P
    Kieran P
    • Title changed from script/rails non-operational in current clone of master to railties/bin/rails non-operational in current clone of master

    Ah, sorry. Poorly worded original ticket. Correcting it now.

    August 7th, 2009 @ 09:29 PM

  6. Rizwan Reza
    Rizwan Reza

    verified

    +1 This is still present in master branch. I cannot seem to run rails command by running.

    But I still think this is intentional. Just because 2-3-stable has it the same way. Please invalidate if this isn't a bug.

    August 9th, 2009 @ 12:25 AM

  7. José Valim
    José Valim
    • State changed from open to wontfix

    Rails should not add a shebang to the bin files. When you install a gem, rubygems creates this:

    #!/usr/local/bin/ruby
    #
    # This file was generated by RubyGems.
    #
    # The application 'rails' is installed as part of a gem, and
    # this file is here to facilitate running it.
    #
    
    require 'rubygems'
    
    version = ">= 0"
    
    if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
      version = $1
      ARGV.shift
    end
    
    gem 'rails', version
    load 'rails'
    

    In other words, rubygems is responsible for adding the shebang. If you run it from your fork, unfortunately you will have to give the whole path.

    August 9th, 2009 @ 12:30 AM

  8. Steve St. Martin
    Steve St. Martin

    -1 agreed this was probably removed from master due to rubygems, therefore this issue will only exist when using a checkout rather then a gem, running 'ruby rails/railties/bin/rails' is acceptable.

    August 9th, 2009 @ 12:52 AM

  9. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to High

    October 15th, 2010 @ 11:01 PM