rubygems-update 3.2.32 → 3.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +154 -4
- data/CONTRIBUTING.md +40 -10
- data/Manifest.txt +11 -5
- data/POLICIES.md +22 -8
- data/README.md +9 -7
- data/UPGRADING.md +5 -81
- data/bin/gem +1 -6
- data/bundler/CHANGELOG.md +70 -0
- data/bundler/exe/bundle +7 -8
- data/bundler/lib/bundler/.document +1 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/doctor.rb +3 -2
- data/bundler/lib/bundler/cli/gem.rb +2 -1
- data/bundler/lib/bundler/cli/info.rb +6 -1
- data/bundler/lib/bundler/cli/install.rb +2 -0
- data/bundler/lib/bundler/cli/update.rb +2 -2
- data/bundler/lib/bundler/cli.rb +6 -0
- data/bundler/lib/bundler/compact_index_client/updater.rb +0 -5
- data/bundler/lib/bundler/definition.rb +29 -53
- data/bundler/lib/bundler/dependency.rb +5 -7
- data/bundler/lib/bundler/dsl.rb +18 -30
- data/bundler/lib/bundler/endpoint_specification.rb +0 -8
- data/bundler/lib/bundler/environment_preserver.rb +4 -1
- data/bundler/lib/bundler/fetcher/compact_index.rb +9 -4
- data/bundler/lib/bundler/fetcher.rb +2 -5
- data/bundler/lib/bundler/injector.rb +10 -1
- data/bundler/lib/bundler/installer/gem_installer.rb +1 -6
- data/bundler/lib/bundler/installer.rb +1 -4
- data/bundler/lib/bundler/lazy_specification.rb +17 -1
- data/bundler/lib/bundler/lockfile_parser.rb +10 -13
- data/bundler/lib/bundler/man/bundle-add.1 +10 -2
- data/bundler/lib/bundler/man/bundle-add.1.ronn +7 -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 +3 -3
- data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
- 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 +2 -2
- data/bundler/lib/bundler/man/bundle-install.1.ronn +2 -2
- 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 +2 -2
- data/bundler/lib/bundler/man/bundle-update.1.ronn +2 -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 +28 -2
- data/bundler/lib/bundler/man/gemfile.5.ronn +9 -1
- data/bundler/lib/bundler/plugin/api/source.rb +1 -0
- data/bundler/lib/bundler/plugin/installer.rb +1 -1
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/psyched_yaml.rb +1 -13
- data/bundler/lib/bundler/resolver.rb +34 -31
- data/bundler/lib/bundler/rubygems_ext.rb +2 -0
- data/bundler/lib/bundler/rubygems_gem_installer.rb +1 -1
- data/bundler/lib/bundler/rubygems_integration.rb +11 -48
- data/bundler/lib/bundler/self_manager.rb +76 -0
- data/bundler/lib/bundler/shared_helpers.rb +4 -12
- data/bundler/lib/bundler/source/git/git_proxy.rb +2 -2
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/source/rubygems.rb +16 -12
- data/bundler/lib/bundler/source/rubygems_aggregate.rb +1 -1
- data/bundler/lib/bundler/source.rb +1 -1
- data/bundler/lib/bundler/source_list.rb +7 -29
- data/bundler/lib/bundler/templates/Executable.bundler +1 -1
- data/bundler/lib/bundler/templates/Gemfile +0 -2
- data/bundler/lib/bundler/templates/gems.rb +0 -3
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +10 -1
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -2
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/bundler/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
- data/bundler/lib/bundler/ui/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/.document +1 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +6 -6
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +5 -3
- data/bundler/lib/bundler/vendor/thor/lib/thor/actions.rb +6 -2
- data/bundler/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +6 -0
- data/bundler/lib/bundler/vendor/thor/lib/thor/error.rb +9 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/parser/options.rb +19 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +22 -4
- data/bundler/lib/bundler/vendor/thor/lib/thor/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/thor/lib/thor/util.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +0 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +9 -3
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/bundler_version_finder.rb +10 -42
- data/lib/rubygems/command_manager.rb +4 -2
- data/lib/rubygems/commands/install_command.rb +5 -2
- data/lib/rubygems/commands/pristine_command.rb +8 -2
- data/lib/rubygems/commands/server_command.rb +14 -77
- data/lib/rubygems/commands/setup_command.rb +21 -22
- data/lib/rubygems/commands/update_command.rb +9 -4
- data/lib/rubygems/defaults.rb +2 -20
- data/lib/rubygems/dependency.rb +7 -7
- data/lib/rubygems/deprecate.rb +53 -6
- data/lib/rubygems/errors.rb +0 -3
- data/lib/rubygems/exceptions.rb +31 -1
- data/lib/rubygems/ext/builder.rb +5 -3
- data/lib/rubygems/install_update_options.rb +11 -2
- data/lib/rubygems/installer.rb +14 -12
- data/lib/rubygems/name_tuple.rb +2 -3
- data/lib/rubygems/optparse/.document +1 -0
- data/lib/rubygems/path_support.rb +1 -6
- data/lib/rubygems/platform.rb +4 -0
- data/lib/rubygems/remote_fetcher.rb +1 -1
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver/installer_set.rb +1 -1
- data/lib/rubygems/security/policy.rb +1 -3
- data/lib/rubygems/security.rb +14 -7
- data/lib/rubygems/source.rb +3 -1
- data/lib/rubygems/spec_fetcher.rb +1 -1
- data/lib/rubygems/specification.rb +21 -21
- data/lib/rubygems/stub_specification.rb +1 -1
- data/lib/rubygems/text.rb +21 -20
- data/lib/rubygems/tsort/.document +1 -0
- data/lib/rubygems/uninstaller.rb +4 -1
- data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
- data/lib/rubygems/version.rb +2 -0
- data/lib/rubygems.rb +48 -56
- data/rubygems-update.gemspec +1 -1
- data/setup.rb +1 -6
- data/test/rubygems/helper.rb +20 -6
- data/test/rubygems/test_config.rb +2 -2
- data/test/rubygems/test_exit.rb +11 -0
- data/test/rubygems/test_gem.rb +46 -76
- data/test/rubygems/test_gem_bundler_version_finder.rb +22 -43
- data/test/rubygems/test_gem_command_manager.rb +28 -2
- data/test/rubygems/test_gem_commands_install_command.rb +33 -0
- data/test/rubygems/test_gem_commands_open_command.rb +1 -1
- data/test/rubygems/test_gem_commands_server_command.rb +4 -46
- data/test/rubygems/test_gem_commands_setup_command.rb +17 -0
- data/test/rubygems/test_gem_commands_update_command.rb +2 -2
- data/test/rubygems/test_gem_dependency.rb +4 -8
- data/test/rubygems/test_gem_installer.rb +10 -5
- data/test/rubygems/test_gem_path_support.rb +2 -6
- data/test/rubygems/test_gem_remote_fetcher.rb +15 -0
- data/test/rubygems/test_gem_requirement.rb +0 -1
- data/test/rubygems/test_gem_security.rb +1 -1
- data/test/rubygems/test_gem_specification.rb +16 -25
- data/test/rubygems/test_gem_stream_ui.rb +1 -1
- data/test/rubygems/test_gem_text.rb +6 -0
- data/test/rubygems/test_kernel.rb +1 -13
- data/test/rubygems/test_project_sanity.rb +1 -1
- data/test/rubygems/test_require.rb +4 -58
- data/test/rubygems/test_rubygems.rb +23 -0
- metadata +14 -8
- data/bundler/lib/bundler/gemdeps.rb +0 -29
- data/lib/rubygems/server.rb +0 -882
- data/test/rubygems/bogussources.rb +0 -9
- data/test/rubygems/test_gem_server.rb +0 -608
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
# = uri/ws.rb
|
3
|
+
#
|
4
|
+
# Author:: Matt Muller <mamuller@amazon.com>
|
5
|
+
# License:: You can redistribute it and/or modify it under the same term as Ruby.
|
6
|
+
#
|
7
|
+
# See Bundler::URI for general documentation
|
8
|
+
#
|
9
|
+
|
10
|
+
require_relative 'generic'
|
11
|
+
|
12
|
+
module Bundler::URI
|
13
|
+
|
14
|
+
#
|
15
|
+
# The syntax of WS URIs is defined in RFC6455 section 3.
|
16
|
+
#
|
17
|
+
# Note that the Ruby Bundler::URI library allows WS URLs containing usernames and
|
18
|
+
# passwords. This is not legal as per the RFC, but used to be
|
19
|
+
# supported in Internet Explorer 5 and 6, before the MS04-004 security
|
20
|
+
# update. See <URL:http://support.microsoft.com/kb/834489>.
|
21
|
+
#
|
22
|
+
class WS < Generic
|
23
|
+
# A Default port of 80 for Bundler::URI::WS.
|
24
|
+
DEFAULT_PORT = 80
|
25
|
+
|
26
|
+
# An Array of the available components for Bundler::URI::WS.
|
27
|
+
COMPONENT = %i[
|
28
|
+
scheme
|
29
|
+
userinfo host port
|
30
|
+
path
|
31
|
+
query
|
32
|
+
].freeze
|
33
|
+
|
34
|
+
#
|
35
|
+
# == Description
|
36
|
+
#
|
37
|
+
# Creates a new Bundler::URI::WS object from components, with syntax checking.
|
38
|
+
#
|
39
|
+
# The components accepted are userinfo, host, port, path, and query.
|
40
|
+
#
|
41
|
+
# The components should be provided either as an Array, or as a Hash
|
42
|
+
# with keys formed by preceding the component names with a colon.
|
43
|
+
#
|
44
|
+
# If an Array is used, the components must be passed in the
|
45
|
+
# order <code>[userinfo, host, port, path, query]</code>.
|
46
|
+
#
|
47
|
+
# Example:
|
48
|
+
#
|
49
|
+
# uri = Bundler::URI::WS.build(host: 'www.example.com', path: '/foo/bar')
|
50
|
+
#
|
51
|
+
# uri = Bundler::URI::WS.build([nil, "www.example.com", nil, "/path", "query"])
|
52
|
+
#
|
53
|
+
# Currently, if passed userinfo components this method generates
|
54
|
+
# invalid WS URIs as per RFC 1738.
|
55
|
+
#
|
56
|
+
def self.build(args)
|
57
|
+
tmp = Util.make_components_hash(self, args)
|
58
|
+
super(tmp)
|
59
|
+
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# == Description
|
63
|
+
#
|
64
|
+
# Returns the full path for a WS Bundler::URI, as required by Net::HTTP::Get.
|
65
|
+
#
|
66
|
+
# If the Bundler::URI contains a query, the full path is Bundler::URI#path + '?' + Bundler::URI#query.
|
67
|
+
# Otherwise, the path is simply Bundler::URI#path.
|
68
|
+
#
|
69
|
+
# Example:
|
70
|
+
#
|
71
|
+
# uri = Bundler::URI::WS.build(path: '/foo/bar', query: 'test=true')
|
72
|
+
# uri.request_uri # => "/foo/bar?test=true"
|
73
|
+
#
|
74
|
+
def request_uri
|
75
|
+
return unless @path
|
76
|
+
|
77
|
+
url = @query ? "#@path?#@query" : @path.dup
|
78
|
+
url.start_with?(?/.freeze) ? url : ?/ + url
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
@@schemes['WS'] = WS
|
83
|
+
|
84
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
# = uri/wss.rb
|
3
|
+
#
|
4
|
+
# Author:: Matt Muller <mamuller@amazon.com>
|
5
|
+
# License:: You can redistribute it and/or modify it under the same term as Ruby.
|
6
|
+
#
|
7
|
+
# See Bundler::URI for general documentation
|
8
|
+
#
|
9
|
+
|
10
|
+
require_relative 'ws'
|
11
|
+
|
12
|
+
module Bundler::URI
|
13
|
+
|
14
|
+
# The default port for WSS URIs is 443, and the scheme is 'wss:' rather
|
15
|
+
# than 'ws:'. Other than that, WSS URIs are identical to WS URIs;
|
16
|
+
# see Bundler::URI::WS.
|
17
|
+
class WSS < WS
|
18
|
+
# A Default port of 443 for Bundler::URI::WSS
|
19
|
+
DEFAULT_PORT = 443
|
20
|
+
end
|
21
|
+
@@schemes['WSS'] = WSS
|
22
|
+
end
|
data/bundler/lib/bundler.rb
CHANGED
@@ -66,6 +66,7 @@ module Bundler
|
|
66
66
|
autoload :RubyDsl, File.expand_path("bundler/ruby_dsl", __dir__)
|
67
67
|
autoload :RubyVersion, File.expand_path("bundler/ruby_version", __dir__)
|
68
68
|
autoload :Runtime, File.expand_path("bundler/runtime", __dir__)
|
69
|
+
autoload :SelfManager, File.expand_path("bundler/self_manager", __dir__)
|
69
70
|
autoload :Settings, File.expand_path("bundler/settings", __dir__)
|
70
71
|
autoload :SharedHelpers, File.expand_path("bundler/shared_helpers", __dir__)
|
71
72
|
autoload :Source, File.expand_path("bundler/source", __dir__)
|
@@ -643,15 +644,20 @@ EOF
|
|
643
644
|
Bundler.rubygems.clear_paths
|
644
645
|
end
|
645
646
|
|
647
|
+
def self_manager
|
648
|
+
@self_manager ||= begin
|
649
|
+
require_relative "bundler/self_manager"
|
650
|
+
Bundler::SelfManager.new
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
646
654
|
private
|
647
655
|
|
648
656
|
def eval_yaml_gemspec(path, contents)
|
649
657
|
require_relative "bundler/psyched_yaml"
|
650
658
|
|
651
|
-
# If the YAML is invalid, Syck raises an ArgumentError, and Psych
|
652
|
-
# raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
|
653
659
|
Gem::Specification.from_yaml(contents)
|
654
|
-
rescue
|
660
|
+
rescue ::Psych::SyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
|
655
661
|
eval_gemspec(path, contents)
|
656
662
|
end
|
657
663
|
|
@@ -2,48 +2,18 @@
|
|
2
2
|
|
3
3
|
module Gem::BundlerVersionFinder
|
4
4
|
def self.bundler_version
|
5
|
-
|
5
|
+
v = ENV["BUNDLER_VERSION"]
|
6
6
|
|
7
|
-
|
7
|
+
v ||= bundle_update_bundler_version
|
8
|
+
return if v == true
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
def self.bundler_version_with_reason
|
13
|
-
if v = ENV["BUNDLER_VERSION"]
|
14
|
-
return [v, "`$BUNDLER_VERSION`"]
|
15
|
-
end
|
16
|
-
if v = bundle_update_bundler_version
|
17
|
-
return if v == true
|
18
|
-
return [v, "`bundle update --bundler`"]
|
19
|
-
end
|
20
|
-
v, lockfile = lockfile_version
|
21
|
-
if v
|
22
|
-
return [v, "your #{lockfile}"]
|
23
|
-
end
|
24
|
-
end
|
10
|
+
v ||= lockfile_version
|
11
|
+
return unless v
|
25
12
|
|
26
|
-
|
27
|
-
return unless vr = bundler_version_with_reason
|
28
|
-
<<-EOS
|
29
|
-
Could not find 'bundler' (#{vr.first}) required by #{vr.last}.
|
30
|
-
To update to the latest version installed on your system, run `bundle update --bundler`.
|
31
|
-
To install the missing version, run `gem install bundler:#{vr.first}`
|
32
|
-
EOS
|
13
|
+
Gem::Version.new(v)
|
33
14
|
end
|
34
15
|
|
35
|
-
def self.
|
36
|
-
return true unless spec.name == "bundler".freeze
|
37
|
-
return true unless bundler_version = self.bundler_version
|
38
|
-
|
39
|
-
spec.version.segments.first == bundler_version.segments.first
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.filter!(specs)
|
43
|
-
return unless bundler_version = self.bundler_version
|
44
|
-
|
45
|
-
specs.reject! {|spec| spec.version.segments.first != bundler_version.segments.first }
|
46
|
-
|
16
|
+
def self.prioritize!(specs)
|
47
17
|
exact_match_index = specs.find_index {|spec| spec.version == bundler_version }
|
48
18
|
return unless exact_match_index
|
49
19
|
|
@@ -68,12 +38,10 @@ To install the missing version, run `gem install bundler:#{vr.first}`
|
|
68
38
|
private_class_method :bundle_update_bundler_version
|
69
39
|
|
70
40
|
def self.lockfile_version
|
71
|
-
return unless
|
72
|
-
lockfile, contents = lockfile
|
73
|
-
lockfile ||= "lockfile"
|
41
|
+
return unless contents = lockfile_contents
|
74
42
|
regexp = /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
|
75
43
|
return unless contents =~ regexp
|
76
|
-
|
44
|
+
$1
|
77
45
|
end
|
78
46
|
private_class_method :lockfile_version
|
79
47
|
|
@@ -103,7 +71,7 @@ To install the missing version, run `gem install bundler:#{vr.first}`
|
|
103
71
|
|
104
72
|
return unless File.file?(lockfile)
|
105
73
|
|
106
|
-
|
74
|
+
File.read(lockfile)
|
107
75
|
end
|
108
76
|
private_class_method :lockfile_contents
|
109
77
|
end
|
@@ -73,7 +73,9 @@ class Gem::CommandManager
|
|
73
73
|
].freeze
|
74
74
|
|
75
75
|
ALIAS_COMMANDS = {
|
76
|
-
'i'
|
76
|
+
'i' => 'install',
|
77
|
+
'login' => 'signin',
|
78
|
+
'logout' => 'signout',
|
77
79
|
}.freeze
|
78
80
|
|
79
81
|
##
|
@@ -188,7 +190,7 @@ class Gem::CommandManager
|
|
188
190
|
raise Gem::CommandLineError,
|
189
191
|
"Ambiguous command #{cmd_name} matches [#{possibilities.join(', ')}]"
|
190
192
|
elsif possibilities.empty?
|
191
|
-
raise Gem::
|
193
|
+
raise Gem::UnknownCommandError.new(cmd_name)
|
192
194
|
end
|
193
195
|
|
194
196
|
self[possibilities.first]
|
@@ -27,6 +27,8 @@ class Gem::Commands::InstallCommand < Gem::Command
|
|
27
27
|
:without_groups => [],
|
28
28
|
})
|
29
29
|
|
30
|
+
defaults.merge!(install_update_options)
|
31
|
+
|
30
32
|
super 'install', 'Install a gem into the local repository', defaults
|
31
33
|
|
32
34
|
add_install_update_options
|
@@ -43,8 +45,9 @@ class Gem::Commands::InstallCommand < Gem::Command
|
|
43
45
|
end
|
44
46
|
|
45
47
|
def defaults_str # :nodoc:
|
46
|
-
"--both --version '#{Gem::Requirement.default}' --
|
47
|
-
"--install-dir #{Gem.dir} --lock"
|
48
|
+
"--both --version '#{Gem::Requirement.default}' --no-force\n" +
|
49
|
+
"--install-dir #{Gem.dir} --lock\n" +
|
50
|
+
install_update_defaults_str
|
48
51
|
end
|
49
52
|
|
50
53
|
def description # :nodoc:
|
@@ -50,6 +50,11 @@ class Gem::Commands::PristineCommand < Gem::Command
|
|
50
50
|
options[:env_shebang] = value
|
51
51
|
end
|
52
52
|
|
53
|
+
add_option('-i', '--install-dir DIR',
|
54
|
+
'Gem repository to get binstubs and plugins installed') do |value, options|
|
55
|
+
options[:install_dir] = File.expand_path(value)
|
56
|
+
end
|
57
|
+
|
53
58
|
add_option('-n', '--bindir DIR',
|
54
59
|
'Directory where executables are',
|
55
60
|
'located') do |value, options|
|
@@ -163,11 +168,12 @@ extensions will be restored.
|
|
163
168
|
end
|
164
169
|
|
165
170
|
bin_dir = options[:bin_dir] if options[:bin_dir]
|
171
|
+
install_dir = options[:install_dir] if options[:install_dir]
|
166
172
|
|
167
173
|
installer_options = {
|
168
174
|
:wrappers => true,
|
169
175
|
:force => true,
|
170
|
-
:install_dir => spec.base_dir,
|
176
|
+
:install_dir => install_dir || spec.base_dir,
|
171
177
|
:env_shebang => env_shebang,
|
172
178
|
:build_args => spec.build_args,
|
173
179
|
:bin_dir => bin_dir,
|
@@ -177,7 +183,7 @@ extensions will be restored.
|
|
177
183
|
installer = Gem::Installer.for_spec(spec, installer_options)
|
178
184
|
installer.generate_bin
|
179
185
|
elsif options[:only_plugins]
|
180
|
-
installer = Gem::Installer.for_spec(spec)
|
186
|
+
installer = Gem::Installer.for_spec(spec, installer_options)
|
181
187
|
installer.generate_plugins
|
182
188
|
else
|
183
189
|
installer = Gem::Installer.at(gem, installer_options)
|
@@ -1,88 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require_relative '../command'
|
3
|
-
require_relative '../server'
|
4
|
-
require_relative '../deprecate'
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Gem::OptionParser.accept :Port do |port|
|
15
|
-
if port =~ /\A\d+\z/
|
16
|
-
port = Integer port
|
17
|
-
raise Gem::OptionParser::InvalidArgument, "#{port}: not a port number" if
|
18
|
-
port > 65535
|
19
|
-
|
20
|
-
port
|
21
|
-
else
|
22
|
-
begin
|
23
|
-
Socket.getservbyname port
|
24
|
-
rescue SocketError
|
25
|
-
raise Gem::OptionParser::InvalidArgument, "#{port}: no such named service"
|
26
|
-
end
|
4
|
+
unless defined? Gem::Commands::ServerCommand
|
5
|
+
class Gem::Commands::ServerCommand < Gem::Command
|
6
|
+
def initialize
|
7
|
+
super('server', 'Starts up a web server that hosts the RDoc (requires rubygems-server)')
|
8
|
+
begin
|
9
|
+
Gem::Specification.find_by_name('rubygems-server').activate
|
10
|
+
rescue Gem::LoadError
|
11
|
+
# no-op
|
27
12
|
end
|
28
13
|
end
|
29
14
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
add_option '-d', '--dir=GEMDIR',
|
36
|
-
'directories from which to serve gems',
|
37
|
-
'multiple directories may be provided' do |gemdir, options|
|
38
|
-
options[:gemdir] << File.expand_path(gemdir)
|
15
|
+
def description # :nodoc:
|
16
|
+
<<-EOF
|
17
|
+
The server command has been moved to the rubygems-server gem.
|
18
|
+
EOF
|
39
19
|
end
|
40
20
|
|
41
|
-
|
42
|
-
|
21
|
+
def execute
|
22
|
+
alert_error "Install the rubygems-server gem for the server command"
|
43
23
|
end
|
44
|
-
|
45
|
-
add_option '-b', '--bind=HOST,HOST',
|
46
|
-
'addresses to bind', Array do |address, options|
|
47
|
-
options[:addresses] ||= []
|
48
|
-
options[:addresses].push(*address)
|
49
|
-
end
|
50
|
-
|
51
|
-
add_option '-l', '--launch[=COMMAND]',
|
52
|
-
'launches a browser window',
|
53
|
-
"COMMAND defaults to 'start' on Windows",
|
54
|
-
"and 'open' on all other platforms" do |launch, options|
|
55
|
-
launch ||= Gem.win_platform? ? 'start' : 'open'
|
56
|
-
options[:launch] = launch
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def defaults_str # :nodoc:
|
61
|
-
"--port 8808 --dir #{Gem.dir} --no-daemon"
|
62
|
-
end
|
63
|
-
|
64
|
-
def description # :nodoc:
|
65
|
-
<<-EOF
|
66
|
-
The server command starts up a web server that hosts the RDoc for your
|
67
|
-
installed gems and can operate as a server for installation of gems on other
|
68
|
-
machines.
|
69
|
-
|
70
|
-
The cache files for installed gems must exist to use the server as a source
|
71
|
-
for gem installation.
|
72
|
-
|
73
|
-
To install gems from a running server, use `gem install GEMNAME --source
|
74
|
-
http://gem_server_host:8808`
|
75
|
-
|
76
|
-
You can set up a shortcut to gem server documentation using the URL:
|
77
|
-
|
78
|
-
http://localhost:8808/rdoc?q=%s - Firefox
|
79
|
-
http://localhost:8808/rdoc?q=* - LaunchBar
|
80
|
-
|
81
|
-
EOF
|
82
|
-
end
|
83
|
-
|
84
|
-
def execute
|
85
|
-
options[:gemdir] = Gem.path if options[:gemdir].empty?
|
86
|
-
Gem::Server.run options
|
87
24
|
end
|
88
25
|
end
|
@@ -12,8 +12,6 @@ class Gem::Commands::SetupCommand < Gem::Command
|
|
12
12
|
ENV_PATHS = %w[/usr/bin/env /bin/env].freeze
|
13
13
|
|
14
14
|
def initialize
|
15
|
-
require 'tmpdir'
|
16
|
-
|
17
15
|
super 'setup', 'Install RubyGems',
|
18
16
|
:format_executable => false, :document => %w[ri],
|
19
17
|
:force => true,
|
@@ -182,8 +180,8 @@ By default, this RubyGems will install gem as:
|
|
182
180
|
|
183
181
|
say "RubyGems #{Gem::VERSION} installed"
|
184
182
|
|
185
|
-
regenerate_binstubs if options[:regenerate_binstubs]
|
186
|
-
regenerate_plugins if options[:regenerate_plugins]
|
183
|
+
regenerate_binstubs(bin_dir) if options[:regenerate_binstubs]
|
184
|
+
regenerate_plugins(bin_dir) if options[:regenerate_plugins]
|
187
185
|
|
188
186
|
uninstall_old_gemcutter
|
189
187
|
|
@@ -253,6 +251,8 @@ By default, this RubyGems will install gem as:
|
|
253
251
|
Dir.chdir path do
|
254
252
|
bin_file = "gem"
|
255
253
|
|
254
|
+
require 'tmpdir'
|
255
|
+
|
256
256
|
dest_file = target_bin_path(bin_dir, bin_file)
|
257
257
|
bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}"
|
258
258
|
|
@@ -411,8 +411,16 @@ By default, this RubyGems will install gem as:
|
|
411
411
|
Dir.chdir("bundler") do
|
412
412
|
built_gem = Gem::Package.build(bundler_spec)
|
413
413
|
begin
|
414
|
-
|
415
|
-
|
414
|
+
Gem::Installer.at(
|
415
|
+
built_gem,
|
416
|
+
env_shebang: options[:env_shebang],
|
417
|
+
format_executable: options[:format_executable],
|
418
|
+
force: options[:force],
|
419
|
+
install_as_default: true,
|
420
|
+
bin_dir: bin_dir,
|
421
|
+
install_dir: default_dir,
|
422
|
+
wrappers: true
|
423
|
+
).install
|
416
424
|
ensure
|
417
425
|
FileUtils.rm_f built_gem
|
418
426
|
end
|
@@ -457,20 +465,8 @@ By default, this RubyGems will install gem as:
|
|
457
465
|
lib_dir = RbConfig::CONFIG[site_or_vendor]
|
458
466
|
bin_dir = RbConfig::CONFIG['bindir']
|
459
467
|
else
|
460
|
-
|
461
|
-
|
462
|
-
# sitelibdir/vendorlibdir.
|
463
|
-
if defined?(APPLE_GEM_HOME) and
|
464
|
-
# just in case Apple and RubyGems don't get this patched up proper.
|
465
|
-
(prefix == RbConfig::CONFIG['libdir'] or
|
466
|
-
# this one is important
|
467
|
-
prefix == File.join(RbConfig::CONFIG['libdir'], 'ruby'))
|
468
|
-
lib_dir = RbConfig::CONFIG[site_or_vendor]
|
469
|
-
bin_dir = RbConfig::CONFIG['bindir']
|
470
|
-
else
|
471
|
-
lib_dir = File.join prefix, 'lib'
|
472
|
-
bin_dir = File.join prefix, 'bin'
|
473
|
-
end
|
468
|
+
lib_dir = File.join prefix, 'lib'
|
469
|
+
bin_dir = File.join prefix, 'bin'
|
474
470
|
end
|
475
471
|
|
476
472
|
[prepend_destdir_if_present(lib_dir), prepend_destdir_if_present(bin_dir)]
|
@@ -594,11 +590,12 @@ abort "#{deprecation_message}"
|
|
594
590
|
rescue Gem::InstallError
|
595
591
|
end
|
596
592
|
|
597
|
-
def regenerate_binstubs
|
593
|
+
def regenerate_binstubs(bindir)
|
598
594
|
require_relative "pristine_command"
|
599
595
|
say "Regenerating binstubs"
|
600
596
|
|
601
597
|
args = %w[--all --only-executables --silent]
|
598
|
+
args << "--bindir=#{bindir}"
|
602
599
|
if options[:env_shebang]
|
603
600
|
args << "--env-shebang"
|
604
601
|
end
|
@@ -607,11 +604,13 @@ abort "#{deprecation_message}"
|
|
607
604
|
command.invoke(*args)
|
608
605
|
end
|
609
606
|
|
610
|
-
def regenerate_plugins
|
607
|
+
def regenerate_plugins(bindir)
|
611
608
|
require_relative "pristine_command"
|
612
609
|
say "Regenerating plugins"
|
613
610
|
|
614
611
|
args = %w[--all --only-plugins --silent]
|
612
|
+
args << "--bindir=#{bindir}"
|
613
|
+
args << "--install-dir=#{default_dir}"
|
615
614
|
|
616
615
|
command = Gem::Commands::PristineCommand.new
|
617
616
|
command.invoke(*args)
|
@@ -19,9 +19,13 @@ class Gem::Commands::UpdateCommand < Gem::Command
|
|
19
19
|
attr_reader :updated # :nodoc:
|
20
20
|
|
21
21
|
def initialize
|
22
|
-
|
23
|
-
:
|
24
|
-
|
22
|
+
options = {
|
23
|
+
:force => false,
|
24
|
+
}
|
25
|
+
|
26
|
+
options.merge!(install_update_options)
|
27
|
+
|
28
|
+
super 'update', 'Update installed gems to the latest version', options
|
25
29
|
|
26
30
|
add_install_update_options
|
27
31
|
|
@@ -51,7 +55,8 @@ class Gem::Commands::UpdateCommand < Gem::Command
|
|
51
55
|
end
|
52
56
|
|
53
57
|
def defaults_str # :nodoc:
|
54
|
-
"--
|
58
|
+
"--no-force --install-dir #{Gem.dir}\n" +
|
59
|
+
install_update_defaults_str
|
55
60
|
end
|
56
61
|
|
57
62
|
def description # :nodoc:
|
data/lib/rubygems/defaults.rb
CHANGED
@@ -34,21 +34,7 @@ module Gem
|
|
34
34
|
# specified in the environment
|
35
35
|
|
36
36
|
def self.default_dir
|
37
|
-
|
38
|
-
[
|
39
|
-
File.dirname(RbConfig::CONFIG['sitedir']),
|
40
|
-
'Gems',
|
41
|
-
RbConfig::CONFIG['ruby_version'],
|
42
|
-
]
|
43
|
-
else
|
44
|
-
[
|
45
|
-
RbConfig::CONFIG['rubylibprefix'],
|
46
|
-
'gems',
|
47
|
-
RbConfig::CONFIG['ruby_version'],
|
48
|
-
]
|
49
|
-
end
|
50
|
-
|
51
|
-
@default_dir ||= File.join(*path)
|
37
|
+
@default_dir ||= File.join(RbConfig::CONFIG['rubylibprefix'], 'gems', RbConfig::CONFIG['ruby_version'])
|
52
38
|
end
|
53
39
|
|
54
40
|
##
|
@@ -197,11 +183,7 @@ module Gem
|
|
197
183
|
# The default directory for binaries
|
198
184
|
|
199
185
|
def self.default_bindir
|
200
|
-
|
201
|
-
'/usr/local/bin'
|
202
|
-
else # generic install
|
203
|
-
RbConfig::CONFIG['bindir']
|
204
|
-
end
|
186
|
+
RbConfig::CONFIG['bindir']
|
205
187
|
end
|
206
188
|
|
207
189
|
def self.ruby_engine
|
data/lib/rubygems/dependency.rb
CHANGED
@@ -277,7 +277,7 @@ class Gem::Dependency
|
|
277
277
|
requirement.satisfied_by?(spec.version) && env_req.satisfied_by?(spec.version)
|
278
278
|
end.map(&:to_spec)
|
279
279
|
|
280
|
-
Gem::BundlerVersionFinder.
|
280
|
+
Gem::BundlerVersionFinder.prioritize!(matches) if prioritizes_bundler?
|
281
281
|
|
282
282
|
if platform_only
|
283
283
|
matches.reject! do |spec|
|
@@ -295,7 +295,7 @@ class Gem::Dependency
|
|
295
295
|
@requirement.specific?
|
296
296
|
end
|
297
297
|
|
298
|
-
def
|
298
|
+
def prioritizes_bundler?
|
299
299
|
name == "bundler".freeze && !specific?
|
300
300
|
end
|
301
301
|
|
@@ -325,11 +325,11 @@ class Gem::Dependency
|
|
325
325
|
active = matches.find {|spec| spec.activated? }
|
326
326
|
return active if active
|
327
327
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
328
|
+
unless prerelease?
|
329
|
+
# Move prereleases to the end of the list for >= 0 requirements
|
330
|
+
pre, matches = matches.partition {|spec| spec.version.prerelease? }
|
331
|
+
matches += pre if requirement == Gem::Requirement.default
|
332
|
+
end
|
333
333
|
|
334
334
|
matches.first
|
335
335
|
end
|