rubygems-update 3.3.5 → 3.3.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +34 -0
- data/CONTRIBUTING.md +9 -6
- data/Manifest.txt +0 -1
- data/bundler/CHANGELOG.md +38 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/config.rb +10 -1
- data/bundler/lib/bundler/cli/doctor.rb +9 -1
- data/bundler/lib/bundler/cli/gem.rb +11 -1
- data/bundler/lib/bundler/cli/info.rb +10 -1
- data/bundler/lib/bundler/cli/install.rb +6 -25
- data/bundler/lib/bundler/cli/platform.rb +1 -1
- data/bundler/lib/bundler/definition.rb +4 -2
- data/bundler/lib/bundler/env.rb +1 -1
- data/bundler/lib/bundler/fetcher.rb +5 -5
- data/bundler/lib/bundler/man/bundle-add.1 +1 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +2 -2
- data/bundler/lib/bundler/man/bundle-config.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
- data/bundler/lib/bundler/man/bundle-install.1 +1 -1
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
- data/bundler/lib/bundler/man/bundle.1 +1 -1
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/remote_specification.rb +7 -0
- data/bundler/lib/bundler/resolver.rb +5 -4
- data/bundler/lib/bundler/rubygems_ext.rb +13 -10
- data/bundler/lib/bundler/rubygems_integration.rb +2 -14
- data/bundler/lib/bundler/settings.rb +1 -1
- data/bundler/lib/bundler/shared_helpers.rb +1 -1
- data/bundler/lib/bundler/source_map.rb +15 -2
- data/bundler/lib/bundler/templates/newgem/standard.yml.tt +1 -0
- data/bundler/lib/bundler/templates/newgem/test/minitest/test_newgem.rb.tt +1 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +1 -1
- data/lib/rubygems/basic_specification.rb +8 -8
- data/lib/rubygems/bundler_version_finder.rb +3 -3
- data/lib/rubygems/command.rb +4 -4
- data/lib/rubygems/commands/cleanup_command.rb +6 -6
- data/lib/rubygems/commands/dependency_command.rb +20 -30
- data/lib/rubygems/commands/list_command.rb +1 -1
- data/lib/rubygems/commands/pristine_command.rb +12 -12
- data/lib/rubygems/commands/push_command.rb +8 -8
- data/lib/rubygems/commands/query_command.rb +1 -1
- data/lib/rubygems/commands/rdoc_command.rb +6 -6
- data/lib/rubygems/commands/search_command.rb +1 -1
- data/lib/rubygems/commands/setup_command.rb +8 -8
- data/lib/rubygems/commands/specification_command.rb +4 -4
- data/lib/rubygems/commands/update_command.rb +8 -6
- data/lib/rubygems/config_file.rb +4 -4
- data/lib/rubygems/doctor.rb +5 -5
- data/lib/rubygems/gem_runner.rb +5 -5
- data/lib/rubygems/install_update_options.rb +4 -4
- data/lib/rubygems/installer.rb +51 -12
- data/lib/rubygems/package.rb +10 -10
- data/lib/rubygems/platform.rb +42 -42
- data/lib/rubygems/query_utils.rb +16 -18
- data/lib/rubygems/remote_fetcher.rb +4 -4
- data/lib/rubygems/request_set/lockfile.rb +4 -4
- data/lib/rubygems/source.rb +6 -6
- data/lib/rubygems/source_list.rb +7 -7
- data/lib/rubygems/spec_fetcher.rb +25 -25
- data/lib/rubygems/specification.rb +47 -47
- data/lib/rubygems/specification_policy.rb +16 -16
- data/lib/rubygems/stub_specification.rb +16 -16
- data/lib/rubygems/uninstaller.rb +7 -7
- data/lib/rubygems/user_interaction.rb +12 -12
- data/lib/rubygems/version.rb +12 -9
- data/lib/rubygems.rb +7 -7
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/helper.rb +4 -4
- data/test/rubygems/test_gem.rb +2 -0
- data/test/rubygems/test_gem_command_manager.rb +1 -1
- data/test/rubygems/test_gem_commands_setup_command.rb +2 -0
- data/test/rubygems/test_gem_commands_update_command.rb +34 -0
- data/test/rubygems/test_gem_installer.rb +170 -58
- data/test/rubygems/test_gem_stream_ui.rb +1 -1
- data/test/rubygems/test_gem_version.rb +4 -0
- data/test/rubygems/test_rubygems.rb +5 -1
- data/test/rubygems/utilities.rb +4 -4
- metadata +3 -4
- data/bundler/lib/bundler/psyched_yaml.rb +0 -10
data/lib/rubygems/installer.rb
CHANGED
@@ -201,8 +201,8 @@ class Gem::Installer
|
|
201
201
|
#
|
202
202
|
# If +@force+ is set +filename+ is overwritten.
|
203
203
|
#
|
204
|
-
# If +filename+ exists and is a RubyGems wrapper for different gem
|
205
|
-
# is consulted.
|
204
|
+
# If +filename+ exists and it is a RubyGems wrapper for a different gem, then
|
205
|
+
# the user is consulted.
|
206
206
|
#
|
207
207
|
# If +filename+ exists and +@bin_dir+ is Gem.default_bindir (/usr/local) the
|
208
208
|
# user is consulted.
|
@@ -220,7 +220,17 @@ class Gem::Installer
|
|
220
220
|
existing = nil
|
221
221
|
|
222
222
|
File.open generated_bin, 'rb' do |io|
|
223
|
-
|
223
|
+
line = io.gets
|
224
|
+
shebang = /^#!.*ruby/
|
225
|
+
|
226
|
+
if load_relative_enabled?
|
227
|
+
until line.nil? || line =~ shebang do
|
228
|
+
line = io.gets
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
next unless line =~ shebang
|
233
|
+
|
224
234
|
io.gets # blankline
|
225
235
|
|
226
236
|
# TODO detect a specially formatted comment instead of trying
|
@@ -585,7 +595,6 @@ class Gem::Installer
|
|
585
595
|
#
|
586
596
|
|
587
597
|
def shebang(bin_file_name)
|
588
|
-
ruby_name = RbConfig::CONFIG['ruby_install_name'] if @env_shebang
|
589
598
|
path = File.join gem_dir, spec.bindir, bin_file_name
|
590
599
|
first_line = File.open(path, "rb") {|file| file.gets } || ""
|
591
600
|
|
@@ -598,7 +607,7 @@ class Gem::Installer
|
|
598
607
|
|
599
608
|
if which = Gem.configuration[:custom_shebang]
|
600
609
|
# replace bin_file_name with "ruby" to avoid endless loops
|
601
|
-
which = which.gsub(/ #{bin_file_name}$/," #{
|
610
|
+
which = which.gsub(/ #{bin_file_name}$/," #{ruby_install_name}")
|
602
611
|
|
603
612
|
which = which.gsub(/\$(\w+)/) do
|
604
613
|
case $1
|
@@ -614,14 +623,12 @@ class Gem::Installer
|
|
614
623
|
end
|
615
624
|
|
616
625
|
"#!#{which}"
|
617
|
-
elsif
|
618
|
-
"#!#{Gem.ruby}#{opts}"
|
619
|
-
elsif opts
|
620
|
-
"#!/bin/sh\n'exec' #{ruby_name.dump} '-x' \"$0\" \"$@\"\n#{shebang}"
|
621
|
-
else
|
626
|
+
elsif @env_shebang
|
622
627
|
# Create a plain shebang line.
|
623
628
|
@env_path ||= ENV_PATHS.find {|env_path| File.executable? env_path }
|
624
|
-
"#!#{@env_path} #{
|
629
|
+
"#!#{@env_path} #{ruby_install_name}"
|
630
|
+
else
|
631
|
+
"#{bash_prolog_script}#!#{Gem.ruby}#{opts}"
|
625
632
|
end
|
626
633
|
end
|
627
634
|
|
@@ -805,7 +812,6 @@ TEXT
|
|
805
812
|
# return the stub script text used to launch the true Ruby script
|
806
813
|
|
807
814
|
def windows_stub_script(bindir, bin_file_name)
|
808
|
-
rb_config = RbConfig::CONFIG
|
809
815
|
rb_topdir = RbConfig::TOPDIR || File.dirname(rb_config["bindir"])
|
810
816
|
|
811
817
|
# get ruby executable file name from RbConfig
|
@@ -973,4 +979,37 @@ TEXT
|
|
973
979
|
Gem::Command.build_args
|
974
980
|
end
|
975
981
|
end
|
982
|
+
|
983
|
+
def rb_config
|
984
|
+
RbConfig::CONFIG
|
985
|
+
end
|
986
|
+
|
987
|
+
def ruby_install_name
|
988
|
+
rb_config["ruby_install_name"]
|
989
|
+
end
|
990
|
+
|
991
|
+
def load_relative_enabled?
|
992
|
+
rb_config["LIBRUBY_RELATIVE"] == 'yes'
|
993
|
+
end
|
994
|
+
|
995
|
+
def bash_prolog_script
|
996
|
+
if load_relative_enabled?
|
997
|
+
script = +<<~EOS
|
998
|
+
bindir="${0%/*}"
|
999
|
+
EOS
|
1000
|
+
|
1001
|
+
script << %Q(exec "$bindir/#{ruby_install_name}" "-x" "$0" "$@"\n)
|
1002
|
+
|
1003
|
+
<<~EOS
|
1004
|
+
#!/bin/sh
|
1005
|
+
# -*- ruby -*-
|
1006
|
+
_=_\\
|
1007
|
+
=begin
|
1008
|
+
#{script.chomp}
|
1009
|
+
=end
|
1010
|
+
EOS
|
1011
|
+
else
|
1012
|
+
""
|
1013
|
+
end
|
1014
|
+
end
|
976
1015
|
end
|
data/lib/rubygems/package.rb
CHANGED
@@ -146,12 +146,12 @@ class Gem::Package
|
|
146
146
|
|
147
147
|
def self.new(gem, security_policy = nil)
|
148
148
|
gem = if gem.is_a?(Gem::Package::Source)
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
149
|
+
gem
|
150
|
+
elsif gem.respond_to? :read
|
151
|
+
Gem::Package::IOSource.new gem
|
152
|
+
else
|
153
|
+
Gem::Package::FileSource.new gem
|
154
|
+
end
|
155
155
|
|
156
156
|
return super unless Gem::Package == self
|
157
157
|
return super unless gem.present?
|
@@ -353,10 +353,10 @@ EOM
|
|
353
353
|
|
354
354
|
def digest(entry) # :nodoc:
|
355
355
|
algorithms = if @checksums
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
356
|
+
@checksums.keys
|
357
|
+
else
|
358
|
+
[Gem::Security::DIGEST_NAME].compact
|
359
|
+
end
|
360
360
|
|
361
361
|
algorithms.each do |algorithm|
|
362
362
|
digester = Gem::Security.create_digest(algorithm)
|
data/lib/rubygems/platform.rb
CHANGED
@@ -78,9 +78,9 @@ class Gem::Platform
|
|
78
78
|
cpu = arch.shift
|
79
79
|
|
80
80
|
@cpu = case cpu
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
when /i\d86/ then 'x86'
|
82
|
+
else cpu
|
83
|
+
end
|
84
84
|
|
85
85
|
if arch.length == 2 and arch.last =~ /^\d+(\.\d+)?$/ # for command-line
|
86
86
|
@os, @version = arch
|
@@ -91,32 +91,32 @@ class Gem::Platform
|
|
91
91
|
@cpu, os = nil, cpu if os.nil? # legacy jruby
|
92
92
|
|
93
93
|
@os, @version = case os
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
94
|
+
when /aix(\d+)?/ then [ 'aix', $1 ]
|
95
|
+
when /cygwin/ then [ 'cygwin', nil ]
|
96
|
+
when /darwin(\d+)?/ then [ 'darwin', $1 ]
|
97
|
+
when /^macruby$/ then [ 'macruby', nil ]
|
98
|
+
when /freebsd(\d+)?/ then [ 'freebsd', $1 ]
|
99
|
+
when /hpux(\d+)?/ then [ 'hpux', $1 ]
|
100
|
+
when /^java$/, /^jruby$/ then [ 'java', nil ]
|
101
|
+
when /^java([\d.]*)/ then [ 'java', $1 ]
|
102
|
+
when /^dalvik(\d+)?$/ then [ 'dalvik', $1 ]
|
103
|
+
when /^dotnet$/ then [ 'dotnet', nil ]
|
104
|
+
when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ]
|
105
|
+
when /linux-?((?!gnu)\w+)?/ then [ 'linux', $1 ]
|
106
|
+
when /mingw32/ then [ 'mingw32', nil ]
|
107
|
+
when /mingw-?(\w+)?/ then [ 'mingw', $1 ]
|
108
|
+
when /(mswin\d+)(\_(\d+))?/ then
|
109
|
+
os, version = $1, $3
|
110
|
+
@cpu = 'x86' if @cpu.nil? and os =~ /32$/
|
111
|
+
[os, version]
|
112
|
+
when /netbsdelf/ then [ 'netbsdelf', nil ]
|
113
|
+
when /openbsd(\d+\.\d+)?/ then [ 'openbsd', $1 ]
|
114
|
+
when /bitrig(\d+\.\d+)?/ then [ 'bitrig', $1 ]
|
115
|
+
when /solaris(\d+\.\d+)?/ then [ 'solaris', $1 ]
|
116
|
+
# test
|
117
|
+
when /^(\w+_platform)(\d+)?/ then [ $1, $2 ]
|
118
|
+
else [ 'unknown', nil ]
|
119
|
+
end
|
120
120
|
when Gem::Platform then
|
121
121
|
@cpu = arch.cpu
|
122
122
|
@os = arch.os
|
@@ -180,19 +180,19 @@ class Gem::Platform
|
|
180
180
|
when String then
|
181
181
|
# This data is from http://gems.rubyforge.org/gems/yaml on 19 Aug 2007
|
182
182
|
other = case other
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
183
|
+
when /^i686-darwin(\d)/ then ['x86', 'darwin', $1 ]
|
184
|
+
when /^i\d86-linux/ then ['x86', 'linux', nil ]
|
185
|
+
when 'java', 'jruby' then [nil, 'java', nil ]
|
186
|
+
when /^dalvik(\d+)?$/ then [nil, 'dalvik', $1 ]
|
187
|
+
when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ]
|
188
|
+
when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ]
|
189
|
+
when /mswin64(\_(\d+))?/ then ['x64', 'mswin64', $2 ]
|
190
|
+
when 'powerpc-darwin' then ['powerpc', 'darwin', nil ]
|
191
|
+
when /powerpc-darwin(\d)/ then ['powerpc', 'darwin', $1 ]
|
192
|
+
when /sparc-solaris2.8/ then ['sparc', 'solaris', '2.8' ]
|
193
|
+
when /universal-darwin(\d)/ then ['universal', 'darwin', $1 ]
|
194
|
+
else other
|
195
|
+
end
|
196
196
|
|
197
197
|
other = Gem::Platform.new other
|
198
198
|
else
|
data/lib/rubygems/query_utils.rb
CHANGED
@@ -54,14 +54,14 @@ module Gem::QueryUtils
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def defaults_str # :nodoc:
|
57
|
-
"--local --
|
57
|
+
"--local --no-details --versions --no-installed"
|
58
58
|
end
|
59
59
|
|
60
60
|
def execute
|
61
|
-
gem_names =
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
gem_names = if args.empty?
|
62
|
+
[options[:name]]
|
63
|
+
else
|
64
|
+
options[:exact] ? args.map{|arg| /\A#{Regexp.escape(arg)}\Z/ } : args.map{|arg| /#{arg}/i }
|
65
65
|
end
|
66
66
|
|
67
67
|
terminate_interaction(check_installed_gems(gem_names)) if check_installed_gems?
|
@@ -96,7 +96,7 @@ module Gem::QueryUtils
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def gem_name?
|
99
|
-
!options[:name].
|
99
|
+
!options[:name].nil?
|
100
100
|
end
|
101
101
|
|
102
102
|
def prerelease
|
@@ -129,12 +129,10 @@ module Gem::QueryUtils
|
|
129
129
|
display_header("LOCAL")
|
130
130
|
|
131
131
|
specs = Gem::Specification.find_all do |s|
|
132
|
-
s.name =~ name
|
133
|
-
|
132
|
+
name_matches = name ? s.name =~ name : true
|
133
|
+
version_matches = show_prereleases? || !s.version.prerelease?
|
134
134
|
|
135
|
-
|
136
|
-
specs.select! do |s|
|
137
|
-
dep.match?(s.name, s.version, show_prereleases?)
|
135
|
+
name_matches and version_matches
|
138
136
|
end
|
139
137
|
|
140
138
|
spec_tuples = specs.map do |spec|
|
@@ -149,13 +147,13 @@ module Gem::QueryUtils
|
|
149
147
|
|
150
148
|
fetcher = Gem::SpecFetcher.fetcher
|
151
149
|
|
152
|
-
spec_tuples = if name.
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
150
|
+
spec_tuples = if name.nil?
|
151
|
+
fetcher.detect(specs_type) { true }
|
152
|
+
else
|
153
|
+
fetcher.detect(specs_type) do |name_tuple|
|
154
|
+
name === name_tuple.name
|
155
|
+
end
|
156
|
+
end
|
159
157
|
|
160
158
|
output_query_results(spec_tuples)
|
161
159
|
end
|
@@ -172,10 +172,10 @@ class Gem::RemoteFetcher
|
|
172
172
|
when nil then # TODO test for local overriding cache
|
173
173
|
source_path = if Gem.win_platform? && source_uri.scheme &&
|
174
174
|
!source_uri.path.include?(':')
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
175
|
+
"#{source_uri.scheme}:#{source_uri.path}"
|
176
|
+
else
|
177
|
+
source_uri.path
|
178
|
+
end
|
179
179
|
|
180
180
|
source_path = Gem::UriFormatter.new(source_path).unescape
|
181
181
|
|
@@ -56,10 +56,10 @@ class Gem::RequestSet::Lockfile
|
|
56
56
|
|
57
57
|
deps[name] = if [Gem::Resolver::VendorSpecification,
|
58
58
|
Gem::Resolver::GitSpecification].include? spec.class
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
Gem::Requirement.source_set
|
60
|
+
else
|
61
|
+
requirement
|
62
|
+
end
|
63
63
|
end
|
64
64
|
|
65
65
|
deps
|
data/lib/rubygems/source.rb
CHANGED
@@ -81,12 +81,12 @@ class Gem::Source
|
|
81
81
|
return Gem::Resolver::IndexSet.new self if 'file' == uri.scheme
|
82
82
|
|
83
83
|
fetch_uri = if uri.host == "rubygems.org"
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
84
|
+
index_uri = uri.dup
|
85
|
+
index_uri.host = "index.rubygems.org"
|
86
|
+
index_uri
|
87
|
+
else
|
88
|
+
uri
|
89
|
+
end
|
90
90
|
|
91
91
|
bundler_api_uri = enforce_trailing_slash(fetch_uri)
|
92
92
|
|
data/lib/rubygems/source_list.rb
CHANGED
@@ -51,13 +51,13 @@ class Gem::SourceList
|
|
51
51
|
require "uri"
|
52
52
|
|
53
53
|
src = case obj
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
54
|
+
when URI
|
55
|
+
Gem::Source.new(obj)
|
56
|
+
when Gem::Source
|
57
|
+
obj
|
58
|
+
else
|
59
|
+
Gem::Source.new(URI.parse(obj))
|
60
|
+
end
|
61
61
|
|
62
62
|
@sources << src unless @sources.include?(src)
|
63
63
|
src
|
@@ -191,10 +191,10 @@ class Gem::SpecFetcher
|
|
191
191
|
end
|
192
192
|
|
193
193
|
matches = if matches.empty? && type != :prerelease
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
194
|
+
suggest_gems_from_name gem_name, :prerelease
|
195
|
+
else
|
196
|
+
matches.uniq.sort_by {|name, dist| dist }
|
197
|
+
end
|
198
198
|
|
199
199
|
matches.map {|name, dist| name }.uniq.first(num_results)
|
200
200
|
end
|
@@ -216,27 +216,27 @@ class Gem::SpecFetcher
|
|
216
216
|
@sources.each_source do |source|
|
217
217
|
begin
|
218
218
|
names = case type
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
219
|
+
when :latest
|
220
|
+
tuples_for source, :latest
|
221
|
+
when :released
|
222
|
+
tuples_for source, :released
|
223
|
+
when :complete
|
224
|
+
names =
|
225
|
+
tuples_for(source, :prerelease, true) +
|
226
|
+
tuples_for(source, :released)
|
227
|
+
|
228
|
+
names.sort
|
229
|
+
when :abs_latest
|
230
|
+
names =
|
231
|
+
tuples_for(source, :prerelease, true) +
|
232
|
+
tuples_for(source, :latest)
|
233
|
+
|
234
|
+
names.sort
|
235
|
+
when :prerelease
|
236
|
+
tuples_for(source, :prerelease)
|
237
|
+
else
|
238
|
+
raise Gem::Exception, "Unknown type - :#{type}"
|
239
|
+
end
|
240
240
|
rescue Gem::RemoteFetcher::FetchError => e
|
241
241
|
errors << Gem::SourceFetchProblem.new(source, e)
|
242
242
|
else
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
#
|
2
|
+
#
|
3
3
|
#--
|
4
4
|
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
|
5
5
|
# All rights reserved.
|
@@ -162,15 +162,15 @@ class Gem::Specification < Gem::BasicSpecification
|
|
162
162
|
|
163
163
|
@@default_value.each do |k,v|
|
164
164
|
INITIALIZE_CODE_FOR_DEFAULTS[k] = case v
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
165
|
+
when [], {}, true, false, nil, Numeric, Symbol
|
166
|
+
v.inspect
|
167
|
+
when String
|
168
|
+
v.dump
|
169
|
+
when Numeric
|
170
|
+
"default_value(:#{k})"
|
171
|
+
else
|
172
|
+
"default_value(:#{k}).dup"
|
173
|
+
end
|
174
174
|
end
|
175
175
|
|
176
176
|
@@attributes = @@default_value.keys.sort_by {|s| s.to_s }
|
@@ -1115,7 +1115,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1115
1115
|
file = file.dup.tap(&Gem::UNTAINT)
|
1116
1116
|
return unless File.file?(file)
|
1117
1117
|
|
1118
|
-
code = Gem.
|
1118
|
+
code = Gem.open_file(file, 'r:UTF-8:-', &:read)
|
1119
1119
|
|
1120
1120
|
code.tap(&Gem::UNTAINT)
|
1121
1121
|
|
@@ -1268,12 +1268,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1268
1268
|
current_version = CURRENT_SPECIFICATION_VERSION
|
1269
1269
|
|
1270
1270
|
field_count = if spec.specification_version > current_version
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1271
|
+
spec.instance_variable_set :@specification_version,
|
1272
|
+
current_version
|
1273
|
+
MARSHAL_FIELDS[current_version]
|
1274
|
+
else
|
1275
|
+
MARSHAL_FIELDS[spec.specification_version]
|
1276
|
+
end
|
1277
1277
|
|
1278
1278
|
if array.size < field_count
|
1279
1279
|
raise TypeError, "invalid Gem::Specification format #{array.inspect}"
|
@@ -1473,10 +1473,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1473
1473
|
|
1474
1474
|
def add_dependency_with_type(dependency, type, requirements)
|
1475
1475
|
requirements = if requirements.empty?
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1476
|
+
Gem::Requirement.default
|
1477
|
+
else
|
1478
|
+
requirements.flatten
|
1479
|
+
end
|
1480
1480
|
|
1481
1481
|
unless dependency.respond_to?(:name) &&
|
1482
1482
|
dependency.respond_to?(:requirement)
|
@@ -1684,18 +1684,18 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1684
1684
|
# This is the cleanest, most-readable, faster-than-using-Date
|
1685
1685
|
# way to do it.
|
1686
1686
|
@date = case date
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1687
|
+
when String then
|
1688
|
+
if DateTimeFormat =~ date
|
1689
|
+
Time.utc($1.to_i, $2.to_i, $3.to_i)
|
1690
|
+
else
|
1691
|
+
raise(Gem::InvalidSpecificationException,
|
1692
|
+
"invalid date format in specification: #{date.inspect}")
|
1693
|
+
end
|
1694
|
+
when Time, DateLike then
|
1695
|
+
Time.utc(date.year, date.month, date.day)
|
1696
|
+
else
|
1697
|
+
TODAY
|
1698
|
+
end
|
1699
1699
|
end
|
1700
1700
|
|
1701
1701
|
##
|
@@ -1801,13 +1801,13 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1801
1801
|
coder.add 'name', @name
|
1802
1802
|
coder.add 'version', @version
|
1803
1803
|
platform = case @original_platform
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1804
|
+
when nil, '' then
|
1805
|
+
'ruby'
|
1806
|
+
when String then
|
1807
|
+
@original_platform
|
1808
|
+
else
|
1809
|
+
@original_platform.to_s
|
1810
|
+
end
|
1811
1811
|
coder.add 'platform', platform
|
1812
1812
|
|
1813
1813
|
attributes = @@attributes.map(&:to_s) - %w[name version platform]
|
@@ -2024,10 +2024,10 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2024
2024
|
def base_dir
|
2025
2025
|
return Gem.dir unless loaded_from
|
2026
2026
|
@base_dir ||= if default_gem?
|
2027
|
-
|
2028
|
-
|
2029
|
-
|
2030
|
-
|
2027
|
+
File.dirname File.dirname File.dirname loaded_from
|
2028
|
+
else
|
2029
|
+
File.dirname File.dirname loaded_from
|
2030
|
+
end
|
2031
2031
|
end
|
2032
2032
|
|
2033
2033
|
##
|
@@ -2654,9 +2654,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2654
2654
|
default = self.default_value attribute
|
2655
2655
|
|
2656
2656
|
value = case default
|
2657
|
-
|
2658
|
-
|
2659
|
-
|
2657
|
+
when Time, Numeric, Symbol, true, false, nil then default
|
2658
|
+
else default.dup
|
2659
|
+
end
|
2660
2660
|
|
2661
2661
|
instance_variable_set "@#{attribute}", value
|
2662
2662
|
end
|
@@ -199,17 +199,17 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
199
199
|
base = segments.first 2
|
200
200
|
|
201
201
|
recommendation = if (op == '>' || op == '>=') && segments == [0]
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
202
|
+
" use a bounded requirement, such as '~> x.y'"
|
203
|
+
else
|
204
|
+
bugfix = if op == '>'
|
205
|
+
", '> #{dep_version}'"
|
206
|
+
elsif op == '>=' and base != segments
|
207
|
+
", '>= #{dep_version}'"
|
208
|
+
end
|
209
|
+
|
210
|
+
" if #{dep.name} is semantically versioned, use:\n" \
|
211
|
+
" add_#{dep.type}_dependency '#{dep.name}', '~> #{base.join '.'}'#{bugfix}"
|
212
|
+
end
|
213
213
|
|
214
214
|
warning_messages << ["open-ended dependency on #{dep} is not recommended", recommendation].join("\n") + "\n"
|
215
215
|
end
|
@@ -332,11 +332,11 @@ duplicate dependency on #{dep}, (#{prev.requirement}) use:
|
|
332
332
|
def validate_array_attribute(field)
|
333
333
|
val = @specification.send(field)
|
334
334
|
klass = case field
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
335
|
+
when :dependencies then
|
336
|
+
Gem::Dependency
|
337
|
+
else
|
338
|
+
String
|
339
|
+
end
|
340
340
|
|
341
341
|
unless Array === val and val.all? {|x| x.kind_of?(klass) }
|
342
342
|
error "#{field} must be an Array of #{klass}"
|