Module: Licensed::Bundler::DefinitionExtensions

Defined in:
lib/licensed/sources/bundler/definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#force_exclude_groupsObject

Returns the value of attribute force_exclude_groups.



6
7
8
# File 'lib/licensed/sources/bundler/definition.rb', line 6

def force_exclude_groups
  @force_exclude_groups
end

Instance Method Details

#requested_groupsObject

Override requested_groups to also exclude any groups that are in the “bundler.without” section of the licensed configuration file.



31
32
33
# File 'lib/licensed/sources/bundler/definition.rb', line 31

def requested_groups
  super - Array(force_exclude_groups)
end

#specsObject

Override specs to avoid logic that would raise Gem::NotFound which is handled in this ./missing_specification.rb, and to not add bundler as a dependency if it’s not a user-requested gem.

Newer versions of Bundler have changed the implementation of specs_for as well which no longer calls this function. Overriding this function gives a stable access point for licensed



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/licensed/sources/bundler/definition.rb', line 15

def specs
  @specs ||= begin
    specs = resolve.materialize(requested_dependencies)

    all_dependencies = requested_dependencies.concat(specs.flat_map(&:dependencies))
    if all_dependencies.any? { |d| d.name == "bundler" } && !specs["bundler"].any?
      bundler = sources..specs.search(Gem::Dependency.new("bundler", ::Bundler::VERSION)).last
      specs["bundler"] = bundler
    end

    specs
  end
end