Module: Bundler::Overrule::Dsl
- Defined in:
- lib/bundler/overrule/dsl.rb
Overview
The Gemfile DSL. Prepended into Bundler::Dsl by the bootstrap file, which
is why force and ban are callable at the top level of a Gemfile.
Instance Method Summary collapse
-
#ban(name, reason: nil) ⇒ Object
Remove
namefrom dependency resolution entirely. -
#force(name, requirement, reason: nil) ⇒ Object
Override every constraint on
name— from other gems' gemspecs and from your own Gemfile — withrequirement. -
#overrule(&block) ⇒ Object
Sugar for grouping rules.
-
#swap(name, with:, version: nil, reason: nil) ⇒ Object
Substitute a different gem for
nameeverywhere it is depended on — typically a maintained fork published under another name.
Instance Method Details
#ban(name, reason: nil) ⇒ Object
Remove name from dependency resolution entirely.
ban 'httpclient', reason: 'unmaintained; vendored certs expired'
19 20 21 |
# File 'lib/bundler/overrule/dsl.rb', line 19 def ban(name, reason: nil) Overrule.ban(name, reason: reason) end |
#force(name, requirement, reason: nil) ⇒ Object
Override every constraint on name — from other gems' gemspecs and
from your own Gemfile — with requirement.
force 'openssl', '>= 3.0', reason: 'web-push pins ~> 2.2; 3.x is fine'
12 13 14 |
# File 'lib/bundler/overrule/dsl.rb', line 12 def force(name, requirement, reason: nil) Overrule.force(name, requirement, reason: reason) end |
#overrule(&block) ⇒ Object
Sugar for grouping rules. Same registry underneath.
overrule do
force 'openssl', '>= 3.0'
ban 'httpclient'
end
41 42 43 44 45 |
# File 'lib/bundler/overrule/dsl.rb', line 41 def overrule(&block) raise ArgumentError, "overrule requires a block" unless block instance_eval(&block) end |
#swap(name, with:, version: nil, reason: nil) ⇒ Object
Substitute a different gem for name everywhere it is depended on —
typically a maintained fork published under another name.
swap 'httpclient', with: 'byroot-httpclient'
swap 'httpclient', with: 'byroot-httpclient', version: '~> 3.0'
The substitute must ship the same require path; this is an install-time
tool and does not alias require at runtime.
31 32 33 |
# File 'lib/bundler/overrule/dsl.rb', line 31 def swap(name, with:, version: nil, reason: nil) Overrule.swap(name, with: with, version: version, reason: reason) end |