rubygems-update 2.2.5 → 2.3.0
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 +4 -1
- data/CONTRIBUTING +20 -0
- data/History.txt +117 -14
- data/Manifest.txt +11 -2
- data/README.rdoc +1 -1
- data/Rakefile +0 -3
- data/lib/rubygems.rb +31 -11
- data/lib/rubygems/available_set.rb +1 -1
- data/lib/rubygems/basic_specification.rb +20 -10
- data/lib/rubygems/command.rb +4 -1
- data/lib/rubygems/commands/cert_command.rb +11 -13
- data/lib/rubygems/commands/cleanup_command.rb +2 -2
- data/lib/rubygems/commands/dependency_command.rb +2 -2
- data/lib/rubygems/commands/environment_command.rb +5 -2
- data/lib/rubygems/commands/help_command.rb +199 -20
- data/lib/rubygems/commands/install_command.rb +40 -10
- data/lib/rubygems/commands/list_command.rb +2 -2
- data/lib/rubygems/commands/open_command.rb +81 -0
- data/lib/rubygems/commands/search_command.rb +5 -5
- data/lib/rubygems/commands/setup_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +8 -5
- data/lib/rubygems/commands/yank_command.rb +8 -13
- data/lib/rubygems/config_file.rb +13 -2
- data/lib/rubygems/dependency.rb +29 -16
- data/lib/rubygems/dependency_installer.rb +44 -10
- data/lib/rubygems/doctor.rb +1 -1
- data/lib/rubygems/errors.rb +30 -0
- data/lib/rubygems/exceptions.rb +20 -0
- data/lib/rubygems/ext/builder.rb +1 -1
- data/lib/rubygems/gemcutter_utilities.rb +1 -1
- data/lib/rubygems/installer.rb +4 -4
- data/lib/rubygems/name_tuple.rb +3 -1
- data/lib/rubygems/package.rb +27 -14
- data/lib/rubygems/package/file_source.rb +33 -0
- data/lib/rubygems/package/io_source.rb +45 -0
- data/lib/rubygems/package/old.rb +5 -5
- data/lib/rubygems/package/source.rb +3 -0
- data/lib/rubygems/platform.rb +2 -1
- data/lib/rubygems/rdoc.rb +1 -1
- data/lib/rubygems/remote_fetcher.rb +59 -18
- data/lib/rubygems/request.rb +71 -101
- data/lib/rubygems/request/connection_pools.rb +77 -0
- data/lib/rubygems/request/http_pool.rb +38 -0
- data/lib/rubygems/request/https_pool.rb +10 -0
- data/lib/rubygems/request_set.rb +65 -20
- data/lib/rubygems/request_set/gem_dependency_api.rb +234 -14
- data/lib/rubygems/request_set/lockfile.rb +65 -22
- data/lib/rubygems/requirement.rb +3 -0
- data/lib/rubygems/resolver.rb +33 -16
- data/lib/rubygems/resolver/activation_request.rb +7 -0
- data/lib/rubygems/resolver/api_set.rb +12 -2
- data/lib/rubygems/resolver/api_specification.rb +6 -0
- data/lib/rubygems/resolver/composed_set.rb +4 -0
- data/lib/rubygems/resolver/dependency_request.rb +20 -1
- data/lib/rubygems/resolver/git_set.rb +1 -1
- data/lib/rubygems/resolver/git_specification.rb +1 -1
- data/lib/rubygems/resolver/index_set.rb +3 -1
- data/lib/rubygems/resolver/installed_specification.rb +19 -1
- data/lib/rubygems/resolver/installer_set.rb +84 -4
- data/lib/rubygems/resolver/local_specification.rb +25 -0
- data/lib/rubygems/resolver/lock_set.rb +13 -9
- data/lib/rubygems/resolver/lock_specification.rb +1 -1
- data/lib/rubygems/resolver/set.rb +6 -0
- data/lib/rubygems/resolver/spec_specification.rb +0 -2
- data/lib/rubygems/resolver/specification.rb +23 -2
- data/lib/rubygems/resolver/vendor_set.rb +1 -1
- data/lib/rubygems/resolver/vendor_specification.rb +1 -1
- data/lib/rubygems/security/policy.rb +1 -0
- data/lib/rubygems/server.rb +36 -1
- data/lib/rubygems/source.rb +6 -2
- data/lib/rubygems/source/git.rb +1 -1
- data/lib/rubygems/source/installed.rb +4 -0
- data/lib/rubygems/source/specific_file.rb +6 -1
- data/lib/rubygems/spec_fetcher.rb +6 -13
- data/lib/rubygems/specification.rb +91 -63
- data/lib/rubygems/stub_specification.rb +9 -0
- data/lib/rubygems/test_case.rb +4 -2
- data/lib/rubygems/text.rb +15 -5
- data/lib/rubygems/uninstaller.rb +4 -1
- data/lib/rubygems/user_interaction.rb +8 -0
- data/lib/rubygems/version.rb +5 -1
- data/test/rubygems/test_gem.rb +88 -2
- data/test/rubygems/test_gem_available_set.rb +11 -8
- data/test/rubygems/test_gem_command.rb +55 -0
- data/test/rubygems/test_gem_commands_cert_command.rb +1 -0
- data/test/rubygems/test_gem_commands_environment_command.rb +1 -0
- data/test/rubygems/test_gem_commands_help_command.rb +7 -0
- data/test/rubygems/test_gem_commands_install_command.rb +71 -4
- data/test/rubygems/test_gem_commands_open_command.rb +46 -0
- data/test/rubygems/test_gem_commands_setup_command.rb +9 -0
- data/test/rubygems/test_gem_commands_update_command.rb +48 -0
- data/test/rubygems/test_gem_commands_yank_command.rb +2 -2
- data/test/rubygems/test_gem_config_file.rb +19 -7
- data/test/rubygems/test_gem_dependency.rb +86 -2
- data/test/rubygems/test_gem_dependency_installer.rb +36 -164
- data/test/rubygems/test_gem_gemcutter_utilities.rb +9 -0
- data/test/rubygems/test_gem_installer.rb +6 -1
- data/test/rubygems/test_gem_name_tuple.rb +7 -0
- data/test/rubygems/test_gem_package.rb +17 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +65 -46
- data/test/rubygems/test_gem_request.rb +75 -61
- data/test/rubygems/test_gem_request_connection_pools.rb +83 -0
- data/test/rubygems/test_gem_request_set.rb +156 -1
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +72 -27
- data/test/rubygems/test_gem_request_set_lockfile.rb +335 -0
- data/test/rubygems/test_gem_requirement.rb +5 -0
- data/test/rubygems/test_gem_resolver.rb +91 -2
- data/test/rubygems/test_gem_resolver_activation_request.rb +10 -0
- data/test/rubygems/test_gem_resolver_api_set.rb +2 -2
- data/test/rubygems/test_gem_resolver_api_specification.rb +40 -0
- data/test/rubygems/test_gem_resolver_composed_set.rb +14 -0
- data/test/rubygems/test_gem_resolver_dependency_request.rb +55 -0
- data/test/rubygems/test_gem_resolver_git_set.rb +26 -0
- data/test/rubygems/test_gem_resolver_index_set.rb +28 -2
- data/test/rubygems/test_gem_resolver_installer_set.rb +143 -0
- data/test/rubygems/test_gem_resolver_lock_set.rb +12 -6
- data/test/rubygems/test_gem_resolver_lock_specification.rb +1 -1
- data/test/rubygems/test_gem_resolver_specification.rb +32 -0
- data/test/rubygems/test_gem_resolver_vendor_set.rb +14 -0
- data/test/rubygems/test_gem_security_policy.rb +2 -2
- data/test/rubygems/test_gem_server.rb +69 -4
- data/test/rubygems/test_gem_source.rb +4 -1
- data/test/rubygems/test_gem_source_git.rb +15 -0
- data/test/rubygems/test_gem_source_specific_file.rb +4 -0
- data/test/rubygems/test_gem_specification.rb +82 -27
- data/test/rubygems/test_gem_stub_specification.rb +61 -23
- data/test/rubygems/test_gem_uninstaller.rb +23 -0
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +32 -0
- metadata +187 -33
- metadata.gz.sig +0 -0
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem +0 -25
- data/lib/rubygems/ssl_certs/AddTrustExternalCARoot.pem +0 -32
@@ -6,13 +6,16 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
|
|
6
6
|
attr_reader :specs # :nodoc:
|
7
7
|
|
8
8
|
##
|
9
|
-
# Creates a new LockSet from the given +
|
9
|
+
# Creates a new LockSet from the given +sources+
|
10
10
|
|
11
|
-
def initialize
|
11
|
+
def initialize sources
|
12
12
|
super()
|
13
13
|
|
14
|
-
@
|
15
|
-
|
14
|
+
@sources = sources.map do |source|
|
15
|
+
Gem::Source::Lock.new source
|
16
|
+
end
|
17
|
+
|
18
|
+
@specs = []
|
16
19
|
end
|
17
20
|
|
18
21
|
##
|
@@ -25,13 +28,14 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
|
|
25
28
|
def add name, version, platform # :nodoc:
|
26
29
|
version = Gem::Version.new version
|
27
30
|
|
28
|
-
|
29
|
-
Gem::Resolver::LockSpecification.new self, name, version,
|
31
|
+
specs = @sources.map do |source|
|
32
|
+
Gem::Resolver::LockSpecification.new self, name, version, source,
|
30
33
|
platform
|
34
|
+
end
|
31
35
|
|
32
|
-
@specs
|
36
|
+
@specs.concat specs
|
33
37
|
|
34
|
-
|
38
|
+
specs
|
35
39
|
end
|
36
40
|
|
37
41
|
##
|
@@ -40,7 +44,7 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set
|
|
40
44
|
|
41
45
|
def find_all req
|
42
46
|
@specs.select do |spec|
|
43
|
-
req.
|
47
|
+
req.match? spec
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
@@ -23,7 +23,7 @@ class Gem::Resolver::LockSpecification < Gem::Resolver::Specification
|
|
23
23
|
# This is a null install as a locked specification is considered installed.
|
24
24
|
# +options+ are ignored.
|
25
25
|
|
26
|
-
def install options
|
26
|
+
def install options = {}
|
27
27
|
destination = options[:install_dir] || Gem.dir
|
28
28
|
|
29
29
|
if File.exist? File.join(destination, 'specifications', spec.spec_name) then
|
@@ -30,6 +30,14 @@ class Gem::Resolver::Specification
|
|
30
30
|
|
31
31
|
attr_reader :source
|
32
32
|
|
33
|
+
##
|
34
|
+
# The Gem::Specification for this Resolver::Specification.
|
35
|
+
#
|
36
|
+
# Implementers, note that #install updates @spec, so be sure to cache the
|
37
|
+
# Gem::Specification in @spec when overriding.
|
38
|
+
|
39
|
+
attr_reader :spec
|
40
|
+
|
33
41
|
##
|
34
42
|
# The version of the gem for this specification.
|
35
43
|
|
@@ -47,6 +55,13 @@ class Gem::Resolver::Specification
|
|
47
55
|
@version = nil
|
48
56
|
end
|
49
57
|
|
58
|
+
##
|
59
|
+
# Fetches development dependencies if the source does not provide them by
|
60
|
+
# default (see APISpecification).
|
61
|
+
|
62
|
+
def fetch_development_dependencies # :nodoc:
|
63
|
+
end
|
64
|
+
|
50
65
|
##
|
51
66
|
# The name and version of the specification.
|
52
67
|
#
|
@@ -61,8 +76,11 @@ class Gem::Resolver::Specification
|
|
61
76
|
# install method yields a Gem::Installer instance, which indicates the
|
62
77
|
# gem will be installed, or +nil+, which indicates the gem is already
|
63
78
|
# installed.
|
79
|
+
#
|
80
|
+
# After installation #spec is updated to point to the just-installed
|
81
|
+
# specification.
|
64
82
|
|
65
|
-
def install options
|
83
|
+
def install options = {}
|
66
84
|
require 'rubygems/installer'
|
67
85
|
|
68
86
|
destination = options[:install_dir] || Gem.dir
|
@@ -75,7 +93,7 @@ class Gem::Resolver::Specification
|
|
75
93
|
|
76
94
|
yield installer if block_given?
|
77
95
|
|
78
|
-
installer.install
|
96
|
+
@spec = installer.install
|
79
97
|
end
|
80
98
|
|
81
99
|
##
|
@@ -85,5 +103,8 @@ class Gem::Resolver::Specification
|
|
85
103
|
Gem::Platform.match spec.platform
|
86
104
|
end
|
87
105
|
|
106
|
+
def local? # :nodoc:
|
107
|
+
false
|
108
|
+
end
|
88
109
|
end
|
89
110
|
|
@@ -51,7 +51,7 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set
|
|
51
51
|
|
52
52
|
def find_all req
|
53
53
|
@specs.values.select do |spec|
|
54
|
-
req.
|
54
|
+
req.match? spec
|
55
55
|
end.map do |spec|
|
56
56
|
source = Gem::Source::Vendor.new @directories[spec]
|
57
57
|
Gem::Resolver::VendorSpecification.new self, spec, source
|
data/lib/rubygems/server.rb
CHANGED
@@ -530,6 +530,36 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
|
530
530
|
end
|
531
531
|
end
|
532
532
|
|
533
|
+
def prerelease_specs req, res
|
534
|
+
reset_gems
|
535
|
+
|
536
|
+
res['content-type'] = 'application/x-gzip'
|
537
|
+
|
538
|
+
add_date res
|
539
|
+
|
540
|
+
specs = Gem::Specification.select do |spec|
|
541
|
+
spec.version.prerelease?
|
542
|
+
end.sort.map do |spec|
|
543
|
+
platform = spec.original_platform || Gem::Platform::RUBY
|
544
|
+
[spec.name, spec.version, platform]
|
545
|
+
end
|
546
|
+
|
547
|
+
specs = Marshal.dump specs
|
548
|
+
|
549
|
+
if req.path =~ /\.gz$/ then
|
550
|
+
specs = Gem.gzip specs
|
551
|
+
res['content-type'] = 'application/x-gzip'
|
552
|
+
else
|
553
|
+
res['content-type'] = 'application/octet-stream'
|
554
|
+
end
|
555
|
+
|
556
|
+
if req.request_method == 'HEAD' then
|
557
|
+
res['content-length'] = specs.length
|
558
|
+
else
|
559
|
+
res.body << specs
|
560
|
+
end
|
561
|
+
end
|
562
|
+
|
533
563
|
def quick(req, res)
|
534
564
|
reset_gems
|
535
565
|
|
@@ -537,7 +567,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
|
537
567
|
add_date res
|
538
568
|
|
539
569
|
case req.request_uri.path
|
540
|
-
when %r|^/quick/(Marshal.#{Regexp.escape Gem.marshal_version}/)?(.*?)-([0-9.]+)(-.*?)?\.gemspec\.rz$| then
|
570
|
+
when %r|^/quick/(Marshal.#{Regexp.escape Gem.marshal_version}/)?(.*?)-([0-9.]+[^-]*?)(-.*?)?\.gemspec\.rz$| then
|
541
571
|
marshal_format, name, version, platform = $1, $2, $3, $4
|
542
572
|
specs = Gem::Specification.find_all_by_name name, version
|
543
573
|
|
@@ -757,6 +787,11 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; }
|
|
757
787
|
@server.mount_proc "/latest_specs.#{Gem.marshal_version}.gz",
|
758
788
|
method(:latest_specs)
|
759
789
|
|
790
|
+
@server.mount_proc "/prerelease_specs.#{Gem.marshal_version}",
|
791
|
+
method(:prerelease_specs)
|
792
|
+
@server.mount_proc "/prerelease_specs.#{Gem.marshal_version}.gz",
|
793
|
+
method(:prerelease_specs)
|
794
|
+
|
760
795
|
@server.mount_proc "/quick/", method(:quick)
|
761
796
|
|
762
797
|
@server.mount_proc("/gem-server-rdoc-style.css") do |req, res|
|
data/lib/rubygems/source.rb
CHANGED
@@ -82,11 +82,15 @@ class Gem::Source
|
|
82
82
|
|
83
83
|
begin
|
84
84
|
fetcher = Gem::RemoteFetcher.fetcher
|
85
|
-
fetcher.fetch_path bundler_api_uri, nil, true
|
85
|
+
response = fetcher.fetch_path bundler_api_uri, nil, true
|
86
86
|
rescue Gem::RemoteFetcher::FetchError
|
87
87
|
Gem::Resolver::IndexSet.new self
|
88
88
|
else
|
89
|
-
|
89
|
+
if response.respond_to? :uri then
|
90
|
+
Gem::Resolver::APISet.new response.uri
|
91
|
+
else
|
92
|
+
Gem::Resolver::APISet.new bundler_api_uri
|
93
|
+
end
|
90
94
|
end
|
91
95
|
end
|
92
96
|
|
data/lib/rubygems/source/git.rb
CHANGED
@@ -101,7 +101,7 @@ class Gem::Source::Git < Gem::Source
|
|
101
101
|
Dir.chdir install_dir do
|
102
102
|
system @git, 'fetch', '--quiet', '--force', '--tags', install_dir
|
103
103
|
|
104
|
-
success = system @git, 'reset', '--quiet', '--hard',
|
104
|
+
success = system @git, 'reset', '--quiet', '--hard', rev_parse
|
105
105
|
|
106
106
|
success &&=
|
107
107
|
Gem::Util.silent_system @git, 'submodule', 'update',
|
@@ -4,6 +4,11 @@
|
|
4
4
|
|
5
5
|
class Gem::Source::SpecificFile < Gem::Source
|
6
6
|
|
7
|
+
##
|
8
|
+
# The path to the gem for this specific file.
|
9
|
+
|
10
|
+
attr_reader :path
|
11
|
+
|
7
12
|
##
|
8
13
|
# Creates a new SpecificFile for the gem in +file+
|
9
14
|
|
@@ -37,7 +42,7 @@ class Gem::Source::SpecificFile < Gem::Source
|
|
37
42
|
end
|
38
43
|
|
39
44
|
def pretty_print q # :nodoc:
|
40
|
-
q.group 2, '[
|
45
|
+
q.group 2, '[SpecificFile:', ']' do
|
41
46
|
q.breakable
|
42
47
|
q.text @path
|
43
48
|
end
|
@@ -186,7 +186,7 @@ class Gem::SpecFetcher
|
|
186
186
|
def suggest_gems_from_name gem_name
|
187
187
|
gem_name = gem_name.downcase.tr('_-', '')
|
188
188
|
max = gem_name.size / 2
|
189
|
-
names = available_specs(:
|
189
|
+
names = available_specs(:latest).first.values.flatten(1)
|
190
190
|
|
191
191
|
matches = names.map { |n|
|
192
192
|
next unless n.match_platform?
|
@@ -258,18 +258,11 @@ class Gem::SpecFetcher
|
|
258
258
|
# etc.). If +gracefully_ignore+ is true, errors are ignored.
|
259
259
|
|
260
260
|
def tuples_for(source, type, gracefully_ignore=false) # :nodoc:
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
source.load_specs(type).sort_by { |tup| tup.name }
|
267
|
-
rescue Gem::RemoteFetcher::FetchError
|
268
|
-
raise unless gracefully_ignore
|
269
|
-
[]
|
270
|
-
end
|
271
|
-
|
272
|
-
tuples
|
261
|
+
@caches[type][source.uri] ||=
|
262
|
+
source.load_specs(type).sort_by { |tup| tup.name }
|
263
|
+
rescue Gem::RemoteFetcher::FetchError
|
264
|
+
raise unless gracefully_ignore
|
265
|
+
[]
|
273
266
|
end
|
274
267
|
|
275
268
|
end
|
@@ -218,9 +218,11 @@ class Gem::Specification < Gem::BasicSpecification
|
|
218
218
|
# Usage:
|
219
219
|
#
|
220
220
|
# # If all library files are in the root directory...
|
221
|
-
# spec.
|
221
|
+
# spec.require_paths = ['.']
|
222
222
|
|
223
|
-
|
223
|
+
def require_paths=(val)
|
224
|
+
@require_paths = Array(val)
|
225
|
+
end
|
224
226
|
|
225
227
|
##
|
226
228
|
# The version of RubyGems used to create this gem.
|
@@ -412,6 +414,16 @@ class Gem::Specification < Gem::BasicSpecification
|
|
412
414
|
|
413
415
|
attr_accessor :post_install_message
|
414
416
|
|
417
|
+
##
|
418
|
+
# The version of Ruby required by this gem
|
419
|
+
|
420
|
+
attr_reader :required_ruby_version
|
421
|
+
|
422
|
+
##
|
423
|
+
# The RubyGems version required by this gem
|
424
|
+
|
425
|
+
attr_reader :required_rubygems_version
|
426
|
+
|
415
427
|
##
|
416
428
|
# The key used to sign this gem. See Gem::Security for details.
|
417
429
|
|
@@ -472,6 +484,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
472
484
|
# found in bindir. These files must be executable Ruby files. Files that
|
473
485
|
# use bash or other interpreters will not work.
|
474
486
|
#
|
487
|
+
# Executables included may only be ruby scripts, not scripts for other
|
488
|
+
# languages or compiled binaries.
|
489
|
+
#
|
475
490
|
# Usage:
|
476
491
|
#
|
477
492
|
# spec.executables << 'rake'
|
@@ -532,20 +547,26 @@ class Gem::Specification < Gem::BasicSpecification
|
|
532
547
|
|
533
548
|
##
|
534
549
|
# :category: Recommended gemspec attributes
|
550
|
+
#
|
535
551
|
# The license for this gem.
|
536
552
|
#
|
537
|
-
# The license must be
|
553
|
+
# The license must be no more than 64 characters.
|
538
554
|
#
|
539
|
-
# This should just be the name of your license. The full
|
540
|
-
#
|
555
|
+
# This should just be the name of your license. The full text of the license
|
556
|
+
# should be inside of the gem (at the top level) when you build it.
|
557
|
+
#
|
558
|
+
# The simplest way, is to specify the standard SPDX ID
|
559
|
+
# https://spdx.org/licenses/ for the license.
|
560
|
+
# Ideally you should pick one that is OSI (Open Source Initiative)
|
561
|
+
# http://opensource.org/licenses/alphabetical approved.
|
541
562
|
#
|
542
|
-
#
|
543
|
-
#
|
544
|
-
# license picker at http://choosealicense.com/
|
563
|
+
# The most commonly used OSI approved licenses are BSD-3-Clause and MIT.
|
564
|
+
# GitHub also provides a license picker at http://choosealicense.com/.
|
545
565
|
#
|
546
|
-
#
|
547
|
-
#
|
548
|
-
#
|
566
|
+
# You should specify a license for your gem so that people know how they are
|
567
|
+
# permitted to use it, and any restrictions you're placing on it. Not
|
568
|
+
# specifying a license means all rights are reserved; others have no rights
|
569
|
+
# to use the code for any purpose.
|
549
570
|
#
|
550
571
|
# You can set multiple licenses with #licenses=
|
551
572
|
#
|
@@ -607,6 +628,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
607
628
|
@required_ruby_version = Gem::Requirement.create req
|
608
629
|
end
|
609
630
|
|
631
|
+
##
|
632
|
+
# The RubyGems version required by this gem
|
633
|
+
|
634
|
+
def required_rubygems_version= req
|
635
|
+
@required_rubygems_version = Gem::Requirement.create req
|
636
|
+
end
|
637
|
+
|
610
638
|
##
|
611
639
|
# Lists the external (to RubyGems) requirements that must be met for this gem
|
612
640
|
# to work. It's simply information for the user.
|
@@ -661,16 +689,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
661
689
|
|
662
690
|
attr_writer :original_platform # :nodoc:
|
663
691
|
|
664
|
-
##
|
665
|
-
# The version of Ruby required by this gem
|
666
|
-
|
667
|
-
attr_reader :required_ruby_version
|
668
|
-
|
669
|
-
##
|
670
|
-
# The RubyGems version required by this gem
|
671
|
-
|
672
|
-
attr_reader :required_rubygems_version
|
673
|
-
|
674
692
|
##
|
675
693
|
# The rubyforge project this gem lives under. i.e. RubyGems'
|
676
694
|
# rubyforge_project is "rubygems".
|
@@ -1259,9 +1277,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1259
1277
|
# there are conflicts upon activation.
|
1260
1278
|
|
1261
1279
|
def activate
|
1262
|
-
|
1280
|
+
other = Gem.loaded_specs[self.name]
|
1281
|
+
if other then
|
1282
|
+
check_version_conflict other
|
1283
|
+
return false
|
1284
|
+
end
|
1263
1285
|
|
1264
|
-
|
1286
|
+
raise_if_conflicts
|
1265
1287
|
|
1266
1288
|
activate_dependencies
|
1267
1289
|
add_self_to_load_path
|
@@ -1418,8 +1440,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1418
1440
|
return if extensions.empty?
|
1419
1441
|
return if installed_by_version < Gem::Version.new('2.2.0.preview.2')
|
1420
1442
|
return if File.exist? gem_build_complete_path
|
1421
|
-
return if !File.writable?(base_dir)
|
1422
|
-
|
1443
|
+
return if !File.writable?(base_dir)
|
1444
|
+
return if !File.exist?(File.join(base_dir, 'extensions'))
|
1423
1445
|
|
1424
1446
|
begin
|
1425
1447
|
# We need to require things in $LOAD_PATH without looking for the
|
@@ -1475,13 +1497,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1475
1497
|
|
1476
1498
|
def conflicts
|
1477
1499
|
conflicts = {}
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
end
|
1500
|
+
self.runtime_dependencies.each { |dep|
|
1501
|
+
spec = Gem.loaded_specs[dep.name]
|
1502
|
+
if spec and not spec.satisfies_requirement? dep
|
1503
|
+
(conflicts[spec] ||= []) << dep
|
1504
|
+
end
|
1505
|
+
}
|
1485
1506
|
conflicts
|
1486
1507
|
end
|
1487
1508
|
|
@@ -1950,6 +1971,19 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1950
1971
|
end
|
1951
1972
|
end
|
1952
1973
|
|
1974
|
+
##
|
1975
|
+
# Is this specification missing its extensions? When this returns true you
|
1976
|
+
# probably want to build_extensions
|
1977
|
+
|
1978
|
+
def missing_extensions?
|
1979
|
+
return false if default_gem?
|
1980
|
+
return false if extensions.empty?
|
1981
|
+
return false if installed_by_version < Gem::Version.new('2.2.0.preview.2')
|
1982
|
+
return false if File.exist? gem_build_complete_path
|
1983
|
+
|
1984
|
+
true
|
1985
|
+
end
|
1986
|
+
|
1953
1987
|
##
|
1954
1988
|
# Normalize the list of files so that:
|
1955
1989
|
# * All file lists have redundancies removed.
|
@@ -2034,34 +2068,34 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2034
2068
|
end
|
2035
2069
|
|
2036
2070
|
##
|
2037
|
-
#
|
2071
|
+
# Raise an exception if the version of this spec conflicts with the one
|
2072
|
+
# that is already loaded (+other+)
|
2038
2073
|
|
2039
|
-
def
|
2040
|
-
|
2074
|
+
def check_version_conflict other # :nodoc:
|
2075
|
+
return if self.version == other.version
|
2041
2076
|
|
2042
|
-
|
2043
|
-
|
2044
|
-
# list of candidate gems, then we have a version conflict.
|
2077
|
+
# This gem is already loaded. If the currently loaded gem is not in the
|
2078
|
+
# list of candidate gems, then we have a version conflict.
|
2045
2079
|
|
2046
|
-
|
2080
|
+
msg = "can't activate #{full_name}, already activated #{other.full_name}"
|
2047
2081
|
|
2048
|
-
|
2049
|
-
|
2050
|
-
|
2082
|
+
e = Gem::LoadError.new msg
|
2083
|
+
e.name = self.name
|
2084
|
+
# TODO: e.requirement = dep.requirement
|
2051
2085
|
|
2052
|
-
|
2053
|
-
|
2086
|
+
raise e
|
2087
|
+
end
|
2054
2088
|
|
2055
|
-
|
2089
|
+
private :check_version_conflict
|
2056
2090
|
|
2057
|
-
|
2058
|
-
|
2059
|
-
"#{act.full_name} conflicts with #{con.join(", ")}"
|
2060
|
-
}.join ", "
|
2091
|
+
##
|
2092
|
+
# Check the spec for possible conflicts and freak out if there are any.
|
2061
2093
|
|
2062
|
-
|
2094
|
+
def raise_if_conflicts # :nodoc:
|
2095
|
+
conf = self.conflicts
|
2063
2096
|
|
2064
|
-
|
2097
|
+
unless conf.empty? then
|
2098
|
+
raise Gem::ConflictError.new self, conf
|
2065
2099
|
end
|
2066
2100
|
end
|
2067
2101
|
|
@@ -2085,14 +2119,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2085
2119
|
# Singular accessor for #require_paths
|
2086
2120
|
|
2087
2121
|
def require_path= path
|
2088
|
-
self.require_paths =
|
2089
|
-
end
|
2090
|
-
|
2091
|
-
##
|
2092
|
-
# The RubyGems version required by this gem
|
2093
|
-
|
2094
|
-
def required_rubygems_version= req
|
2095
|
-
@required_rubygems_version = Gem::Requirement.create req
|
2122
|
+
self.require_paths = Array(path)
|
2096
2123
|
end
|
2097
2124
|
|
2098
2125
|
##
|
@@ -2254,7 +2281,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2254
2281
|
mark_version
|
2255
2282
|
result = []
|
2256
2283
|
result << "# -*- encoding: utf-8 -*-"
|
2257
|
-
result << "#{Gem::StubSpecification::PREFIX}#{name} #{version} #{platform} #{
|
2284
|
+
result << "#{Gem::StubSpecification::PREFIX}#{name} #{version} #{platform} #{raw_require_paths.join("\0")}"
|
2258
2285
|
result << "#{Gem::StubSpecification::PREFIX}#{extensions.join "\0"}" unless
|
2259
2286
|
extensions.empty?
|
2260
2287
|
result << nil
|
@@ -2271,7 +2298,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2271
2298
|
if metadata and !metadata.empty?
|
2272
2299
|
result << " s.metadata = #{ruby_code metadata} if s.respond_to? :metadata="
|
2273
2300
|
end
|
2274
|
-
result << " s.require_paths = #{ruby_code
|
2301
|
+
result << " s.require_paths = #{ruby_code raw_require_paths}"
|
2275
2302
|
|
2276
2303
|
handled = [
|
2277
2304
|
:dependencies,
|
@@ -2359,7 +2386,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2359
2386
|
end
|
2360
2387
|
|
2361
2388
|
def to_yaml(opts = {}) # :nodoc:
|
2362
|
-
if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck?
|
2389
|
+
if (YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck?) ||
|
2390
|
+
!defined?(Syck) && defined?(Psych) then
|
2363
2391
|
# Because the user can switch the YAML engine behind our
|
2364
2392
|
# back, we have to check again here to make sure that our
|
2365
2393
|
# psych code was properly loaded, and load it if not.
|
@@ -2440,7 +2468,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2440
2468
|
"invalid value for attribute name: \"#{name.inspect}\""
|
2441
2469
|
end
|
2442
2470
|
|
2443
|
-
if
|
2471
|
+
if raw_require_paths.empty? then
|
2444
2472
|
raise Gem::InvalidSpecificationException,
|
2445
2473
|
'specification must have at least one require_path'
|
2446
2474
|
end
|