| 1 |
# frozen_string_literal: true |
| 2 |
|
| 3 |
module Bundler |
| 4 |
class Source |
| 5 |
class Metadata < Source |
| 6 |
def specs |
| 7 |
@specs ||= Index.build do |idx| |
| 8 |
idx << Gem::Specification.new("Ruby\0", Bundler::RubyVersion.system.gem_version) |
| 9 |
idx << Gem::Specification.new("RubyGems\0", Gem::VERSION) do |s| |
| 10 |
s.required_rubygems_version = Gem::Requirement.default |
| 11 |
end |
| 12 |
|
| 13 |
if local_spec = Gem.loaded_specs["bundler"] |
| 14 |
raise CorruptBundlerInstallError.new(local_spec) if local_spec.version.to_s != Bundler::VERSION |
| 15 |
|
| 16 |
idx << local_spec |
| 17 |
else |
| 18 |
idx << Gem::Specification.new do |s| |
| 19 |
s.name = "bundler" |
| 20 |
s.version = VERSION |
| 21 |
s.license = "MIT" |
| 22 |
s.platform = Gem::Platform::RUBY |
| 23 |
s.authors = ["bundler team"] |
| 24 |
s.bindir = "exe" |
| 25 |
s.homepage = "https://bundler.io" |
| 26 |
s.summary = "The best way to manage your application's dependencies" |
| 27 |
s.executables = %w[bundle] |
| 28 |
# can't point to the actual gemspec or else the require paths will be wrong |
| 29 |
s.loaded_from = __dir__ |
| 30 |
end |
| 31 |
end |
| 32 |
|
| 33 |
idx.each {|s| s.source = self } |
| 34 |
end |
| 35 |
end |
| 36 |
|
| 37 |
def options |
| 38 |
{} |
| 39 |
end |
| 40 |
|
| 41 |
def install(spec, _opts = {}) |
| 42 |
print_using_message "Using #{version_message(spec)}" |
| 43 |
nil |
| 44 |
end |
| 45 |
|
| 46 |
def to_s |
| 47 |
"the local ruby installation" |
| 48 |
end |
| 49 |
|
| 50 |
def ==(other) |
| 51 |
self.class == other.class |
| 52 |
end |
| 53 |
alias_method :eql?, :== |
| 54 |
|
| 55 |
def hash |
| 56 |
self.class.hash |
| 57 |
end |
| 58 |
|
| 59 |
def version_message(spec) |
| 60 |
"#{spec.name} #{spec.version}" |
| 61 |
end |
| 62 |
end |
| 63 |
end |
| 64 |
end |