Method: Bundler.require
- Defined in:
- lib/bundler.rb
.require(*groups) ⇒ Object
Setups Bundler environment (see Bundler.setup) if it is not already set, and loads all gems from groups specified. Unlike ::setup, can be called multiple times with different groups (if they were allowed by setup).
Assuming Gemfile
gem 'first_gem', '= 1.0'
group :test do
gem 'second_gem', '= 1.0'
end
The code will work as follows:
Bundler.setup # allow all groups
Bundler.require(:default) # requires only first_gem
# ...later
Bundler.require(:test) # requires second_gem
214 215 216 217 |
# File 'lib/bundler.rb', line 214 def require(*groups) load_plugins setup(*groups).require(*groups) end |