Class: RubygemsAnalyzer

Inherits:
DepAnalyzer show all
Defined in:
lib/rubygems_analyzer.rb

Instance Attribute Summary

Attributes inherited from DepAnalyzer

#g

Instance Method Summary collapse

Methods inherited from DepAnalyzer

#initialize, #run, #setup

Methods inherited from Cache

#cache, #initialize

Constructor Details

This class inherits a constructor from DepAnalyzer

Instance Method Details

#decorateObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/rubygems_analyzer.rb', line 31

def decorate
  developer_dependency = g.gray

  installed = self.installed

  installed.each do |gem|
    deps = self.deps gem

    deps.each do |dep|
      next if dep.type == :runtime
      name = dep.name
      developer_dependency << g[gem][name] if $a or installed.include? name
    end
  end
end

#deps(gem_name) ⇒ Object



26
27
28
29
# File 'lib/rubygems_analyzer.rb', line 26

def deps gem_name
  gem = Gem::Specification.find_by_name gem_name
  gem.dependencies
end

#installedObject



14
15
16
17
18
# File 'lib/rubygems_analyzer.rb', line 14

def installed
  # don't cache so it updates every delete
  puts "scanning installed rubygems"
  Gem::Specification.map(&:name).sort
end

#outdatedObject



20
21
22
23
24
# File 'lib/rubygems_analyzer.rb', line 20

def outdated
  # don't cache so it updates every delete
  puts "scanning outdated rubygems"
  Gem::Specification.outdated.sort
end