Class: Bundler::PubGrub::StaticPackageSource::DSL
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb |
Class Method Summary
- .new(packages, root_deps) ⇒ DSL constructor
Instance Method Summary
- #add(name, version, deps: {})
- #root(deps:)
-
#clean_deps(name, version, deps)
private
Exclude redundant self-referencing dependencies.
Constructor Details
.new(packages, root_deps) ⇒ DSL
# File 'lib/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
Instance Method Details
#add(name, version, deps: {})
# File 'lib/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
#clean_deps(name, version, deps) (private)
Exclude redundant self-referencing dependencies
# File 'lib/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
#root(deps:)
[ GitHub ]# File 'lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb', line 15
def root(deps:) @root_deps.update(deps) end