summaryrefslogtreecommitdiff
path: root/lib/bundler/source.rb
blob: 0bcf9c3cfe6a4d0a3c05ee589213a81ba70275fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
module Bundler
  class Source
    autoload :Rubygems, "bundler/source/rubygems"
    autoload :Path,     "bundler/source/path"
    autoload :Git,      "bundler/source/git"

    attr_accessor :dependency_names

    def unmet_deps
      specs.unmet_dependency_names
    end

    def version_message(spec)
      message = "#{spec.name} #{spec.version}"

      if Bundler.locked_gems
        locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name }
        locked_spec_version = locked_spec.version if locked_spec
        if locked_spec_version && spec.version != locked_spec_version
          message << " (was #{locked_spec_version})"
        end
      end

      message
    end

    def can_lock?(spec)
      spec.source == self
    end

    def include?(other)
      other == self
    end
  end
end