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

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

Raises:

  • (ArgumentError)


29
30
31
32
33
# File 'lib/bundler/overrule/dsl.rb', line 29

def overrule(&block)
  raise ArgumentError, "overrule requires a block" unless block

  instance_eval(&block)
end