Class: Bundler::Dsl

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/eval_gemfile_patch.rb,
lib/bundler/component.rb

Instance Method Summary collapse

Instance Method Details

#component(name, namespace: "engines") ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bundler/component.rb', line 4

def component(name, namespace: "engines")
  # NOTE: Change to the project root path.
  Dir.chdir(__dir__) do
    component_group = name.to_sym

    group :default do
      # Add engine as a dependency
      gemspec name: name, path: "#{namespace}/#{name}", development_group: component_group

      # Add runtime non-RubyGems specs
      if File.readable?("#{namespace}/#{name}/Gemfile.runtime")
        eval_gemfile "#{namespace}/#{name}/Gemfile.runtime"
      end
    end

    group component_group do
      # Add dev non-RubyGems specs
      if File.readable?("#{namespace}/#{name}/Gemfile.dev")
        eval_gemfile "#{namespace}/#{name}/Gemfile.dev"
      end
    end
  end
end

#eval_gemfile(gemfile, contents = nil) ⇒ Object



6
7
8
9
10
11
# File 'lib/bundler/eval_gemfile_patch.rb', line 6

def eval_gemfile(gemfile, contents = nil)
  expanded_gemfile_path = Pathname.new(gemfile).expand_path(@gemfile&.parent)
  return if @gemfiles.any? { |path| path == expanded_gemfile_path }

  eval_gemfile_original(gemfile, contents)
end

#eval_gemfile_originalObject



4
# File 'lib/bundler/eval_gemfile_patch.rb', line 4

alias eval_gemfile_original eval_gemfile