Skip to content

Conversation

@thedarkone
Copy link
Contributor

Bundler doesn't require any of the non group associated gems unless it is passed the :default group in the Bundler.require *groups call.

This means for example that all the gems in the main Gemfile not-included in any of the group :something do blocks are not required by Bundler.

@runlevel5
Copy link
Member

This worries me for the fact following gems which are not included in any blocks are ruled out:

gem 'json'
gem 'sqlite3'
gem "ruby-debug"

Can you please elaborate this?

@thedarkone
Copy link
Contributor Author

Yes, these gems are not auto-required by Bundler as of right now. You do however get their lib load paths added to $LOAD_PATH (that is true for all gems in all of the groups :assets, :test, :cucumber, :ci etc), so manually issuing require 'ruby-debug' will work (as will require 'capybara' in :development mode Rails console).

This however is not the expected result of adding gem dependency into Gemfile of a typical Rails app.

@runlevel5
Copy link
Member

@radar: what's your thought on this?

@thedarkone
Copy link
Contributor Author

The reason this works:

gem 'json'
gem 'sqlite3'

is because Rails or other gems issue manual requires for the json and sqlite3 gems. If you were to change the Gemfile like this:

group :this_is_never_used do
  gem 'json'
  gem 'sqlite3'
end

everything would still work.

I'm also not sure about requiring ruby-debug all the time, maybe it should be moved into the :development group?

@radar
Copy link
Contributor

radar commented Nov 15, 2011

Why is this patching the spec/dummy generator? I am not sure what this is fixing.

@thedarkone
Copy link
Contributor Author

@radar: This is fixing spree/dummy (not spec/dummy) generator template that is being used by the sandbox app. I was using the sandbox as it seemed to be the simplest way to test my rails-dev-boost (faster Rails dev. mode) plugin with Spree. See the ticket referenced right above your reply.

@radar
Copy link
Contributor

radar commented Nov 16, 2011

Ah right then. Seems logical to me.

radar added a commit that referenced this pull request Nov 16, 2011
Use Rails.groups when doing Bundler.require
@radar radar merged commit 1aaeada into spree:master Nov 16, 2011
radar added a commit that referenced this pull request Nov 22, 2011
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

Successfully merging this pull request may close these issues.

3 participants