rubygems-update 2.1.11 → 2.2.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of rubygems-update might be problematic. Click here for more details.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.autotest +37 -12
- data/History.txt +99 -2
- data/MIT.txt +1 -0
- data/Manifest.txt +59 -19
- data/Rakefile +4 -6
- data/lib/gauntlet_rubygems.rb +1 -1
- data/lib/rubygems.rb +102 -80
- data/lib/rubygems/available_set.rb +2 -2
- data/lib/rubygems/basic_specification.rb +97 -8
- data/lib/rubygems/commands/install_command.rb +58 -15
- data/lib/rubygems/commands/list_command.rb +1 -7
- data/lib/rubygems/commands/outdated_command.rb +1 -1
- data/lib/rubygems/commands/pristine_command.rb +14 -1
- data/lib/rubygems/commands/push_command.rb +9 -4
- data/lib/rubygems/commands/query_command.rb +33 -17
- data/lib/rubygems/commands/search_command.rb +0 -6
- data/lib/rubygems/commands/specification_command.rb +1 -1
- data/lib/rubygems/commands/unpack_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +4 -1
- data/lib/rubygems/commands/which_command.rb +5 -8
- data/lib/rubygems/compatibility.rb +3 -0
- data/lib/rubygems/core_ext/kernel_gem.rb +6 -0
- data/lib/rubygems/defaults.rb +19 -0
- data/lib/rubygems/dependency_installer.rb +28 -9
- data/lib/rubygems/doctor.rb +17 -11
- data/lib/rubygems/errors.rb +16 -3
- data/lib/rubygems/exceptions.rb +52 -5
- data/lib/rubygems/ext.rb +1 -2
- data/lib/rubygems/ext/build_error.rb +6 -0
- data/lib/rubygems/ext/builder.rb +50 -17
- data/lib/rubygems/ext/cmake_builder.rb +1 -1
- data/lib/rubygems/ext/configure_builder.rb +1 -3
- data/lib/rubygems/ext/ext_conf_builder.rb +9 -3
- data/lib/rubygems/ext/rake_builder.rb +2 -5
- data/lib/rubygems/gemcutter_utilities.rb +8 -1
- data/lib/rubygems/installer.rb +14 -4
- data/lib/rubygems/installer_test_case.rb +0 -5
- data/lib/rubygems/package.rb +11 -2
- data/lib/rubygems/psych_additions.rb +1 -1
- data/lib/rubygems/rdoc.rb +1 -1
- data/lib/rubygems/remote_fetcher.rb +3 -3
- data/lib/rubygems/request.rb +16 -8
- data/lib/rubygems/request_set.rb +133 -42
- data/lib/rubygems/request_set/gem_dependency_api.rb +493 -11
- data/lib/rubygems/request_set/lockfile.rb +579 -0
- data/lib/rubygems/requirement.rb +58 -30
- data/lib/rubygems/resolver.rb +471 -0
- data/lib/rubygems/resolver/activation_request.rb +165 -0
- data/lib/rubygems/resolver/api_set.rb +110 -0
- data/lib/rubygems/resolver/api_specification.rb +79 -0
- data/lib/rubygems/resolver/best_set.rb +31 -0
- data/lib/rubygems/resolver/composed_set.rb +39 -0
- data/lib/rubygems/resolver/conflict.rb +122 -0
- data/lib/rubygems/{dependency_resolver → resolver}/current_set.rb +1 -4
- data/lib/rubygems/{dependency_resolver → resolver}/dependency_request.rb +37 -7
- data/lib/rubygems/resolver/git_set.rb +119 -0
- data/lib/rubygems/resolver/git_specification.rb +35 -0
- data/lib/rubygems/resolver/index_set.rb +74 -0
- data/lib/rubygems/resolver/index_specification.rb +69 -0
- data/lib/rubygems/resolver/installed_specification.rb +40 -0
- data/lib/rubygems/{dependency_resolver → resolver}/installer_set.rb +18 -17
- data/lib/rubygems/resolver/local_specification.rb +16 -0
- data/lib/rubygems/resolver/lock_set.rb +78 -0
- data/lib/rubygems/resolver/lock_specification.rb +58 -0
- data/lib/rubygems/resolver/requirement_list.rb +81 -0
- data/lib/rubygems/resolver/set.rb +27 -0
- data/lib/rubygems/resolver/spec_specification.rb +58 -0
- data/lib/rubygems/resolver/specification.rb +89 -0
- data/lib/rubygems/resolver/stats.rb +44 -0
- data/lib/rubygems/resolver/vendor_set.rb +83 -0
- data/lib/rubygems/resolver/vendor_specification.rb +24 -0
- data/lib/rubygems/security/trust_dir.rb +16 -2
- data/lib/rubygems/source.rb +71 -18
- data/lib/rubygems/source/git.rb +218 -0
- data/lib/rubygems/source/installed.rb +8 -1
- data/lib/rubygems/source/local.rb +14 -8
- data/lib/rubygems/source/lock.rb +48 -0
- data/lib/rubygems/source/specific_file.rb +14 -3
- data/lib/rubygems/source/vendor.rb +27 -0
- data/lib/rubygems/source_list.rb +74 -12
- data/lib/rubygems/spec_fetcher.rb +36 -4
- data/lib/rubygems/specification.rb +214 -65
- data/lib/rubygems/stub_specification.rb +57 -1
- data/lib/rubygems/syck_hack.rb +3 -3
- data/lib/rubygems/test_case.rb +226 -59
- data/lib/rubygems/test_utilities.rb +198 -0
- data/lib/rubygems/uninstaller.rb +22 -10
- data/lib/rubygems/uri_formatter.rb +20 -0
- data/lib/rubygems/user_interaction.rb +193 -71
- data/lib/rubygems/util.rb +121 -0
- data/lib/rubygems/util/list.rb +4 -0
- data/lib/rubygems/util/stringio.rb +34 -0
- data/lib/rubygems/validator.rb +6 -2
- data/lib/rubygems/version.rb +4 -8
- data/test/rubygems/test_bundled_ca.rb +1 -1
- data/test/rubygems/test_gem.rb +137 -29
- data/test/rubygems/test_gem_available_set.rb +19 -0
- data/test/rubygems/test_gem_commands_build_command.rb +1 -1
- data/test/rubygems/test_gem_commands_cert_command.rb +2 -2
- data/test/rubygems/test_gem_commands_cleanup_command.rb +13 -13
- data/test/rubygems/test_gem_commands_dependency_command.rb +24 -34
- data/test/rubygems/test_gem_commands_fetch_command.rb +43 -48
- data/test/rubygems/test_gem_commands_install_command.rb +244 -279
- data/test/rubygems/test_gem_commands_list_command.rb +3 -3
- data/test/rubygems/test_gem_commands_outdated_command.rb +7 -12
- data/test/rubygems/test_gem_commands_pristine_command.rb +73 -27
- data/test/rubygems/test_gem_commands_push_command.rb +76 -8
- data/test/rubygems/test_gem_commands_query_command.rb +239 -49
- data/test/rubygems/test_gem_commands_sources_command.rb +10 -43
- data/test/rubygems/test_gem_commands_specification_command.rb +24 -47
- data/test/rubygems/test_gem_commands_stale_command.rb +2 -2
- data/test/rubygems/test_gem_commands_uninstall_command.rb +3 -3
- data/test/rubygems/test_gem_commands_unpack_command.rb +16 -30
- data/test/rubygems/test_gem_commands_update_command.rb +149 -134
- data/test/rubygems/test_gem_commands_which_command.rb +4 -2
- data/test/rubygems/test_gem_dependency_installer.rb +68 -0
- data/test/rubygems/test_gem_dependency_list.rb +17 -17
- data/test/rubygems/test_gem_dependency_resolution_error.rb +28 -0
- data/test/rubygems/test_gem_doctor.rb +1 -1
- data/test/rubygems/test_gem_ext_builder.rb +178 -8
- data/test/rubygems/test_gem_ext_cmake_builder.rb +1 -7
- data/test/rubygems/test_gem_ext_configure_builder.rb +8 -10
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +18 -21
- data/test/rubygems/test_gem_ext_rake_builder.rb +1 -3
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +10 -6
- data/test/rubygems/test_gem_indexer.rb +6 -6
- data/test/rubygems/test_gem_installer.rb +29 -10
- data/test/rubygems/test_gem_local_remote_options.rb +1 -1
- data/test/rubygems/test_gem_package.rb +18 -0
- data/test/rubygems/test_gem_rdoc.rb +1 -1
- data/test/rubygems/test_gem_remote_fetcher.rb +1 -1
- data/test/rubygems/test_gem_request.rb +37 -10
- data/test/rubygems/test_gem_request_set.rb +271 -9
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +684 -0
- data/test/rubygems/test_gem_request_set_lockfile.rb +849 -0
- data/test/rubygems/test_gem_requirement.rb +21 -0
- data/test/rubygems/{test_gem_dependency_resolver.rb → test_gem_resolver.rb} +231 -70
- data/test/rubygems/test_gem_resolver_activation_request.rb +63 -0
- data/test/rubygems/test_gem_resolver_api_set.rb +167 -0
- data/test/rubygems/test_gem_resolver_api_specification.rb +104 -0
- data/test/rubygems/test_gem_resolver_best_set.rb +30 -0
- data/test/rubygems/test_gem_resolver_conflict.rb +75 -0
- data/test/rubygems/test_gem_resolver_dependency_request.rb +20 -0
- data/test/rubygems/test_gem_resolver_git_set.rb +148 -0
- data/test/rubygems/test_gem_resolver_git_specification.rb +100 -0
- data/test/rubygems/test_gem_resolver_index_set.rb +28 -0
- data/test/rubygems/test_gem_resolver_index_specification.rb +89 -0
- data/test/rubygems/test_gem_resolver_installed_specification.rb +49 -0
- data/test/rubygems/test_gem_resolver_installer_set.rb +22 -0
- data/test/rubygems/test_gem_resolver_local_specification.rb +45 -0
- data/test/rubygems/test_gem_resolver_lock_set.rb +57 -0
- data/test/rubygems/test_gem_resolver_lock_specification.rb +87 -0
- data/test/rubygems/test_gem_resolver_requirement_list.rb +20 -0
- data/test/rubygems/test_gem_resolver_specification.rb +32 -0
- data/test/rubygems/test_gem_resolver_vendor_set.rb +67 -0
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +83 -0
- data/test/rubygems/test_gem_server.rb +4 -4
- data/test/rubygems/test_gem_source.rb +54 -64
- data/test/rubygems/test_gem_source_git.rb +231 -0
- data/test/rubygems/test_gem_source_list.rb +24 -0
- data/test/rubygems/test_gem_source_local.rb +1 -1
- data/test/rubygems/test_gem_source_lock.rb +114 -0
- data/test/rubygems/test_gem_source_vendor.rb +27 -0
- data/test/rubygems/test_gem_spec_fetcher.rb +116 -61
- data/test/rubygems/test_gem_specification.rb +526 -94
- data/test/rubygems/test_gem_stub_specification.rb +123 -10
- data/test/rubygems/test_gem_uninstaller.rb +28 -2
- data/test/rubygems/test_gem_util.rb +31 -0
- data/test/rubygems/test_gem_validator.rb +9 -0
- data/util/update_bundled_ca_certificates.rb +8 -1
- metadata +89 -29
- metadata.gz.sig +2 -4
- data/lib/rubygems/dependency_resolver.rb +0 -254
- data/lib/rubygems/dependency_resolver/activation_request.rb +0 -109
- data/lib/rubygems/dependency_resolver/api_set.rb +0 -65
- data/lib/rubygems/dependency_resolver/api_specification.rb +0 -39
- data/lib/rubygems/dependency_resolver/composed_set.rb +0 -18
- data/lib/rubygems/dependency_resolver/dependency_conflict.rb +0 -85
- data/lib/rubygems/dependency_resolver/index_set.rb +0 -64
- data/lib/rubygems/dependency_resolver/index_specification.rb +0 -60
- data/lib/rubygems/dependency_resolver/installed_specification.rb +0 -52
- data/test/rubygems/test_gem_dependency_resolver_api_specification.rb +0 -33
- data/test/rubygems/test_gem_dependency_resolver_dependency_conflict.rb +0 -36
- data/test/rubygems/test_gem_dependency_resolver_index_set.rb +0 -53
- data/test/rubygems/test_gem_dependency_resolver_index_specification.rb +0 -73
- data/test/rubygems/test_gem_dependency_resolver_installed_specification.rb +0 -19
- data/test/rubygems/test_gem_dependency_resolver_installer_set.rb +0 -28
@@ -1,20 +1,27 @@
|
|
1
|
-
|
1
|
+
##
|
2
|
+
# A set of gems for installation sourced from remote sources and local .gem
|
3
|
+
# files
|
4
|
+
|
5
|
+
class Gem::Resolver::InstallerSet < Gem::Resolver::Set
|
2
6
|
|
3
7
|
##
|
4
8
|
# List of Gem::Specification objects that must always be installed.
|
5
9
|
|
6
|
-
attr_reader :always_install
|
10
|
+
attr_reader :always_install # :nodoc:
|
7
11
|
|
8
12
|
##
|
9
13
|
# Only install gems in the always_install list
|
10
14
|
|
11
|
-
attr_accessor :ignore_dependencies
|
15
|
+
attr_accessor :ignore_dependencies # :nodoc:
|
12
16
|
|
13
17
|
##
|
14
18
|
# Do not look in the installed set when finding specifications. This is
|
15
19
|
# used by the --install-dir option to `gem install`
|
16
20
|
|
17
|
-
attr_accessor :ignore_installed
|
21
|
+
attr_accessor :ignore_installed # :nodoc:
|
22
|
+
|
23
|
+
##
|
24
|
+
# Creates a new InstallerSet that will look for gems in +domain+.
|
18
25
|
|
19
26
|
def initialize domain
|
20
27
|
@domain = domain
|
@@ -32,14 +39,14 @@ class Gem::DependencyResolver::InstallerSet
|
|
32
39
|
##
|
33
40
|
# Should local gems should be considered?
|
34
41
|
|
35
|
-
def consider_local?
|
42
|
+
def consider_local? # :nodoc:
|
36
43
|
@domain == :both or @domain == :local
|
37
44
|
end
|
38
45
|
|
39
46
|
##
|
40
47
|
# Should remote gems should be considered?
|
41
48
|
|
42
|
-
def consider_remote?
|
49
|
+
def consider_remote? # :nodoc:
|
43
50
|
@domain == :both or @domain == :remote
|
44
51
|
end
|
45
52
|
|
@@ -60,14 +67,14 @@ class Gem::DependencyResolver::InstallerSet
|
|
60
67
|
dep.matching_specs.each do |gemspec|
|
61
68
|
next if @always_install.include? gemspec
|
62
69
|
|
63
|
-
res << Gem::
|
70
|
+
res << Gem::Resolver::InstalledSpecification.new(self, gemspec)
|
64
71
|
end unless @ignore_installed
|
65
72
|
|
66
73
|
if consider_local? then
|
67
74
|
local_source = Gem::Source::Local.new
|
68
75
|
|
69
76
|
if spec = local_source.find_gem(name, dep.requirement) then
|
70
|
-
res << Gem::
|
77
|
+
res << Gem::Resolver::IndexSpecification.new(
|
71
78
|
self, spec.name, spec.version, local_source, spec.platform)
|
72
79
|
end
|
73
80
|
end
|
@@ -77,7 +84,7 @@ class Gem::DependencyResolver::InstallerSet
|
|
77
84
|
|
78
85
|
@all[name].each do |remote_source, n|
|
79
86
|
if dep.match? n then
|
80
|
-
res << Gem::
|
87
|
+
res << Gem::Resolver::IndexSpecification.new(
|
81
88
|
self, n.name, n.version, remote_source, n.platform)
|
82
89
|
end
|
83
90
|
end
|
@@ -97,7 +104,7 @@ class Gem::DependencyResolver::InstallerSet
|
|
97
104
|
##
|
98
105
|
# Loads remote prerelease specs if +dep+ is a prerelease dependency
|
99
106
|
|
100
|
-
def load_remote_specs dep
|
107
|
+
def load_remote_specs dep # :nodoc:
|
101
108
|
types = [:released]
|
102
109
|
types << :prerelease if dep.prerelease?
|
103
110
|
|
@@ -119,7 +126,7 @@ class Gem::DependencyResolver::InstallerSet
|
|
119
126
|
# Called from IndexSpecification to get a true Specification
|
120
127
|
# object.
|
121
128
|
|
122
|
-
def load_spec name, ver, platform, source
|
129
|
+
def load_spec name, ver, platform, source # :nodoc:
|
123
130
|
key = "#{name}-#{ver}-#{platform}"
|
124
131
|
|
125
132
|
@specs.fetch key do
|
@@ -129,12 +136,6 @@ class Gem::DependencyResolver::InstallerSet
|
|
129
136
|
end
|
130
137
|
end
|
131
138
|
|
132
|
-
##
|
133
|
-
# No prefetching needed since we load the whole index in initially.
|
134
|
-
|
135
|
-
def prefetch(reqs)
|
136
|
-
end
|
137
|
-
|
138
139
|
def pretty_print q # :nodoc:
|
139
140
|
q.group 2, '[InstallerSet', ']' do
|
140
141
|
q.breakable
|
@@ -0,0 +1,16 @@
|
|
1
|
+
##
|
2
|
+
# A LocalSpecification comes from a .gem file on the local filesystem.
|
3
|
+
|
4
|
+
class Gem::Resolver::LocalSpecification < Gem::Resolver::SpecSpecification
|
5
|
+
|
6
|
+
##
|
7
|
+
# Returns +true+ if this gem is installable for the current platform.
|
8
|
+
|
9
|
+
def installable_platform?
|
10
|
+
return true if @source.kind_of? Gem::Source::SpecificFile
|
11
|
+
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
@@ -0,0 +1,78 @@
|
|
1
|
+
##
|
2
|
+
# A set of gems from a gem dependencies lockfile.
|
3
|
+
|
4
|
+
class Gem::Resolver::LockSet < Gem::Resolver::Set
|
5
|
+
|
6
|
+
attr_reader :specs # :nodoc:
|
7
|
+
|
8
|
+
##
|
9
|
+
# Creates a new LockSet from the given +source+
|
10
|
+
|
11
|
+
def initialize source
|
12
|
+
@source = Gem::Source::Lock.new source
|
13
|
+
@specs = []
|
14
|
+
end
|
15
|
+
|
16
|
+
##
|
17
|
+
# Creates a new IndexSpecification in this set using the given +name+,
|
18
|
+
# +version+ and +platform+.
|
19
|
+
#
|
20
|
+
# The specification's set will be the current set, and the source will be
|
21
|
+
# the current set's source.
|
22
|
+
|
23
|
+
def add name, version, platform # :nodoc:
|
24
|
+
version = Gem::Version.new version
|
25
|
+
|
26
|
+
spec =
|
27
|
+
Gem::Resolver::LockSpecification.new self, name, version, @source,
|
28
|
+
platform
|
29
|
+
|
30
|
+
@specs << spec
|
31
|
+
|
32
|
+
spec
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Returns an Array of IndexSpecification objects matching the
|
37
|
+
# DependencyRequest +req+.
|
38
|
+
|
39
|
+
def find_all req
|
40
|
+
@specs.select do |spec|
|
41
|
+
req.matches_spec? spec
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# Loads a Gem::Specification with the given +name+, +version+ and
|
47
|
+
# +platform+. +source+ is ignored.
|
48
|
+
|
49
|
+
def load_spec name, version, platform, source # :nodoc:
|
50
|
+
dep = Gem::Dependency.new name, version
|
51
|
+
|
52
|
+
found = @specs.find do |spec|
|
53
|
+
dep.matches_spec? spec and spec.platform == platform
|
54
|
+
end
|
55
|
+
|
56
|
+
tuple = Gem::NameTuple.new found.name, found.version, found.platform
|
57
|
+
|
58
|
+
found.source.fetch_spec tuple
|
59
|
+
end
|
60
|
+
|
61
|
+
def pretty_print q # :nodoc:
|
62
|
+
q.group 2, '[LockSet', ']' do
|
63
|
+
q.breakable
|
64
|
+
q.text 'source:'
|
65
|
+
|
66
|
+
q.breakable
|
67
|
+
q.pp @source
|
68
|
+
|
69
|
+
q.breakable
|
70
|
+
q.text 'specs:'
|
71
|
+
|
72
|
+
q.breakable
|
73
|
+
q.pp @specs.map { |spec| spec.full_name }
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
##
|
2
|
+
# The LockSpecification comes from a lockfile (Gem::RequestSet::Lockfile).
|
3
|
+
#
|
4
|
+
# A LockSpecification's dependency information is pre-filled from the
|
5
|
+
# lockfile.
|
6
|
+
|
7
|
+
class Gem::Resolver::LockSpecification < Gem::Resolver::Specification
|
8
|
+
|
9
|
+
def initialize set, name, version, source, platform
|
10
|
+
super()
|
11
|
+
|
12
|
+
@name = name
|
13
|
+
@platform = platform
|
14
|
+
@set = set
|
15
|
+
@source = source
|
16
|
+
@version = version
|
17
|
+
|
18
|
+
@dependencies = []
|
19
|
+
@spec = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
##
|
23
|
+
# This is a null install as a locked specification is considered installed.
|
24
|
+
# +options+ are ignored.
|
25
|
+
|
26
|
+
def install options
|
27
|
+
destination = options[:install_dir] || Gem.dir
|
28
|
+
|
29
|
+
if File.exist? File.join(destination, 'specifications', spec.spec_name) then
|
30
|
+
yield nil
|
31
|
+
return
|
32
|
+
end
|
33
|
+
|
34
|
+
super
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Adds +dependency+ from the lockfile to this specification
|
39
|
+
|
40
|
+
def add_dependency dependency # :nodoc:
|
41
|
+
@dependencies << dependency
|
42
|
+
end
|
43
|
+
|
44
|
+
##
|
45
|
+
# A specification constructed from the lockfile is returned
|
46
|
+
|
47
|
+
def spec
|
48
|
+
@spec ||= Gem::Specification.new do |s|
|
49
|
+
s.name = @name
|
50
|
+
s.version = @version
|
51
|
+
s.platform = @platform
|
52
|
+
|
53
|
+
s.dependencies.concat @dependencies
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
@@ -0,0 +1,81 @@
|
|
1
|
+
##
|
2
|
+
# The RequirementList is used to hold the requirements being considered
|
3
|
+
# while resolving a set of gems.
|
4
|
+
#
|
5
|
+
# The RequirementList acts like a queue where the oldest items are removed
|
6
|
+
# first.
|
7
|
+
|
8
|
+
class Gem::Resolver::RequirementList
|
9
|
+
|
10
|
+
include Enumerable
|
11
|
+
|
12
|
+
##
|
13
|
+
# Creates a new RequirementList.
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@exact = []
|
17
|
+
@list = []
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize_copy other # :nodoc:
|
21
|
+
@exact = @exact.dup
|
22
|
+
@list = @list.dup
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# Adds Resolver::DependencyRequest +req+ to this requirements list.
|
27
|
+
|
28
|
+
def add(req)
|
29
|
+
if req.requirement.exact?
|
30
|
+
@exact.push req
|
31
|
+
else
|
32
|
+
@list.push req
|
33
|
+
end
|
34
|
+
req
|
35
|
+
end
|
36
|
+
|
37
|
+
##
|
38
|
+
# Enumerates requirements in the list
|
39
|
+
|
40
|
+
def each # :nodoc:
|
41
|
+
return enum_for __method__ unless block_given?
|
42
|
+
|
43
|
+
@exact.each do |requirement|
|
44
|
+
yield requirement
|
45
|
+
end
|
46
|
+
|
47
|
+
@list.each do |requirement|
|
48
|
+
yield requirement
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
##
|
53
|
+
# How many elements are in the list
|
54
|
+
|
55
|
+
def size
|
56
|
+
@exact.size + @list.size
|
57
|
+
end
|
58
|
+
|
59
|
+
##
|
60
|
+
# Is the list empty?
|
61
|
+
|
62
|
+
def empty?
|
63
|
+
@exact.empty? && @list.empty?
|
64
|
+
end
|
65
|
+
|
66
|
+
##
|
67
|
+
# Remove the oldest DependencyRequest from the list.
|
68
|
+
|
69
|
+
def remove
|
70
|
+
return @exact.shift unless @exact.empty?
|
71
|
+
@list.shift
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Returns the oldest five entries from the list.
|
76
|
+
|
77
|
+
def next5
|
78
|
+
x = @exact[0,5]
|
79
|
+
x + @list[0,5 - x.size]
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
##
|
2
|
+
# Resolver sets are used to look up specifications (and their
|
3
|
+
# dependencies) used in resolution. This set is abstract.
|
4
|
+
|
5
|
+
class Gem::Resolver::Set
|
6
|
+
|
7
|
+
##
|
8
|
+
# The find_all method must be implemented. It returns all Resolver
|
9
|
+
# Specification objects matching the given DependencyRequest +req+.
|
10
|
+
|
11
|
+
def find_all req
|
12
|
+
raise NotImplementedError
|
13
|
+
end
|
14
|
+
|
15
|
+
##
|
16
|
+
# The #prefetch method may be overridden, but this is not necessary. This
|
17
|
+
# default implementation does nothing, which is suitable for sets where
|
18
|
+
# looking up a specification is cheap (such as installed gems).
|
19
|
+
#
|
20
|
+
# When overridden, the #prefetch method should look up specifications
|
21
|
+
# matching +reqs+.
|
22
|
+
|
23
|
+
def prefetch reqs
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
##
|
2
|
+
# The Resolver::SpecSpecification contains common functionality for
|
3
|
+
# Resolver specifications that are backed by a Gem::Specification.
|
4
|
+
|
5
|
+
class Gem::Resolver::SpecSpecification < Gem::Resolver::Specification
|
6
|
+
|
7
|
+
attr_reader :spec # :nodoc:
|
8
|
+
|
9
|
+
##
|
10
|
+
# A SpecSpecification is created for a +set+ for a Gem::Specification in
|
11
|
+
# +spec+. The +source+ is either where the +spec+ came from, or should be
|
12
|
+
# loaded from.
|
13
|
+
|
14
|
+
def initialize set, spec, source = nil
|
15
|
+
@set = set
|
16
|
+
@source = source
|
17
|
+
@spec = spec
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# The dependencies of the gem for this specification
|
22
|
+
|
23
|
+
def dependencies
|
24
|
+
spec.dependencies
|
25
|
+
end
|
26
|
+
|
27
|
+
##
|
28
|
+
# The name and version of the specification.
|
29
|
+
#
|
30
|
+
# Unlike Gem::Specification#full_name, the platform is not included.
|
31
|
+
|
32
|
+
def full_name
|
33
|
+
"#{spec.name}-#{spec.version}"
|
34
|
+
end
|
35
|
+
|
36
|
+
##
|
37
|
+
# The name of the gem for this specification
|
38
|
+
|
39
|
+
def name
|
40
|
+
spec.name
|
41
|
+
end
|
42
|
+
|
43
|
+
##
|
44
|
+
# The platform this gem works on.
|
45
|
+
|
46
|
+
def platform
|
47
|
+
spec.platform
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# The version of the gem for this specification.
|
52
|
+
|
53
|
+
def version
|
54
|
+
spec.version
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
##
|
2
|
+
# A Resolver::Specification contains a subset of the information
|
3
|
+
# contained in a Gem::Specification. Only the information necessary for
|
4
|
+
# dependency resolution in the resolver is included.
|
5
|
+
|
6
|
+
class Gem::Resolver::Specification
|
7
|
+
|
8
|
+
##
|
9
|
+
# The dependencies of the gem for this specification
|
10
|
+
|
11
|
+
attr_reader :dependencies
|
12
|
+
|
13
|
+
##
|
14
|
+
# The name of the gem for this specification
|
15
|
+
|
16
|
+
attr_reader :name
|
17
|
+
|
18
|
+
##
|
19
|
+
# The platform this gem works on.
|
20
|
+
|
21
|
+
attr_reader :platform
|
22
|
+
|
23
|
+
##
|
24
|
+
# The set this specification came from.
|
25
|
+
|
26
|
+
attr_reader :set
|
27
|
+
|
28
|
+
##
|
29
|
+
# The source for this specification
|
30
|
+
|
31
|
+
attr_reader :source
|
32
|
+
|
33
|
+
##
|
34
|
+
# The version of the gem for this specification.
|
35
|
+
|
36
|
+
attr_reader :version
|
37
|
+
|
38
|
+
##
|
39
|
+
# Sets default instance variables for the specification.
|
40
|
+
|
41
|
+
def initialize
|
42
|
+
@dependencies = nil
|
43
|
+
@name = nil
|
44
|
+
@platform = nil
|
45
|
+
@set = nil
|
46
|
+
@source = nil
|
47
|
+
@version = nil
|
48
|
+
end
|
49
|
+
|
50
|
+
##
|
51
|
+
# The name and version of the specification.
|
52
|
+
#
|
53
|
+
# Unlike Gem::Specification#full_name, the platform is not included.
|
54
|
+
|
55
|
+
def full_name
|
56
|
+
"#{@name}-#{@version}"
|
57
|
+
end
|
58
|
+
|
59
|
+
##
|
60
|
+
# Installs this specification using the Gem::Installer +options+. The
|
61
|
+
# install method yields a Gem::Installer instance, which indicates the
|
62
|
+
# gem will be installed, or +nil+, which indicates the gem is already
|
63
|
+
# installed.
|
64
|
+
|
65
|
+
def install options
|
66
|
+
require 'rubygems/installer'
|
67
|
+
|
68
|
+
destination = options[:install_dir] || Gem.dir
|
69
|
+
|
70
|
+
Gem.ensure_gem_subdirectories destination
|
71
|
+
|
72
|
+
gem = source.download spec, destination
|
73
|
+
|
74
|
+
installer = Gem::Installer.new gem, options
|
75
|
+
|
76
|
+
yield installer if block_given?
|
77
|
+
|
78
|
+
installer.install
|
79
|
+
end
|
80
|
+
|
81
|
+
##
|
82
|
+
# Returns true if this specification is installable on this platform.
|
83
|
+
|
84
|
+
def installable_platform?
|
85
|
+
Gem::Platform.match spec.platform
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|