Module: Bundler::Multilock::Ext::Dsl
- Defined in:
- lib/bundler/multilock/ext/dsl.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#eval_gemfile(gemfile, contents = nil, &block) ⇒ Object
Significant changes: * allow a block.
- #initialize ⇒ Object
- #lockfile(*args, **kwargs, &block) ⇒ Object
Instance Method Details
#eval_gemfile(gemfile, contents = nil, &block) ⇒ Object
Significant changes:
* allow a block
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/bundler/multilock/ext/dsl.rb', line 35 def eval_gemfile(gemfile, contents = nil, &block) = Pathname.new(gemfile).(@gemfile&.parent) original_gemfile = @gemfile @gemfile = @gemfiles << contents ||= Bundler.read_file(@gemfile.to_s) if block instance_eval(&block) else instance_eval(contents.dup.tap { |x| x.untaint if RUBY_VERSION < "2.7" }, @gemfile.to_s, 1) end rescue Exception => e # rubocop:disable Lint/RescueException = "There was an error " \ "#{e.is_a?(GemfileEvalError) ? "evaluating" : "parsing"} " \ "`#{File.basename gemfile.to_s}`: #{e.}" raise Bundler::Dsl::DSLError.new(, gemfile, e.backtrace, contents) ensure @gemfile = original_gemfile end |
#initialize ⇒ Object
27 28 29 30 31 |
# File 'lib/bundler/multilock/ext/dsl.rb', line 27 def initialize super @gemfiles = Set.new Multilock.loaded! unless Multilock.lockfile_definitions.empty? end |
#lockfile(*args, **kwargs, &block) ⇒ Object
56 57 58 59 60 |
# File 'lib/bundler/multilock/ext/dsl.rb', line 56 def lockfile(*args, **kwargs, &block) return true if Multilock.loaded? Multilock.add_lockfile(*args, builder: self, **kwargs, &block) end |