class Bundler::PubGrub::StaticPackageSource::DSL

Public Class Methods

new(packages, root_deps) click to toggle source
# File bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb, line 10
def initialize(packages, root_deps)
  @packages = packages
  @root_deps = root_deps
end

Public Instance Methods

add(name, version, deps: {}) click to toggle source
# File bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb, line 19
def add(name, version, deps: {})
  version = Gem::Version.new(version)
  @packages[name] ||= {}
  raise ArgumentError, "#{name} #{version} declared twice" if @packages[name].key?(version)
  @packages[name][version] = clean_deps(name, version, deps)
end
root(deps:) click to toggle source
# File bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb, line 15
def root(deps:)
  @root_deps.update(deps)
end

Private Instance Methods

clean_deps(name, version, deps) click to toggle source

Exclude redundant self-referencing dependencies

# File bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb, line 29
def clean_deps(name, version, deps)
  deps.reject {|dep_name, req| name == dep_name && Bundler::PubGrub::RubyGems.parse_range(req).include?(version) }
end