nonsequitur / inf-ruby

218 stars 69 forks source link

Improve inf-ruby-console-rails-p #114

Closed cbaines closed 2 months ago

cbaines commented 6 years ago

Remove the requirements depending on the existance and location of a Gemfile.lock file, as these prevent the proper operation of inf-ruby when the Gemfile.lock is elsewhere, or Bundler is not in use.

Instead, use the existance of bin/rails, as this is something that the Rails tooling itself depends on, and therefore more likely to be both indicative of Rails being used, and required, as Rails is difficult to use without it.

dgutov commented 6 years ago

I don't mind trying this, though I vaguely recall that some older versions of Rails didn't always have bin/rails. Do you remember anything about that?

Rails tooling itself depends on

Could you give an example?

cbaines commented 6 years ago

I don't mind trying this, though I vaguely recall that some older versions of Rails didn't always have bin/rails. Do you remember anything about that?

I've only used Rails 4 and 5, so I don't know much from experience for earlier versions.

Rails tooling itself depends on

Could you give an example?

So I was slightly wrong, it seems that the AppLoader [1] depends on either the bin/rails or script/rails files existing, and containing some specific contents:

if contents =~ /(APP|ENGINE)_PATH/

1: https://github.com/rails/rails/blob/20c91119903f70eb19aed33fe78417789dbf070f/railties/lib/rails/app_loader.rb

dgutov commented 6 years ago

Beginning in Rails 4, Rails ships with a rails binstub at ./bin/rails ...

Judging by this blurb, this might not be true for Rails 3.2. At least, not always. I'm guessing there are still some users of it out there.

Could you give an example of the following, then?

when the Gemfile.lock is elsewhere

dgutov commented 2 months ago

It's time! :black_cat: