Class: Papers::Gem

Inherits:
DependencySpecification show all
Defined in:
lib/papers/dependency_specification/gem.rb

Instance Attribute Summary

Attributes inherited from DependencySpecification

#license, #license_url, #name, #project_url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DependencySpecification

#acceptable_license?, #initialize

Constructor Details

This class inherits a constructor from Papers::DependencySpecification

Class Method Details

.introspectedObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/papers/dependency_specification/gem.rb', line 17

def self.introspected
  Bundler.load.specs.map do |spec|
    # bundler versions aren't controlled by the Gemfile
    if spec.name == "bundler"
      spec.name
    else
      "#{spec.name}-#{spec.version}"
    end
  end
end

.manifest_keyObject



28
29
30
# File 'lib/papers/dependency_specification/gem.rb', line 28

def self.manifest_key
  "gems"
end

Instance Method Details

#name_without_versionObject



12
13
14
15
# File 'lib/papers/dependency_specification/gem.rb', line 12

def name_without_version
  return @name unless @name.include?('-')
  @name.split('-')[0..-2].join('-')
end

#pretty_hashObject



3
4
5
6
7
8
9
10
# File 'lib/papers/dependency_specification/gem.rb', line 3

def pretty_hash
  {
    name: name_without_version,
    license: license,
    license_url: @license_url,
    project_url: @project_url
  }
end