Class: Gemlist

Inherits:
Object
  • Object
show all
Defined in:
lib/gemlist.rb,
lib/gemlist/version.rb,
lib/gemlist/spec_node.rb,
lib/gemlist/spec_tree.rb,
lib/gemlist/group_conflict.rb

Defined Under Namespace

Classes: GroupConflict, SpecNode, SpecTree

Constant Summary collapse

VERSION =
"0.4.1"

Instance Method Summary collapse

Constructor Details

#initialize(path, options = {}) ⇒ Gemlist

Returns a new instance of Gemlist.



7
8
9
10
# File 'lib/gemlist.rb', line 7

def initialize(path, options = {})
  @path    = Pathname.new(path)
  @options = options
end

Instance Method Details

#gemsObject



19
20
21
22
23
24
25
26
27
# File 'lib/gemlist.rb', line 19

def gems
  cached_specs = specs

  cached_specs.each.with_index.with_object([]) do |(spec, index), uniquified_specs|
    last_occurrence_of_spec = cached_specs.rindex(spec) == index

    uniquified_specs << spec if last_occurrence_of_spec
  end
end

#sourcesObject



12
13
14
15
16
17
# File 'lib/gemlist.rb', line 12

def sources
  lockfile_parser.sources
    .select { |source| source.is_a?(Bundler::Source::Rubygems) }
    .flat_map(&:remotes)
    .map(&:to_s)
end