Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin/rails provided twice now #2400

Closed
darix opened this issue Aug 2, 2011 · 9 comments
Closed

bin/rails provided twice now #2400

darix opened this issue Aug 2, 2011 · 9 comments
Assignees

Comments

@darix
Copy link

darix commented Aug 2, 2011

I know it is kind of my fault that rails 3.0 still had the rails package. but with rc4 the bin/rails was provided by the rails gem. now railties and rails install it.

is this intentional?

@ghost ghost assigned tenderlove Aug 2, 2011
@guilleiguaran
Copy link
Member

Yes, It is intentional

e3053ee

@darix
Copy link
Author

darix commented Aug 3, 2011

the commit message does not explain why it is needed to work without the rails gem.

If you want to keep the rails gem just as a wrapper for compat that will just pull all the needed other gems. then you could drop the bin/rails file in the rails gem and just have a readme or so in it. similar as done sqlite3-ruby and sqlite3

@guilleiguaran
Copy link
Member

cc @josevalim

@josevalim
Copy link
Contributor

It is required in railties so people that don't want the whole Rails package (which comes with ActiveRecord, ActiveResource and so on) can still use the binfile.

And it is also needed in rails because if the binfile is only available on the railties gem, the rails binfile for versions 2.3 ends up having bigger priority if it is installed last.

@jeremy jeremy reopened this Sep 11, 2011
@jeremy
Copy link
Member

jeremy commented Sep 11, 2011

As of RubyGems 1.8.10, gem install rails prompts whether you want to overwrite the rails executable:

rails's executable "rails" conflicts with railties
Overwrite the executable? [yN]

And Bundler raises an exception:

Using railties (3.1.0) from git://github.com/rails/rails.git (at 3-1-stable) /Users/jeremy/.rbenv/versions/1.9.3-preview1/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:161:in `check_executable_overwrite': "rails" from railties conflicts with installed executable from rails (Gem::InstallError)

Being able to install railties standalone isn't worth this.

@jeremy
Copy link
Member

jeremy commented Sep 11, 2011

Bundle issue fixed in rubygems/bundler@da27033

@arunagw
Copy link
Member

arunagw commented Dec 18, 2011

Can this be closed?? If it's fixed already ??

@arunagw
Copy link
Member

arunagw commented Dec 20, 2011

Closing this. I think we are good now. It should be solved.

@arunagw arunagw closed this as completed Dec 20, 2011
@alexch
Copy link

alexch commented Mar 26, 2012

Sadly, not quite solved yet. (Or maybe it regressed.)

Using rubygems 1.8.21 and rails 3.2.2 allows this sequence of events:

$ gem install rails
$ rails -v
Rails 3.2.2
$ gem install rails --version 2.3.14
$ rails -v
Rails 2.3.14
$ rails _3.2.2_ -v
/Users/chaffee/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems.rb:316:in `bin_path': can't find gem rails (["3.2.2"]) with executable rails (Gem::GemNotFoundException)
    from /Users/chaffee/.rvm/gems/ruby-1.9.3-p125/bin/rails:19:in `<main>'

$ gem uninstall rails -v 2.3.14
Remove executables:
    rails

in addition to the gem? [Yn]  y
Removing rails
Successfully uninstalled rails-2.3.14
$ rails -v
/Users/chaffee/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.2/lib/rails: Is a directory - /Users/chaffee/.rvm/gems/ruby-1.9.3-p125/gems/activerecord-3.2.2/lib/rails (Errno::EISDIR)
    from /usr/local/bin/rails:19:in `load'
    from /usr/local/bin/rails:19

In other words, once you install rails 2.3, you can never again run command-line rails 3.2, even if you completely blow away 2.3.

Workaround: after gem uninstall rails --version 2.3.14 run gem install railties which will then allow

$ rails _3.2.2_ -v
Rails 3.2.2
$ rails -v
Rails 3.2.2

I think the solution is for the (now empty) rails gem to include a bin/rails executable, in addition to an identical one inside railties. Or to patch rubygems to look in many more places for a bin with the right name and version and file type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants