Module: LockDiff::Gem::Spec

Defined in:
lib/lock_diff/gem/spec.rb

Overview

wrapper of lazy_specification

Defined Under Namespace

Classes: Base, GitSpec, PathSpec, RubyGemSpec, UnSupportSource

Class Method Summary collapse

Class Method Details

.new(lazy_specification) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/lock_diff/gem/spec.rb', line 8

def new(lazy_specification)
  case lazy_specification.source
  when Bundler::Source::Rubygems
    RubyGemSpec.new(lazy_specification)
  when Bundler::Source::Git
    GitSpec.new(lazy_specification)
  when Bundler::Source::Path
    PathSpec.new(lazy_specification)
  else
    raise UnSupportSource, "#{lazy_specification.source.class} source by #{lazy_specification.name} is not supported"
  end
end

.parse(lockfile) ⇒ Object



21
22
23
24
25
# File 'lib/lock_diff/gem/spec.rb', line 21

def parse(lockfile)
  Bundler::LockfileParser.new(lockfile).specs.map do |lazy_specification|
    new(lazy_specification)
  end
end