diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-09-23 21:02:56 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-09-23 21:02:56 +0900 |
commit | 31a6eaabc165d8a222e176f2c809d90622d88ec2 (patch) | |
tree | b5333db2c13888ede5062ccd8ecca649ea261b4c /lib/rubygems | |
parent | f56fc720ee8cd4b79824a1c3843058b662a302bd (diff) |
Manually merged from https://github.com/rubygems/rubygems/pull/2636
Enable Style/EmptyLinesAroundClassBody rubocop cop.
Diffstat (limited to 'lib/rubygems')
138 files changed, 364 insertions, 0 deletions
diff --git a/lib/rubygems/available_set.rb b/lib/rubygems/available_set.rb index 80ef29df64..48bf6da45d 100644 --- a/lib/rubygems/available_set.rb +++ b/lib/rubygems/available_set.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true class Gem::AvailableSet + include Enumerable Tuple = Struct.new(:spec, :source) @@ -161,4 +162,5 @@ class Gem::AvailableSet def inject_into_list(dep_list) @set.each {|t| dep_list.add t.spec } end + end diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb index 665b87fc0e..ce07cdcf3b 100644 --- a/lib/rubygems/basic_specification.rb +++ b/lib/rubygems/basic_specification.rb @@ -4,6 +4,7 @@ # used by both Specification and StubSpecification. class Gem::BasicSpecification + ## # Allows installation of extensions for git: gems. @@ -38,8 +39,10 @@ class Gem::BasicSpecification end class << self + extend Gem::Deprecate rubygems_deprecate :default_specifications_dir, "Gem.default_specifications_dir" + end ## @@ -342,4 +345,5 @@ class Gem::BasicSpecification false end end + end diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb index bf55ce3205..cfbe34cb90 100644 --- a/lib/rubygems/command.rb +++ b/lib/rubygems/command.rb @@ -17,6 +17,7 @@ require_relative 'user_interaction' # A very good example to look at is Gem::Commands::ContentsCommand class Gem::Command + include Gem::UserInteraction OptionParser.accept Symbol do |value| @@ -651,6 +652,7 @@ RubyGems is a package manager for Ruby. HELP # :startdoc: + end ## diff --git a/lib/rubygems/command_manager.rb b/lib/rubygems/command_manager.rb index 1dcb577f7e..f18e7771b5 100644 --- a/lib/rubygems/command_manager.rb +++ b/lib/rubygems/command_manager.rb @@ -32,6 +32,7 @@ require 'rubygems/text' # See Gem::Command for instructions on writing gem commands. class Gem::CommandManager + include Gem::Text include Gem::UserInteraction @@ -230,4 +231,5 @@ class Gem::CommandManager ui.backtrace e end end + end diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb index decdca06bb..e2b5def1e8 100644 --- a/lib/rubygems/commands/build_command.rb +++ b/lib/rubygems/commands/build_command.rb @@ -3,6 +3,7 @@ require 'rubygems/command' require 'rubygems/package' class Gem::Commands::BuildCommand < Gem::Command + def initialize super 'build', 'Build a gem from a gemspec' @@ -107,4 +108,5 @@ Gems can be saved to a specified filename with the output option: terminate_interaction 1 end end + end diff --git a/lib/rubygems/commands/cert_command.rb b/lib/rubygems/commands/cert_command.rb index e5355d3652..5a093dd92f 100644 --- a/lib/rubygems/commands/cert_command.rb +++ b/lib/rubygems/commands/cert_command.rb @@ -3,6 +3,7 @@ require 'rubygems/command' require 'rubygems/security' class Gem::Commands::CertCommand < Gem::Command + def initialize super 'cert', 'Manage RubyGems certificates and signing settings', :add => [], :remove => [], :list => [], :build => [], :sign => [] @@ -311,4 +312,5 @@ For further reading on signing gems see `ri Gem::Security`. # It's simple, but is all we need email =~ /\A.+@.+\z/ end + end if defined?(OpenSSL::SSL) diff --git a/lib/rubygems/commands/check_command.rb b/lib/rubygems/commands/check_command.rb index 8b8eda53cf..7905b8ab69 100644 --- a/lib/rubygems/commands/check_command.rb +++ b/lib/rubygems/commands/check_command.rb @@ -5,6 +5,7 @@ require 'rubygems/validator' require 'rubygems/doctor' class Gem::Commands::CheckCommand < Gem::Command + include Gem::VersionOption def initialize @@ -89,4 +90,5 @@ specifications and will clean up gems that have been partially uninstalled. def usage # :nodoc: "#{program_name} [OPTIONS] [GEMNAME ...]" end + end diff --git a/lib/rubygems/commands/cleanup_command.rb b/lib/rubygems/commands/cleanup_command.rb index b9819a4f96..98cd203208 100644 --- a/lib/rubygems/commands/cleanup_command.rb +++ b/lib/rubygems/commands/cleanup_command.rb @@ -4,6 +4,7 @@ require 'rubygems/dependency_list' require 'rubygems/uninstaller' class Gem::Commands::CleanupCommand < Gem::Command + def initialize super 'cleanup', 'Clean up old versions of installed gems', @@ -180,4 +181,5 @@ If no gems are named all gems in GEM_HOME are cleaned. # Restore path Gem::Uninstaller may have changed Gem.use_paths @original_home, *@original_path end + end diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb index f17aed64db..d30b62d43c 100644 --- a/lib/rubygems/commands/contents_command.rb +++ b/lib/rubygems/commands/contents_command.rb @@ -3,6 +3,7 @@ require 'rubygems/command' require 'rubygems/version_option' class Gem::Commands::ContentsCommand < Gem::Command + include Gem::VersionOption def initialize @@ -185,4 +186,5 @@ prefix or only the files that are requireable. [i, File.join(i, "specifications")] end.flatten end + end diff --git a/lib/rubygems/commands/dependency_command.rb b/lib/rubygems/commands/dependency_command.rb index e472d8fa8d..bdb71adc3c 100644 --- a/lib/rubygems/commands/dependency_command.rb +++ b/lib/rubygems/commands/dependency_command.rb @@ -4,6 +4,7 @@ require 'rubygems/local_remote_options' require 'rubygems/version_option' class Gem::Commands::DependencyCommand < Gem::Command + include Gem::LocalRemoteOptions include Gem::VersionOption @@ -214,4 +215,5 @@ use with other commands. /\A#{Regexp.union(*args)}/ end end + end diff --git a/lib/rubygems/commands/environment_command.rb b/lib/rubygems/commands/environment_command.rb index 37429fb836..3d6a7afdae 100644 --- a/lib/rubygems/commands/environment_command.rb +++ b/lib/rubygems/commands/environment_command.rb @@ -2,6 +2,7 @@ require 'rubygems/command' class Gem::Commands::EnvironmentCommand < Gem::Command + def initialize super 'environment', 'Display information about the RubyGems environment' end @@ -171,4 +172,5 @@ lib/rubygems/defaults/operating_system.rb return nil end + end diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb index 6a1b346dd3..ab77a3b26a 100644 --- a/lib/rubygems/commands/fetch_command.rb +++ b/lib/rubygems/commands/fetch_command.rb @@ -4,6 +4,7 @@ require 'rubygems/local_remote_options' require 'rubygems/version_option' class Gem::Commands::FetchCommand < Gem::Command + include Gem::LocalRemoteOptions include Gem::VersionOption @@ -72,4 +73,5 @@ then repackaging it. say "Downloaded #{spec.full_name}" end end + end diff --git a/lib/rubygems/commands/generate_index_command.rb b/lib/rubygems/commands/generate_index_command.rb index 93e25ef5e4..6dccdcb946 100644 --- a/lib/rubygems/commands/generate_index_command.rb +++ b/lib/rubygems/commands/generate_index_command.rb @@ -8,6 +8,7 @@ require 'rubygems/indexer' # See `gem help generate_index` class Gem::Commands::GenerateIndexCommand < Gem::Command + def initialize super 'generate_index', 'Generates the index files for a gem server directory', @@ -82,4 +83,5 @@ Marshal::MINOR_VERSION constants. It is used to ensure compatibility. end end end + end diff --git a/lib/rubygems/commands/help_command.rb b/lib/rubygems/commands/help_command.rb index 9ba8bf1293..23df79f6ce 100644 --- a/lib/rubygems/commands/help_command.rb +++ b/lib/rubygems/commands/help_command.rb @@ -2,6 +2,7 @@ require 'rubygems/command' class Gem::Commands::HelpCommand < Gem::Command + # :stopdoc: EXAMPLES = <<-EOF.freeze Some examples of 'gem' usage. @@ -369,4 +370,5 @@ platform. alert_warning "Unknown command #{command_name}. Try: gem help commands" end end + end diff --git a/lib/rubygems/commands/info_command.rb b/lib/rubygems/commands/info_command.rb index 9ca6ae364f..a64843405e 100644 --- a/lib/rubygems/commands/info_command.rb +++ b/lib/rubygems/commands/info_command.rb @@ -4,6 +4,7 @@ require 'rubygems/command' require 'rubygems/query_utils' class Gem::Commands::InfoCommand < Gem::Command + include Gem::QueryUtils def initialize @@ -35,4 +36,5 @@ class Gem::Commands::InfoCommand < Gem::Command def defaults_str "--local" end + end diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb index 70825b88fd..6f9a8d2a08 100644 --- a/lib/rubygems/commands/install_command.rb +++ b/lib/rubygems/commands/install_command.rb @@ -12,6 +12,7 @@ require 'rubygems/version_option' # See `gem help install` class Gem::Commands::InstallCommand < Gem::Command + attr_reader :installed_specs # :nodoc: include Gem::VersionOption @@ -269,4 +270,5 @@ You can use `i` command instead of `install`. gems = @installed_specs.length == 1 ? 'gem' : 'gems' say "#{@installed_specs.length} #{gems} installed" end + end diff --git a/lib/rubygems/commands/list_command.rb b/lib/rubygems/commands/list_command.rb index 5c99d3d73d..f94038920f 100644 --- a/lib/rubygems/commands/list_command.rb +++ b/lib/rubygems/commands/list_command.rb @@ -6,6 +6,7 @@ require 'rubygems/query_utils' # Searches for gems starting with the supplied argument. class Gem::Commands::ListCommand < Gem::Command + include Gem::QueryUtils def initialize @@ -38,4 +39,5 @@ To search for remote gems use the search command. def usage # :nodoc: "#{program_name} [REGEXP ...]" end + end diff --git a/lib/rubygems/commands/lock_command.rb b/lib/rubygems/commands/lock_command.rb index f1dc1ac586..ed1d5489b7 100644 --- a/lib/rubygems/commands/lock_command.rb +++ b/lib/rubygems/commands/lock_command.rb @@ -2,6 +2,7 @@ require 'rubygems/command' class Gem::Commands::LockCommand < Gem::Command + def initialize super 'lock', 'Generate a lockdown list of gems', :strict => false @@ -105,4 +106,5 @@ lock it down to the exact version. gemspecs.find {|path| File.exist? path } end + end diff --git a/lib/rubygems/commands/mirror_command.rb b/lib/rubygems/commands/mirror_command.rb index 86671a93b2..4e2a41fa33 100644 --- a/lib/rubygems/commands/mirror_command.rb +++ b/lib/rubygems/commands/mirror_command.rb @@ -3,6 +3,7 @@ require 'rubygems/command' unless defined? Gem::Commands::MirrorCommand class Gem::Commands::MirrorCommand < Gem::Command + def initialize super('mirror', 'Mirror all gem files (requires rubygems-mirror)') begin @@ -21,5 +22,6 @@ The mirror command has been moved to the rubygems-mirror gem. def execute alert_error "Install the rubygems-mirror gem for the mirror command" end + end end diff --git a/lib/rubygems/commands/open_command.rb b/lib/rubygems/commands/open_command.rb index 1e40758ec5..c4ed0c2f1a 100644 --- a/lib/rubygems/commands/open_command.rb +++ b/lib/rubygems/commands/open_command.rb @@ -3,6 +3,7 @@ require 'rubygems/command' require 'rubygems/version_option' class Gem::Commands::OpenCommand < Gem::Command + include Gem::VersionOption def initialize @@ -81,4 +82,5 @@ class Gem::Commands::OpenCommand < Gem::Command say "Unable to find gem '#{name}'" end + end diff --git a/lib/rubygems/commands/outdated_command.rb b/lib/rubygems/commands/outdated_command.rb index 3579bfc3ba..035eaffcbc 100644 --- a/lib/rubygems/commands/outdated_command.rb +++ b/lib/rubygems/commands/outdated_command.rb @@ -5,6 +5,7 @@ require 'rubygems/spec_fetcher' require 'rubygems/version_option' class Gem::Commands::OutdatedCommand < Gem::Command + include Gem::LocalRemoteOptions include Gem::VersionOption @@ -29,4 +30,5 @@ update the gems with the update or install commands. say "#{spec.name} (#{spec.version} < #{remote_version})" end end + end diff --git a/lib/rubygems/commands/owner_command.rb b/lib/rubygems/commands/owner_command.rb index 0f01823967..f8e68c48e7 100644 --- a/lib/rubygems/commands/owner_command.rb +++ b/lib/rubygems/commands/owner_command.rb @@ -5,6 +5,7 @@ require 'rubygems/gemcutter_utilities' require 'rubygems/text' class Gem::Commands::OwnerCommand < Gem::Command + include Gem::Text include Gem::LocalRemoteOptions include Gem::GemcutterUtilities @@ -108,4 +109,5 @@ permission to. request.add_field "OTP", options[:otp] if options[:otp] end end + end diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb index db8136c9a6..d10060923f 100644 --- a/lib/rubygems/commands/pristine_command.rb +++ b/lib/rubygems/commands/pristine_command.rb @@ -5,6 +5,7 @@ require 'rubygems/installer' require 'rubygems/version_option' class Gem::Commands::PristineCommand < Gem::Command + include Gem::VersionOption def initialize @@ -187,4 +188,5 @@ extensions will be restored. say "Restored #{spec.full_name}" end end + end diff --git a/lib/rubygems/commands/push_command.rb b/lib/rubygems/commands/push_command.rb index 003b2dacc7..dadd397a2a 100644 --- a/lib/rubygems/commands/push_command.rb +++ b/lib/rubygems/commands/push_command.rb @@ -5,6 +5,7 @@ require 'rubygems/gemcutter_utilities' require 'rubygems/package' class Gem::Commands::PushCommand < Gem::Command + include Gem::LocalRemoteOptions include Gem::GemcutterUtilities @@ -103,4 +104,5 @@ The push command will use ~/.gem/credentials to authenticate to a server, but yo gem_metadata["allowed_push_host"] ] end + end diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb index 406a34e549..7a26b55ac6 100644 --- a/lib/rubygems/commands/query_command.rb +++ b/lib/rubygems/commands/query_command.rb @@ -4,6 +4,7 @@ require 'rubygems/query_utils' require 'rubygems/deprecate' class Gem::Commands::QueryCommand < Gem::Command + extend Gem::Deprecate rubygems_deprecate_command @@ -23,4 +24,5 @@ class Gem::Commands::QueryCommand < Gem::Command add_query_options end + end diff --git a/lib/rubygems/commands/rdoc_command.rb b/lib/rubygems/commands/rdoc_command.rb index e8c9e84b29..ff9e1ffcfa 100644 --- a/lib/rubygems/commands/rdoc_command.rb +++ b/lib/rubygems/commands/rdoc_command.rb @@ -5,6 +5,7 @@ require 'rubygems/rdoc' require 'fileutils' class Gem::Commands::RdocCommand < Gem::Command + include Gem::VersionOption def initialize @@ -92,4 +93,5 @@ Use --overwrite to force rebuilding of documentation. end end end + end diff --git a/lib/rubygems/commands/search_command.rb b/lib/rubygems/commands/search_command.rb index aeb2119235..65ee25167c 100644 --- a/lib/rubygems/commands/search_command.rb +++ b/lib/rubygems/commands/search_command.rb @@ -3,6 +3,7 @@ require 'rubygems/command' require 'rubygems/query_utils' class Gem::Commands::SearchCommand < Gem::Command + include Gem::QueryUtils def initialize @@ -37,4 +38,5 @@ To list local gems use the list command. def usage # :nodoc: "#{program_name} [REGEXP]" end + end diff --git a/lib/rubygems/commands/server_command.rb b/lib/rubygems/commands/server_command.rb index 91d5e267f8..e91a8e5176 100644 --- a/lib/rubygems/commands/server_command.rb +++ b/lib/rubygems/commands/server_command.rb @@ -3,6 +3,7 @@ require 'rubygems/command' require 'rubygems/server' class Gem::Commands::ServerCommand < Gem::Command + def initialize super 'server', 'Documentation and gem repository HTTP server', :port => 8808, :gemdir => [], :daemon => false @@ -81,4 +82,5 @@ You can set up a shortcut to gem server documentation using the URL: options[:gemdir] = Gem.path if options[:gemdir].empty? Gem::Server.run options end + end diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index 73c1b65223..4151671982 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -6,6 +6,7 @@ require 'rubygems/command' # RubyGems checkout or tarball. class Gem::Commands::SetupCommand < Gem::Command + HISTORY_HEADER = /^===\s*[\d.a-zA-Z]+\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze VERSION_MATCHER = /^===\s*([\d.a-zA-Z]+)\s*\/\s*\d{4}-\d{2}-\d{2}\s*$/.freeze @@ -735,4 +736,5 @@ abort "#{deprecation_message}" def bin_file_names @bin_file_names ||= [] end + end diff --git a/lib/rubygems/commands/signin_command.rb b/lib/rubygems/commands/signin_command.rb index 2e19c8333c..7c4b5ceb69 100644 --- a/lib/rubygems/commands/signin_command.rb +++ b/lib/rubygems/commands/signin_command.rb @@ -3,6 +3,7 @@ require 'rubygems/command' require 'rubygems/gemcutter_utilities' class Gem::Commands::SigninCommand < Gem::Command + include Gem::GemcutterUtilities def initialize @@ -30,4 +31,5 @@ class Gem::Commands::SigninCommand < Gem::Command def execute sign_in options[:host] end + end diff --git a/lib/rubygems/commands/signout_command.rb b/lib/rubygems/commands/signout_command.rb index ebbe746cb4..2d7329c590 100644 --- a/lib/rubygems/commands/signout_command.rb +++ b/lib/rubygems/commands/signout_command.rb @@ -2,6 +2,7 @@ require 'rubygems/command' class Gem::Commands::SignoutCommand < Gem::Command + def initialize super 'signout', 'Sign out from all the current sessions.' end @@ -28,4 +29,5 @@ class Gem::Commands::SignoutCommand < Gem::Command say 'You have successfully signed out from all sessions.' end end + end diff --git a/lib/rubygems/commands/sources_command.rb b/lib/rubygems/commands/sources_command.rb index 3be3a5dc79..ca9d425232 100644 --- a/lib/rubygems/commands/sources_command.rb +++ b/lib/rubygems/commands/sources_command.rb @@ -5,6 +5,7 @@ require 'rubygems/spec_fetcher' require 'rubygems/local_remote_options' class Gem::Commands::SourcesCommand < Gem::Command + include Gem::LocalRemoteOptions def initialize @@ -219,4 +220,5 @@ To remove a source use the --remove argument: say "*** Unable to remove #{desc} source cache ***" end end + end diff --git a/lib/rubygems/commands/specification_command.rb b/lib/rubygems/commands/specification_command.rb index e4a8afab21..e19bfeed73 100644 --- a/lib/rubygems/commands/specification_command.rb +++ b/lib/rubygems/commands/specification_command.rb @@ -5,6 +5,7 @@ require 'rubygems/version_option' require 'rubygems/package' class Gem::Commands::SpecificationCommand < Gem::Command + include Gem::LocalRemoteOptions include Gem::VersionOption @@ -142,4 +143,5 @@ Specific fields in the specification can be extracted in YAML format: say "\n" end end + end diff --git a/lib/rubygems/commands/stale_command.rb b/lib/rubygems/commands/stale_command.rb index badc9905c1..2fd4388891 100644 --- a/lib/rubygems/commands/stale_command.rb +++ b/lib/rubygems/commands/stale_command.rb @@ -2,6 +2,7 @@ require 'rubygems/command' class Gem::Commands::StaleCommand < Gem::Command + def initialize super('stale', 'List gems along with access times') end @@ -36,4 +37,5 @@ longer using. say "#{name} at #{atime.strftime '%c'}" end end + end diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb index 1540b2f0fb..2aac9e975e 100644 --- a/lib/rubygems/commands/uninstall_command.rb +++ b/lib/rubygems/commands/uninstall_command.rb @@ -10,6 +10,7 @@ require 'fileutils' # See `gem help uninstall` class Gem::Commands::UninstallCommand < Gem::Command + include Gem::VersionOption def initialize @@ -194,4 +195,5 @@ that is a dependency of an existing gem. You can use the def uninstall(gem_name) Gem::Uninstaller.new(gem_name, options).uninstall end + end diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb index 8d90d08eb4..1091a55f37 100644 --- a/lib/rubygems/commands/unpack_command.rb +++ b/lib/rubygems/commands/unpack_command.rb @@ -13,6 +13,7 @@ module Gem::Security # :nodoc: end class Gem::Commands::UnpackCommand < Gem::Command + include Gem::VersionOption include Gem::SecurityOption @@ -172,4 +173,5 @@ command help for an example. path end + end diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb index bac9c82fc8..612667dfd0 100644 --- a/lib/rubygems/commands/update_command.rb +++ b/lib/rubygems/commands/update_command.rb @@ -10,6 +10,7 @@ require 'rubygems/install_message' # must come before rdoc for messaging require 'rubygems/rdoc' class Gem::Commands::UpdateCommand < Gem::Command + include Gem::InstallUpdateOptions include Gem::LocalRemoteOptions include Gem::VersionOption @@ -309,4 +310,5 @@ command to remove old versions. result end + end diff --git a/lib/rubygems/commands/which_command.rb b/lib/rubygems/commands/which_command.rb index d42ab18395..fca463a1ef 100644 --- a/lib/rubygems/commands/which_command.rb +++ b/lib/rubygems/commands/which_command.rb @@ -2,6 +2,7 @@ require 'rubygems/command' class Gem::Commands::WhichCommand < Gem::Command + def initialize super 'which', 'Find the location of a library file you can require', :search_gems_first => false, :show_all => false @@ -84,4 +85,5 @@ requiring to see why it does not behave as you expect. def usage # :nodoc: "#{program_name} FILE [FILE ...]" end + end diff --git a/lib/rubygems/commands/yank_command.rb b/lib/rubygems/commands/yank_command.rb index 6ad74de96b..3ca05756f6 100644 --- a/lib/rubygems/commands/yank_command.rb +++ b/lib/rubygems/commands/yank_command.rb @@ -5,6 +5,7 @@ require 'rubygems/version_option' require 'rubygems/gemcutter_utilities' class Gem::Commands::YankCommand < Gem::Command + include Gem::LocalRemoteOptions include Gem::VersionOption include Gem::GemcutterUtilities @@ -96,4 +97,5 @@ data you will need to change them immediately and yank your gem. def get_platform_from_requirements(requirements) Gem.platforms[1].to_s if requirements.key? :added_platform end + end diff --git a/lib/rubygems/config_file.rb b/lib/rubygems/config_file.rb index 854d09ef3d..9f1da9e6dc 100644 --- a/lib/rubygems/config_file.rb +++ b/lib/rubygems/config_file.rb @@ -37,6 +37,7 @@ require 'rbconfig' # - per environment (gemrc files listed in the GEMRC environment variable) class Gem::ConfigFile + include Gem::UserInteraction DEFAULT_BACKTRACE = false @@ -496,4 +497,5 @@ if you believe they were disclosed to a third party. end end end + end diff --git a/lib/rubygems/core_ext/kernel_warn.rb b/lib/rubygems/core_ext/kernel_warn.rb index e030ef815c..389f247e2c 100644 --- a/lib/rubygems/core_ext/kernel_warn.rb +++ b/lib/rubygems/core_ext/kernel_warn.rb @@ -11,7 +11,9 @@ if RUBY_VERSION >= "2.5" remove_method :warn class << self + remove_method :warn + end module_function define_method(:warn) {|*messages, **kw| diff --git a/lib/rubygems/dependency.rb b/lib/rubygems/dependency.rb index 8634d71a72..8d30d15391 100644 --- a/lib/rubygems/dependency.rb +++ b/lib/rubygems/dependency.rb @@ -3,6 +3,7 @@ # The Dependency class holds a Gem name and a Gem::Requirement. class Gem::Dependency + ## # Valid dependency types. #-- @@ -343,4 +344,5 @@ class Gem::Dependency :released end end + end diff --git a/lib/rubygems/dependency_installer.rb b/lib/rubygems/dependency_installer.rb index 1afdc4b4c2..6ba6568437 100644 --- a/lib/rubygems/dependency_installer.rb +++ b/lib/rubygems/dependency_installer.rb @@ -12,6 +12,7 @@ require 'rubygems/deprecate' # Installs a gem along with all its dependencies from local and remote gems. class Gem::DependencyInstaller + include Gem::UserInteraction extend Gem::Deprecate @@ -334,4 +335,5 @@ class Gem::DependencyInstaller request_set end + end diff --git a/lib/rubygems/dependency_list.rb b/lib/rubygems/dependency_list.rb index bcf436cd03..978d1bef82 100644 --- a/lib/rubygems/dependency_list.rb +++ b/lib/rubygems/dependency_list.rb @@ -17,6 +17,7 @@ require 'rubygems/deprecate' # this class necessary anymore? Especially #ok?, #why_not_ok? class Gem::DependencyList + attr_reader :specs include Enumerable @@ -239,4 +240,5 @@ class Gem::DependencyList def active_count(specs, ignored) specs.count {|spec| ignored[spec.full_name].nil? } end + end diff --git a/lib/rubygems/doctor.rb b/lib/rubygems/doctor.rb index ef31aeddd0..9ac577a356 100644 --- a/lib/rubygems/doctor.rb +++ b/lib/rubygems/doctor.rb @@ -12,6 +12,7 @@ require 'rubygems/user_interaction' # removing the bogus specification. class Gem::Doctor + include Gem::UserInteraction ## @@ -128,4 +129,5 @@ class Gem::Doctor rescue Errno::ENOENT # ignore end + end diff --git a/lib/rubygems/errors.rb b/lib/rubygems/errors.rb index abee20651e..362a07865f 100644 --- a/lib/rubygems/errors.rb +++ b/lib/rubygems/errors.rb @@ -13,11 +13,13 @@ module Gem # already activated gems or that RubyGems is otherwise unable to activate. class LoadError < ::LoadError + # Name of gem attr_accessor :name # Version requirement of gem attr_accessor :requirement + end ## @@ -25,6 +27,7 @@ module Gem # system. Instead of rescuing from this class, make sure to rescue from the # superclass Gem::LoadError to catch all types of load errors. class MissingSpecError < Gem::LoadError + def initialize(name, requirement, extra_message=nil) @name = name @requirement = requirement @@ -42,6 +45,7 @@ module Gem total = Gem::Specification.stubs.size "Could not find '#{name}' (#{requirement}) among #{total} total gem(s)\n" end + end ## @@ -49,6 +53,7 @@ module Gem # not the requested version. Instead of rescuing from this class, make sure to # rescue from the superclass Gem::LoadError to catch all types of load errors. class MissingSpecVersionError < MissingSpecError + attr_reader :specs def initialize(name, requirement, specs) @@ -65,11 +70,13 @@ module Gem names = specs.map(&:full_name) "Could not find '#{name}' (#{requirement}) - did find: [#{names.join ','}]\n" end + end # Raised when there are conflicting gem specs loaded class ConflictError < LoadError + ## # A Hash mapping conflicting specifications to the dependencies that # caused the conflict @@ -94,6 +101,7 @@ module Gem super("Unable to activate #{target.full_name}, because #{reason}") end + end class ErrorReason; end @@ -105,6 +113,7 @@ module Gem # in figuring out why a gem couldn't be installed. # class PlatformMismatch < ErrorReason + ## # the name of the gem attr_reader :name @@ -142,6 +151,7 @@ module Gem @platforms.size == 1 ? '' : 's', @platforms.join(' ,')] end + end ## @@ -149,6 +159,7 @@ module Gem # data from a source class SourceFetchProblem < ErrorReason + ## # Creates a new SourceFetchProblem for the given +source+ and +error+. @@ -179,5 +190,6 @@ module Gem # The "exception" alias allows you to call raise on a SourceFetchProblem. alias exception error + end end diff --git a/lib/rubygems/exceptions.rb b/lib/rubygems/exceptions.rb index 804863f693..903abe0a6c 100644 --- a/lib/rubygems/exceptions.rb +++ b/lib/rubygems/exceptions.rb @@ -19,6 +19,7 @@ class Gem::DependencyRemovalException < Gem::Exception; end # and #conflicting_dependencies class Gem::DependencyResolutionError < Gem::DependencyError + attr_reader :conflict def initialize(conflict) @@ -31,20 +32,25 @@ class Gem::DependencyResolutionError < Gem::DependencyError def conflicting_dependencies @conflict.conflicting_dependencies end + end ## # Raised when attempting to uninstall a gem that isn't in GEM_HOME. class Gem::GemNotInHomeException < Gem::Exception + attr_accessor :spec + end ### # Raised when removing a gem with the uninstall command fails class Gem::UninstallError < Gem::Exception + attr_accessor :spec + end class Gem::DocumentError < Gem::Exception; end @@ -58,6 +64,7 @@ class Gem::EndOfYAMLException < Gem::Exception; end # operating on the given directory. class Gem::FilePermissionError < Gem::Exception + attr_reader :directory def initialize(directory) @@ -65,12 +72,15 @@ class Gem::FilePermissionError < Gem::Exception super "You don't have write permissions for the #{directory} directory." end + end ## # Used to raise parsing and loading errors class Gem::FormatException < Gem::Exception + attr_accessor :file_path + end class Gem::GemNotFoundException < Gem::Exception; end @@ -79,6 +89,7 @@ class Gem::GemNotFoundException < Gem::Exception; end # Raised by the DependencyInstaller when a specific gem cannot be found class Gem::SpecificGemNotFoundException < Gem::GemNotFoundException + ## # Creates a new SpecificGemNotFoundException for a gem with the given +name+ # and +version+. Any +errors+ encountered when attempting to find the gem @@ -106,6 +117,7 @@ class Gem::SpecificGemNotFoundException < Gem::GemNotFoundException # Errors encountered attempting to find the gem. attr_reader :errors + end ## @@ -113,6 +125,7 @@ end # inability to find a valid possible spec for a request. class Gem::ImpossibleDependenciesError < Gem::Exception + attr_reader :conflicts attr_reader :request @@ -140,14 +153,17 @@ class Gem::ImpossibleDependenciesError < Gem::Exception def dependency @request.dependency end + end class Gem::InstallError < Gem::Exception; end class Gem::RuntimeRequirementNotMetError < Gem::InstallError + attr_accessor :suggestion def message [suggestion, super].compact.join("\n\t") end + end ## @@ -189,6 +205,7 @@ class Gem::VerificationError < Gem::Exception; end # exit_code class Gem::SystemExitException < SystemExit + ## # The exit code for the process @@ -202,6 +219,7 @@ class Gem::SystemExitException < SystemExit super "Exiting RubyGems with exit_code #{exit_code}" end + end ## @@ -209,6 +227,7 @@ end # there is no spec. class Gem::UnsatisfiableDependencyError < Gem::DependencyError + ## # The unsatisfiable dependency. This is a # Gem::Resolver::DependencyRequest, not a Gem::Dependency @@ -253,6 +272,7 @@ class Gem::UnsatisfiableDependencyError < Gem::DependencyError def version @dependency.requirement end + end ## diff --git a/lib/rubygems/ext/builder.rb b/lib/rubygems/ext/builder.rb index afc8cb0ee4..83b3ac4474 100644 --- a/lib/rubygems/ext/builder.rb +++ b/lib/rubygems/ext/builder.rb @@ -8,6 +8,7 @@ require_relative '../user_interaction' class Gem::Ext::Builder + include Gem::UserInteraction ## @@ -226,4 +227,5 @@ EOF destination end + end diff --git a/lib/rubygems/ext/cmake_builder.rb b/lib/rubygems/ext/cmake_builder.rb index 519372e742..76a8c9e92c 100644 --- a/lib/rubygems/ext/cmake_builder.rb +++ b/lib/rubygems/ext/cmake_builder.rb @@ -2,6 +2,7 @@ require_relative '../command' class Gem::Ext::CmakeBuilder < Gem::Ext::Builder + def self.build(extension, dest_path, results, args=[], lib_dir=nil) unless File.exist?('Makefile') cmd = "cmake . -DCMAKE_INSTALL_PREFIX=#{dest_path}" @@ -14,4 +15,5 @@ class Gem::Ext::CmakeBuilder < Gem::Ext::Builder results end + end diff --git a/lib/rubygems/ext/configure_builder.rb b/lib/rubygems/ext/configure_builder.rb index 209e75fe8e..7d105c9bd3 100644 --- a/lib/rubygems/ext/configure_builder.rb +++ b/lib/rubygems/ext/configure_builder.rb @@ -6,6 +6,7 @@ #++ class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder + def self.build(extension, dest_path, results, args=[], lib_dir=nil) unless File.exist?('Makefile') cmd = "sh ./configure --prefix=#{dest_path}" @@ -18,4 +19,5 @@ class Gem::Ext::ConfigureBuilder < Gem::Ext::Builder results end + end diff --git a/lib/rubygems/ext/ext_conf_builder.rb b/lib/rubygems/ext/ext_conf_builder.rb index 305e1dcfb1..1310f591b4 100644 --- a/lib/rubygems/ext/ext_conf_builder.rb +++ b/lib/rubygems/ext/ext_conf_builder.rb @@ -8,6 +8,7 @@ require 'shellwords' class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder + def self.build(extension, dest_path, results, args=[], lib_dir=nil) require 'fileutils' require 'tempfile' @@ -91,4 +92,5 @@ class Gem::Ext::ExtConfBuilder < Gem::Ext::Builder path[0..Dir.pwd.length - 1] = '.' if path.start_with?(Dir.pwd) path end + end diff --git a/lib/rubygems/ext/rake_builder.rb b/lib/rubygems/ext/rake_builder.rb index 53507090fe..077f080c07 100644 --- a/lib/rubygems/ext/rake_builder.rb +++ b/lib/rubygems/ext/rake_builder.rb @@ -8,6 +8,7 @@ require "shellwords" class Gem::Ext::RakeBuilder < Gem::Ext::Builder + def self.build(extension, dest_path, results, args=[], lib_dir=nil) if File.basename(extension) =~ /mkrf_conf/i run([Gem.ruby, File.basename(extension), *args], results) @@ -30,4 +31,5 @@ class Gem::Ext::RakeBuilder < Gem::Ext::Builder results end + end diff --git a/lib/rubygems/gem_runner.rb b/lib/rubygems/gem_runner.rb index a36674503e..bf176db05a 100644 --- a/lib/rubygems/gem_runner.rb +++ b/lib/rubygems/gem_runner.rb @@ -24,6 +24,7 @@ Gem.load_env_plugins rescue nil # classes they call directly. class Gem::GemRunner + def initialize @command_manager_class = Gem::CommandManager @config_file_class = Gem::ConfigFile @@ -74,6 +75,7 @@ class Gem::GemRunner Gem.use_paths Gem.configuration[:gemhome], Gem.configuration[:gempath] Gem::Command.extra_args = Gem.configuration[:gem] end + end Gem.load_plugins diff --git a/lib/rubygems/indexer.rb b/lib/rubygems/indexer.rb index 9f4bd12c46..c99a6a8367 100644 --- a/lib/rubygems/indexer.rb +++ b/lib/rubygems/indexer.rb @@ -8,6 +8,7 @@ require 'tmpdir' # Top level class for building the gem repository index. class Gem::Indexer + include Gem::UserInteraction ## @@ -423,4 +424,5 @@ class Gem::Indexer Marshal.dump specs_index, io end end + end diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 33171a8eb9..5ee3af1e58 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -28,6 +28,7 @@ require 'fileutils' # file. See Gem.pre_install and Gem.post_install for details. class Gem::Installer + extend Gem::Deprecate ## @@ -72,6 +73,7 @@ class Gem::Installer @install_lock = Mutex.new class << self + ## # True if we've warned about PATH not including Gem.bindir @@ -96,6 +98,7 @@ class Gem::Installer def exec_format @exec_format ||= Gem.default_exec_format end + end ## @@ -108,6 +111,7 @@ class Gem::Installer end class FakePackage + attr_accessor :spec attr_accessor :dir_mode @@ -133,6 +137,7 @@ class Gem::Installer def copy_to(path) end + end ## @@ -958,4 +963,5 @@ TEXT raise Gem::FilePermissionError.new(dir) unless File.writable? dir end + end diff --git a/lib/rubygems/installer_test_case.rb b/lib/rubygems/installer_test_case.rb index d78b6a4712..68200d7204 100644 --- a/lib/rubygems/installer_test_case.rb +++ b/lib/rubygems/installer_test_case.rb @@ -3,6 +3,7 @@ require 'rubygems/test_case' require 'rubygems/installer' class Gem::Installer + ## # Available through requiring rubygems/installer_test_case @@ -57,12 +58,14 @@ class Gem::Installer # Available through requiring rubygems/installer_test_case attr_writer :wrappers + end ## # A test case for Gem::Installer. class Gem::InstallerTestCase < Gem::TestCase + def setup super @@ -243,4 +246,5 @@ class Gem::InstallerTestCase < Gem::TestCase end @@symlink_supported end + end diff --git a/lib/rubygems/mock_gem_ui.rb b/lib/rubygems/mock_gem_ui.rb index ec244fb7c6..9ece75881c 100644 --- a/lib/rubygems/mock_gem_ui.rb +++ b/lib/rubygems/mock_gem_ui.rb @@ -6,22 +6,27 @@ require 'rubygems/user_interaction' # retrieval during tests. class Gem::MockGemUi < Gem::StreamUI + ## # Raised when you haven't provided enough input to your MockGemUi class InputEOFError < RuntimeError + def initialize(question) super "Out of input for MockGemUi on #{question.inspect}" end + end class TermError < RuntimeError + attr_reader :exit_code def initialize(exit_code) super @exit_code = exit_code end + end class SystemExitException < RuntimeError; end @@ -82,4 +87,5 @@ class Gem::MockGemUi < Gem::StreamUI raise TermError, status if status != 0 raise SystemExitException end + end diff --git a/lib/rubygems/name_tuple.rb b/lib/rubygems/name_tuple.rb index cb5604e8dd..61373792bd 100644 --- a/lib/rubygems/name_tuple.rb +++ b/lib/rubygems/name_tuple.rb @@ -5,6 +5,7 @@ # wrap the data returned from the indexes. class Gem::NameTuple + def initialize(name, version, platform="ruby") @name = name @version = version @@ -118,4 +119,5 @@ class Gem::NameTuple def hash to_a.hash end + end diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb index 9b53cd4a7b..9780fc9dce 100644 --- a/lib/rubygems/package.rb +++ b/lib/rubygems/package.rb @@ -47,11 +47,13 @@ require 'rubygems/user_interaction' require 'zlib' class Gem::Package + include Gem::UserInteraction class Error < Gem::Exception; end class FormatError < Error + attr_reader :path def initialize(message, source = nil) @@ -63,13 +65,16 @@ class Gem::Package super message end + end class PathError < Error + def initialize(destination, destination_dir) super "installing into parent path %s of %s is not allowed" % [destination, destination_dir] end + end class NonSeekableIO < Error; end @@ -706,6 +711,7 @@ EOM rescue Zlib::GzipFile::Error => e raise Gem::Package::FormatError.new(e.message, entry.full_name) end + end require 'rubygems/package/digest_io' diff --git a/lib/rubygems/package/digest_io.rb b/lib/rubygems/package/digest_io.rb index 4736f76d93..d9e6c3c021 100644 --- a/lib/rubygems/package/digest_io.rb +++ b/lib/rubygems/package/digest_io.rb @@ -3,6 +3,7 @@ # IO wrapper that creates digests of contents written to the IO it wraps. class Gem::Package::DigestIO + ## # Collected digests for wrapped writes. # @@ -59,4 +60,5 @@ class Gem::Package::DigestIO result end + end diff --git a/lib/rubygems/package/file_source.rb b/lib/rubygems/package/file_source.rb index 114a950c77..8a4f9da6f2 100644 --- a/lib/rubygems/package/file_source.rb +++ b/lib/rubygems/package/file_source.rb @@ -7,6 +7,7 @@ # object to `Gem::Package.new`. class Gem::Package::FileSource < Gem::Package::Source # :nodoc: all + attr_reader :path def initialize(path) @@ -28,4 +29,5 @@ class Gem::Package::FileSource < Gem::Package::Source # :nodoc: all def with_read_io(&block) File.open path, 'rb', &block end + end diff --git a/lib/rubygems/package/io_source.rb b/lib/rubygems/package/io_source.rb index 7d7383110b..669a859d0a 100644 --- a/lib/rubygems/package/io_source.rb +++ b/lib/rubygems/package/io_source.rb @@ -8,6 +8,7 @@ # object to `Gem::Package.new`. class Gem::Package::IOSource < Gem::Package::Source # :nodoc: all + attr_reader :io def initialize(io) @@ -40,4 +41,5 @@ class Gem::Package::IOSource < Gem::Package::Source # :nodoc: all def path end + end diff --git a/lib/rubygems/package/old.rb b/lib/rubygems/package/old.rb index 25317ef23f..aeb6c999c0 100644 --- a/lib/rubygems/package/old.rb +++ b/lib/rubygems/package/old.rb @@ -12,6 +12,7 @@ # Please pretend this doesn't exist. class Gem::Package::Old < Gem::Package + undef_method :spec= ## @@ -165,4 +166,5 @@ class Gem::Package::Old < Gem::Package true end + end diff --git a/lib/rubygems/package/tar_header.rb b/lib/rubygems/package/tar_header.rb index f19aea549d..19927c0e27 100644 --- a/lib/rubygems/package/tar_header.rb +++ b/lib/rubygems/package/tar_header.rb @@ -28,6 +28,7 @@ # A header for a tar file class Gem::Package::TarHeader + ## # Fields in the tar header @@ -240,4 +241,5 @@ class Gem::Package::TarHeader def oct(num, len) "%0#{len}o" % num end + end diff --git a/lib/rubygems/package/tar_reader.rb b/lib/rubygems/package/tar_reader.rb index e7c5620533..b7b5e01e99 100644 --- a/lib/rubygems/package/tar_reader.rb +++ b/lib/rubygems/package/tar_reader.rb @@ -8,6 +8,7 @@ # TarReader reads tar files and allows iteration over their items class Gem::Package::TarReader + include Enumerable ## @@ -119,6 +120,7 @@ class Gem::Package::TarReader ensure rewind end + end require 'rubygems/package/tar_reader/entry' diff --git a/lib/rubygems/package/tar_reader/entry.rb b/lib/rubygems/package/tar_reader/entry.rb index 5865599d3a..d9c67ed8f2 100644 --- a/lib/rubygems/package/tar_reader/entry.rb +++ b/lib/rubygems/package/tar_reader/entry.rb @@ -8,6 +8,7 @@ # Class for reading entries out of a tar file class Gem::Package::TarReader::Entry + ## # Header for this tar entry @@ -164,4 +165,5 @@ class Gem::Package::TarReader::Entry @io.pos = @orig_pos @read = 0 end + end diff --git a/lib/rubygems/package/tar_test_case.rb b/lib/rubygems/package/tar_test_case.rb index 5fc34d2e8c..e4c408e416 100644 --- a/lib/rubygems/package/tar_test_case.rb +++ b/lib/rubygems/package/tar_test_case.rb @@ -6,6 +6,7 @@ require 'rubygems/package' # A test case for Gem::Package::Tar* classes class Gem::Package::TarTestCase < Gem::TestCase + def ASCIIZ(str, length) str + "\0" * (length - str.length) end @@ -136,4 +137,5 @@ class Gem::Package::TarTestCase < Gem::TestCase def util_symlink_entry util_entry tar_symlink_header("foo", "bar", 0, Time.now, "link") end + end diff --git a/lib/rubygems/package/tar_writer.rb b/lib/rubygems/package/tar_writer.rb index 877cc167c9..ed2577346d 100644 --- a/lib/rubygems/package/tar_writer.rb +++ b/lib/rubygems/package/tar_writer.rb @@ -8,12 +8,14 @@ # Allows writing of tar files class Gem::Package::TarWriter + class FileOverflow < StandardError; end ## # IO wrapper that allows writing a limited amount of data class BoundedStream + ## # Maximum number of bytes that can be written @@ -45,12 +47,14 @@ class Gem::Package::TarWriter @written += data.bytesize data.bytesize end + end ## # IO wrapper that provides only #write class RestrictedStream + ## # Creates a new RestrictedStream wrapping +io+ @@ -64,6 +68,7 @@ class Gem::Package::TarWriter def write(data) @io.write data end + end ## @@ -325,4 +330,5 @@ class Gem::Package::TarWriter return name, prefix end + end diff --git a/lib/rubygems/package_task.rb b/lib/rubygems/package_task.rb index d5a2885a64..4c993f1c09 100644 --- a/lib/rubygems/package_task.rb +++ b/lib/rubygems/package_task.rb @@ -57,6 +57,7 @@ require 'rake/packagetask' # end class Gem::PackageTask < Rake::PackageTask + ## # Ruby Gem::Specification containing the metadata for this package. The # name, version and package_files are automatically determined from the @@ -119,4 +120,5 @@ class Gem::PackageTask < Rake::PackageTask end end end + end diff --git a/lib/rubygems/path_support.rb b/lib/rubygems/path_support.rb index 8103caf324..9e5a48df03 100644 --- a/lib/rubygems/path_support.rb +++ b/lib/rubygems/path_support.rb @@ -5,6 +5,7 @@ # to the rest of RubyGems. # class Gem::PathSupport + ## # The default system path for managing Gems. attr_reader :home @@ -87,4 +88,5 @@ class Gem::PathSupport path end end + end diff --git a/lib/rubygems/platform.rb b/lib/rubygems/platform.rb index 34306fcf83..868a9de3b9 100644 --- a/lib/rubygems/platform.rb +++ b/lib/rubygems/platform.rb @@ -7,6 +7,7 @@ require "rubygems/deprecate" # See `gem help platform` for information on platform matching. class Gem::Platform + @local = nil attr_accessor :cpu @@ -201,4 +202,5 @@ class Gem::Platform # This will be replaced with Gem::Platform::local. CURRENT = 'current'.freeze + end diff --git a/lib/rubygems/psych_tree.rb b/lib/rubygems/psych_tree.rb index 6f399a289e..b4eebf1dcc 100644 --- a/lib/rubygems/psych_tree.rb +++ b/lib/rubygems/psych_tree.rb @@ -2,6 +2,7 @@ module Gem if defined? ::Psych::Visitors class NoAliasYAMLTree < Psych::Visitors::YAMLTree + def self.create new({}) end unless respond_to? :create @@ -27,6 +28,7 @@ module Gem end private :format_time + end end end diff --git a/lib/rubygems/remote_fetcher.rb b/lib/rubygems/remote_fetcher.rb index 20ddf471e1..66e2aefb2c 100644 --- a/lib/rubygems/remote_fetcher.rb +++ b/lib/rubygems/remote_fetcher.rb @@ -13,6 +13,7 @@ require 'resolv' # a remote source. class Gem::RemoteFetcher + include Gem::UserInteraction include Gem::UriParsing @@ -21,6 +22,7 @@ class Gem::RemoteFetcher # that could happen while downloading from the internet. class FetchError < Gem::Exception + include Gem::UriParsing ## @@ -41,6 +43,7 @@ class Gem::RemoteFetcher def to_s # :nodoc: "#{super} (#{uri})" end + end ## @@ -339,4 +342,5 @@ class Gem::RemoteFetcher @pools[proxy] ||= Gem::Request::ConnectionPools.new proxy, @cert_files end end + end diff --git a/lib/rubygems/request.rb b/lib/rubygems/request.rb index 75f9e9979a..a7349e08c4 100644 --- a/lib/rubygems/request.rb +++ b/lib/rubygems/request.rb @@ -4,6 +4,7 @@ require 'time' require 'rubygems/user_interaction' class Gem::Request + extend Gem::UserInteraction include Gem::UserInteraction @@ -284,6 +285,7 @@ class Gem::Request ua end + end require 'rubygems/request/http_pool' diff --git a/lib/rubygems/request/connection_pools.rb b/lib/rubygems/request/connection_pools.rb index 7f3988952c..1bd823a3c1 100644 --- a/lib/rubygems/request/connection_pools.rb +++ b/lib/rubygems/request/connection_pools.rb @@ -1,10 +1,13 @@ # frozen_string_literal: true class Gem::Request::ConnectionPools # :nodoc: + @client = Net::HTTP class << self + attr_accessor :client + end def initialize(proxy_uri, cert_files) @@ -92,4 +95,5 @@ class Gem::Request::ConnectionPools # :nodoc: net_http_args end end + end diff --git a/lib/rubygems/request/http_pool.rb b/lib/rubygems/request/http_pool.rb index 9985bbafa6..058094a209 100644 --- a/lib/rubygems/request/http_pool.rb +++ b/lib/rubygems/request/http_pool.rb @@ -6,6 +6,7 @@ # use it. class Gem::Request::HTTPPool # :nodoc: + attr_reader :cert_files, :proxy_uri def initialize(http_args, cert_files, proxy_uri) @@ -43,4 +44,5 @@ class Gem::Request::HTTPPool # :nodoc: connection.start connection end + end diff --git a/lib/rubygems/request/https_pool.rb b/lib/rubygems/request/https_pool.rb index 50f42d9e0d..1236079b7d 100644 --- a/lib/rubygems/request/https_pool.rb +++ b/lib/rubygems/request/https_pool.rb @@ -1,9 +1,11 @@ # frozen_string_literal: true class Gem::Request::HTTPSPool < Gem::Request::HTTPPool # :nodoc: + private def setup_connection(connection) Gem::Request.configure_connection_for_https(connection, @cert_files) super end + end diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb index a8a06d0b95..15eb9523d2 100644 --- a/lib/rubygems/request_set.rb +++ b/lib/rubygems/request_set.rb @@ -15,6 +15,7 @@ require 'tsort' # #=> ["nokogiri-1.6.0", "mini_portile-0.5.1", "pg-0.17.0"] class Gem::RequestSet + include TSort ## @@ -470,6 +471,7 @@ class Gem::RequestSet yield match end end + end require 'rubygems/request_set/gem_dependency_api' diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb index 9fbe3a1e44..07da0927eb 100644 --- a/lib/rubygems/request_set/gem_dependency_api.rb +++ b/lib/rubygems/request_set/gem_dependency_api.rb @@ -31,6 +31,7 @@ # See `gem help install` and `gem help gem_dependencies` for further details. class Gem::RequestSet::GemDependencyAPI + ENGINE_MAP = { # :nodoc: :jruby => %w[jruby], :jruby_18 => %w[jruby], @@ -841,4 +842,5 @@ Gem dependencies file #{@path} includes git reference for both ref/branch and ta Gem.sources << url end + end diff --git a/lib/rubygems/request_set/lockfile.rb b/lib/rubygems/request_set/lockfile.rb index 8f8f142fff..5af49a499a 100644 --- a/lib/rubygems/request_set/lockfile.rb +++ b/lib/rubygems/request_set/lockfile.rb @@ -5,10 +5,12 @@ # constructed. class Gem::RequestSet::Lockfile + ## # Raised when a lockfile cannot be parsed class ParseError < Gem::Exception + ## # The column where the error was encountered @@ -34,6 +36,7 @@ class Gem::RequestSet::Lockfile @path = path super "#{message} (at line #{line} column #{column})" end + end ## @@ -234,6 +237,7 @@ class Gem::RequestSet::Lockfile def requests @set.sorted_requests end + end require 'rubygems/request_set/lockfile/tokenizer' diff --git a/lib/rubygems/request_set/lockfile/parser.rb b/lib/rubygems/request_set/lockfile/parser.rb index 8c12b435af..1e9d2b12de 100644 --- a/lib/rubygems/request_set/lockfile/parser.rb +++ b/lib/rubygems/request_set/lockfile/parser.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true class Gem::RequestSet::Lockfile::Parser + ### # Parses lockfiles @@ -340,4 +341,5 @@ class Gem::RequestSet::Lockfile::Parser def unget(token) # :nodoc: @tokens.unshift token end + end diff --git a/lib/rubygems/request_set/lockfile/tokenizer.rb b/lib/rubygems/request_set/lockfile/tokenizer.rb index 6918e8e1a5..2062334068 100644 --- a/lib/rubygems/request_set/lockfile/tokenizer.rb +++ b/lib/rubygems/request_set/lockfile/tokenizer.rb @@ -2,6 +2,7 @@ require 'rubygems/request_set/lockfile/parser' class Gem::RequestSet::Lockfile::Tokenizer + Token = Struct.new :type, :value, :column, :line EOF = Token.new :EOF @@ -109,4 +110,5 @@ class Gem::RequestSet::Lockfile::Tokenizer @tokens end + end diff --git a/lib/rubygems/requirement.rb b/lib/rubygems/requirement.rb index d9d7c2fbad..3272d59708 100644 --- a/lib/rubygems/requirement.rb +++ b/lib/rubygems/requirement.rb @@ -9,6 +9,7 @@ require "rubygems/deprecate" # together in RubyGems. class Gem::Requirement + OPS = { #:nodoc: "=" => lambda {|v, r| v == r }, "!=" => lambda {|v, r| v != r }, @@ -298,11 +299,14 @@ class Gem::Requirement end end end + end class Gem::Version + # This is needed for compatibility with older yaml # gemspecs. Requirement = Gem::Requirement # :nodoc: + end diff --git a/lib/rubygems/resolver.rb b/lib/rubygems/resolver.rb index fa5f5e6bb2..557064292d 100644 --- a/lib/rubygems/resolver.rb +++ b/lib/rubygems/resolver.rb @@ -10,6 +10,7 @@ require 'rubygems/util/list' # all the requirements. class Gem::Resolver + require 'rubygems/resolver/molinillo' ## @@ -311,6 +312,7 @@ class Gem::Resolver end end private :amount_constrained + end require 'rubygems/resolver/activation_request' diff --git a/lib/rubygems/resolver/activation_request.rb b/lib/rubygems/resolver/activation_request.rb index 293df1efe9..2a8d6032f8 100644 --- a/lib/rubygems/resolver/activation_request.rb +++ b/lib/rubygems/resolver/activation_request.rb @@ -4,6 +4,7 @@ # dependency that was used to introduce this activation. class Gem::Resolver::ActivationRequest + ## # The parent request for this activation request. @@ -151,4 +152,5 @@ class Gem::Resolver::ActivationRequest def name_tuple @name_tuple ||= Gem::NameTuple.new(name, version, platform) end + end diff --git a/lib/rubygems/resolver/api_set.rb b/lib/rubygems/resolver/api_set.rb index 19c59a315b..ca92bac09c 100644 --- a/lib/rubygems/resolver/api_set.rb +++ b/lib/rubygems/resolver/api_set.rb @@ -4,6 +4,7 @@ # Returns instances of APISpecification. class Gem::Resolver::APISet < Gem::Resolver::Set + ## # The URI for the dependency API this APISet uses. @@ -120,4 +121,5 @@ class Gem::Resolver::APISet < Gem::Resolver::Set @data[name] end + end diff --git a/lib/rubygems/resolver/api_specification.rb b/lib/rubygems/resolver/api_specification.rb index a47d910331..4052846e99 100644 --- a/lib/rubygems/resolver/api_specification.rb +++ b/lib/rubygems/resolver/api_specification.rb @@ -6,6 +6,7 @@ # is the name, version, and dependencies. class Gem::Resolver::APISpecification < Gem::Resolver::Specification + ## # Creates an APISpecification for the given +set+ from the rubygems.org # +api_data+. @@ -85,4 +86,5 @@ class Gem::Resolver::APISpecification < Gem::Resolver::Specification def source # :nodoc: @set.source end + end diff --git a/lib/rubygems/resolver/best_set.rb b/lib/rubygems/resolver/best_set.rb index 7a708ee391..8a8c15d9a4 100644 --- a/lib/rubygems/resolver/best_set.rb +++ b/lib/rubygems/resolver/best_set.rb @@ -5,6 +5,7 @@ # It combines IndexSet and APISet class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet + ## # Creates a BestSet for the given +sources+ or Gem::sources if none are # specified. +sources+ must be a Gem::SourceList. @@ -73,4 +74,5 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet index_set end end + end diff --git a/lib/rubygems/resolver/composed_set.rb b/lib/rubygems/resolver/composed_set.rb index 226da1e1e0..094cb69b04 100644 --- a/lib/rubygems/resolver/composed_set.rb +++ b/lib/rubygems/resolver/composed_set.rb @@ -9,6 +9,7 @@ # This method will eliminate nesting of composed sets. class Gem::Resolver::ComposedSet < Gem::Resolver::Set + attr_reader :sets # :nodoc: ## @@ -61,4 +62,5 @@ class Gem::Resolver::ComposedSet < Gem::Resolver::Set def prefetch(reqs) @sets.each {|s| s.prefetch(reqs) } end + end diff --git a/lib/rubygems/resolver/conflict.rb b/lib/rubygems/resolver/conflict.rb index 2ce63feef2..4245b59bee 100644 --- a/lib/rubygems/resolver/conflict.rb +++ b/lib/rubygems/resolver/conflict.rb @@ -4,6 +4,7 @@ # with a spec that would be activated. class Gem::Resolver::Conflict + ## # The specification that was activated prior to the conflict @@ -150,4 +151,5 @@ class Gem::Resolver::Conflict def requester @failed_dep.requester end + end diff --git a/lib/rubygems/resolver/current_set.rb b/lib/rubygems/resolver/current_set.rb index c3aa3a2c37..d60e46389d 100644 --- a/lib/rubygems/resolver/current_set.rb +++ b/lib/rubygems/resolver/current_set.rb @@ -5,7 +5,9 @@ # for installed gems. class Gem::Resolver::CurrentSet < Gem::Resolver::Set + def find_all(req) req.dependency.matching_specs end + end diff --git a/lib/rubygems/resolver/dependency_request.rb b/lib/rubygems/resolver/dependency_request.rb index 77539c340f..1984aa9ddc 100644 --- a/lib/rubygems/resolver/dependency_request.rb +++ b/lib/rubygems/resolver/dependency_request.rb @@ -4,6 +4,7 @@ # contained the Dependency. class Gem::Resolver::DependencyRequest + ## # The wrapped Gem::Dependency @@ -115,4 +116,5 @@ class Gem::Resolver::DependencyRequest def to_s # :nodoc: @dependency.to_s end + end diff --git a/lib/rubygems/resolver/git_set.rb b/lib/rubygems/resolver/git_set.rb index eac51f15ad..6340b92fae 100644 --- a/lib/rubygems/resolver/git_set.rb +++ b/lib/rubygems/resolver/git_set.rb @@ -10,6 +10,7 @@ # set.add_git_gem 'rake', 'git://example/rake.git', tag: 'rake-10.1.0' class Gem::Resolver::GitSet < Gem::Resolver::Set + ## # The root directory for git gems in this set. This is usually Gem.dir, the # installation directory for regular gems. @@ -117,4 +118,5 @@ class Gem::Resolver::GitSet < Gem::Resolver::Set end end end + end diff --git a/lib/rubygems/resolver/git_specification.rb b/lib/rubygems/resolver/git_specification.rb index 555dcffc22..f43cfba853 100644 --- a/lib/rubygems/resolver/git_specification.rb +++ b/lib/rubygems/resolver/git_specification.rb @@ -5,6 +5,7 @@ # option. class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification + def ==(other) # :nodoc: self.class === other and @set == other.set and @@ -53,4 +54,5 @@ class Gem::Resolver::GitSpecification < Gem::Resolver::SpecSpecification q.pp @source end end + end diff --git a/lib/rubygems/resolver/index_set.rb b/lib/rubygems/resolver/index_set.rb index 9390e34255..f1ecc7f95f 100644 --- a/lib/rubygems/resolver/index_set.rb +++ b/lib/rubygems/resolver/index_set.rb @@ -4,6 +4,7 @@ # source index. class Gem::Resolver::IndexSet < Gem::Resolver::Set + def initialize(source = nil) # :nodoc: super() @@ -75,4 +76,5 @@ class Gem::Resolver::IndexSet < Gem::Resolver::Set end end end + end diff --git a/lib/rubygems/resolver/index_specification.rb b/lib/rubygems/resolver/index_specification.rb index d80f121189..ed9423791c 100644 --- a/lib/rubygems/resolver/index_specification.rb +++ b/lib/rubygems/resolver/index_specification.rb @@ -5,6 +5,7 @@ # and +version+ are needed. class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification + ## # An IndexSpecification is created from the index format described in `gem # help generate_index`. @@ -64,4 +65,5 @@ class Gem::Resolver::IndexSpecification < Gem::Resolver::Specification @source.fetch_spec tuple end end + end diff --git a/lib/rubygems/resolver/installed_specification.rb b/lib/rubygems/resolver/installed_specification.rb index 167ba1439e..9d996fc1da 100644 --- a/lib/rubygems/resolver/installed_specification.rb +++ b/lib/rubygems/resolver/installed_specification.rb @@ -4,6 +4,7 @@ # locally. class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification + def ==(other) # :nodoc: self.class === other and @set == other.set and @@ -53,4 +54,5 @@ class Gem::Resolver::InstalledSpecification < Gem::Resolver::SpecSpecification def source @source ||= Gem::Source::Installed.new end + end diff --git a/lib/rubygems/resolver/installer_set.rb b/lib/rubygems/resolver/installer_set.rb index eaa7e207b2..dad6313eba 100644 --- a/lib/rubygems/resolver/installer_set.rb +++ b/lib/rubygems/resolver/installer_set.rb @@ -4,6 +4,7 @@ # files class Gem::Resolver::InstallerSet < Gem::Resolver::Set + ## # List of Gem::Specification objects that must always be installed. @@ -222,4 +223,5 @@ class Gem::Resolver::InstallerSet < Gem::Resolver::Set @domain = :local unless remote end end + end diff --git a/lib/rubygems/resolver/local_specification.rb b/lib/rubygems/resolver/local_specification.rb index 9c69c4ab74..7418cfcc86 100644 --- a/lib/rubygems/resolver/local_specification.rb +++ b/lib/rubygems/resolver/local_specification.rb @@ -3,6 +3,7 @@ # A LocalSpecification comes from a .gem file on the local filesystem. class Gem::Resolver::LocalSpecification < Gem::Resolver::SpecSpecification + ## # Returns +true+ if this gem is installable for the current platform. @@ -36,4 +37,5 @@ class Gem::Resolver::LocalSpecification < Gem::Resolver::SpecSpecification q.text "source: #{@source.path}" end end + end diff --git a/lib/rubygems/resolver/lock_set.rb b/lib/rubygems/resolver/lock_set.rb index 1ab03e753b..12807f3957 100644 --- a/lib/rubygems/resolver/lock_set.rb +++ b/lib/rubygems/resolver/lock_set.rb @@ -3,6 +3,7 @@ # A set of gems from a gem dependencies lockfile. class Gem::Resolver::LockSet < Gem::Resolver::Set + attr_reader :specs # :nodoc: ## @@ -77,4 +78,5 @@ class Gem::Resolver::LockSet < Gem::Resolver::Set q.pp @specs.map {|spec| spec.full_name } end end + end diff --git a/lib/rubygems/resolver/lock_specification.rb b/lib/rubygems/resolver/lock_specification.rb index cdb8e4e425..5954507dba 100644 --- a/lib/rubygems/resolver/lock_specification.rb +++ b/lib/rubygems/resolver/lock_specification.rb @@ -6,6 +6,7 @@ # lockfile. class Gem::Resolver::LockSpecification < Gem::Resolver::Specification + attr_reader :sources def initialize(set, name, version, sources, platform) @@ -82,4 +83,5 @@ class Gem::Resolver::LockSpecification < Gem::Resolver::Specification s.dependencies.concat @dependencies end end + end diff --git a/lib/rubygems/resolver/requirement_list.rb b/lib/rubygems/resolver/requirement_list.rb index 5b51493c9a..cf0014b0bb 100644 --- a/lib/rubygems/resolver/requirement_list.rb +++ b/lib/rubygems/resolver/requirement_list.rb @@ -7,6 +7,7 @@ # first. class Gem::Resolver::RequirementList + include Enumerable ## @@ -78,4 +79,5 @@ class Gem::Resolver::RequirementList x = @exact[0,5] x + @list[0,5 - x.size] end + end diff --git a/lib/rubygems/resolver/set.rb b/lib/rubygems/resolver/set.rb index 8046e18ea1..242f9cd3dc 100644 --- a/lib/rubygems/resolver/set.rb +++ b/lib/rubygems/resolver/set.rb @@ -4,6 +4,7 @@ # dependencies) used in resolution. This set is abstract. class Gem::Resolver::Set + ## # Set to true to disable network access for this set @@ -52,4 +53,5 @@ class Gem::Resolver::Set def remote? # :nodoc: @remote end + end diff --git a/lib/rubygems/resolver/source_set.rb b/lib/rubygems/resolver/source_set.rb index bf8c23184e..8e799514fd 100644 --- a/lib/rubygems/resolver/source_set.rb +++ b/lib/rubygems/resolver/source_set.rb @@ -4,6 +4,7 @@ # Kind off like BestSet but filters the sources for gems class Gem::Resolver::SourceSet < Gem::Resolver::Set + ## # Creates a SourceSet for the given +sources+ or Gem::sources if none are # specified. +sources+ must be a Gem::SourceList. @@ -42,4 +43,5 @@ class Gem::Resolver::SourceSet < Gem::Resolver::Set link = @links[name] @sets[link] ||= Gem::Source.new(link).dependency_resolver_set if link end + end diff --git a/lib/rubygems/resolver/spec_specification.rb b/lib/rubygems/resolver/spec_specification.rb index bde5d9cddc..d0e744f3a7 100644 --- a/lib/rubygems/resolver/spec_specification.rb +++ b/lib/rubygems/resolver/spec_specification.rb @@ -4,6 +4,7 @@ # Resolver specifications that are backed by a Gem::Specification. class Gem::Resolver::SpecSpecification < Gem::Resolver::Specification + ## # A SpecSpecification is created for a +set+ for a Gem::Specification in # +spec+. The +source+ is either where the +spec+ came from, or should be @@ -51,4 +52,5 @@ class Gem::Resolver::SpecSpecification < Gem::Resolver::Specification def version spec.version end + end diff --git a/lib/rubygems/resolver/specification.rb b/lib/rubygems/resolver/specification.rb index 7fe2afd3bd..e859d6659a 100644 --- a/lib/rubygems/resolver/specification.rb +++ b/lib/rubygems/resolver/specification.rb @@ -5,6 +5,7 @@ # dependency resolution in the resolver is included. class Gem::Resolver::Specification + ## # The dependencies of the gem for this specification @@ -110,4 +111,5 @@ class Gem::Resolver::Specification def local? # :nodoc: false end + end diff --git a/lib/rubygems/resolver/stats.rb b/lib/rubygems/resolver/stats.rb index 64b458f504..5f41940b1e 100644 --- a/lib/rubygems/resolver/stats.rb +++ b/lib/rubygems/resolver/stats.rb @@ -1,5 +1,6 @@ # frozen_string_literal: true class Gem::Resolver::Stats + def initialize @max_depth = 0 @max_requirements = 0 @@ -42,4 +43,5 @@ class Gem::Resolver::Stats $stdout.printf PATTERN, "Backtracking #", @backtracking $stdout.printf PATTERN, "Iteration #", @iterations end + end diff --git a/lib/rubygems/resolver/vendor_set.rb b/lib/rubygems/resolver/vendor_set.rb index 48c640d8c9..7e2e917d5c 100644 --- a/lib/rubygems/resolver/vendor_set.rb +++ b/lib/rubygems/resolver/vendor_set.rb @@ -15,6 +15,7 @@ # rake.gemspec (watching the given name). class Gem::Resolver::VendorSet < Gem::Resolver::Set + ## # The specifications for this set. @@ -82,4 +83,5 @@ class Gem::Resolver::VendorSet < Gem::Resolver::Set end end end + end diff --git a/lib/rubygems/resolver/vendor_specification.rb b/lib/rubygems/resolver/vendor_specification.rb index 8dfe5940f2..56f2e6eb2c 100644 --- a/lib/rubygems/resolver/vendor_specification.rb +++ b/lib/rubygems/resolver/vendor_specification.rb @@ -5,6 +5,7 @@ # option. class Gem::Resolver::VendorSpecification < Gem::Resolver::SpecSpecification + def ==(other) # :nodoc: self.class === other and @set == other.set and @@ -19,4 +20,5 @@ class Gem::Resolver::VendorSpecification < Gem::Resolver::SpecSpecification def install(options = {}) yield nil end + end diff --git a/lib/rubygems/s3_uri_signer.rb b/lib/rubygems/s3_uri_signer.rb index c0b88842a0..3f76eeeb15 100644 --- a/lib/rubygems/s3_uri_signer.rb +++ b/lib/rubygems/s3_uri_signer.rb @@ -6,7 +6,9 @@ require 'rubygems/openssl' # S3URISigner implements AWS SigV4 for S3 Source to avoid a dependency on the aws-sdk-* gems # More on AWS SigV4: https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html class Gem::S3URISigner + class ConfigurationError < Gem::Exception + def initialize(message) super message end @@ -14,9 +16,11 @@ class Gem::S3URISigner def to_s # :nodoc: "#{super}" end + end class InstanceProfileError < Gem::Exception + def initialize(message) super message end @@ -24,6 +28,7 @@ class Gem::S3URISigner def to_s # :nodoc: "#{super}" end + end attr_accessor :uri @@ -174,4 +179,5 @@ class Gem::S3URISigner BASE64_URI_TRANSLATE = { "+" => "%2B", "/" => "%2F", "=" => "%3D", "\n" => "" }.freeze EC2_IAM_INFO = "http://169.254.169.254/latest/meta-data/iam/info".freeze EC2_IAM_SECURITY_CREDENTIALS = "http://169.254.169.254/latest/meta-data/iam/security-credentials/".freeze + end diff --git a/lib/rubygems/security/policy.rb b/lib/rubygems/security/policy.rb index 43abdb6d91..b5de55d6fd 100644 --- a/lib/rubygems/security/policy.rb +++ b/lib/rubygems/security/policy.rb @@ -8,6 +8,7 @@ require 'rubygems/user_interaction' # Gem::Security::Policies. class Gem::Security::Policy + include Gem::UserInteraction attr_reader :name @@ -288,4 +289,5 @@ class Gem::Security::Policy end alias to_s name # :nodoc: + end diff --git a/lib/rubygems/security/signer.rb b/lib/rubygems/security/signer.rb index 89200f9e38..16e959d47c 100644 --- a/lib/rubygems/security/signer.rb +++ b/lib/rubygems/security/signer.rb @@ -5,6 +5,7 @@ require "rubygems/user_interaction" class Gem::Security::Signer + include Gem::UserInteraction ## @@ -201,4 +202,5 @@ class Gem::Security::Signer end end end + end diff --git a/lib/rubygems/security/trust_dir.rb b/lib/rubygems/security/trust_dir.rb index 1d93ceabd1..c08a39a3c7 100644 --- a/lib/rubygems/security/trust_dir.rb +++ b/lib/rubygems/security/trust_dir.rb @@ -4,6 +4,7 @@ # verification. class Gem::Security::TrustDir + ## # Default permissions for the trust directory and its contents @@ -114,4 +115,5 @@ class Gem::Security::TrustDir FileUtils.mkdir_p @dir, :mode => @permissions[:trust_dir] end end + end diff --git a/lib/rubygems/server.rb b/lib/rubygems/server.rb index 70ae44609a..caa36f5ca5 100644 --- a/lib/rubygems/server.rb +++ b/lib/rubygems/server.rb @@ -29,6 +29,7 @@ require 'rubygems/rdoc' # TODO Refactor into a real WEBrick servlet to remove code duplication. class Gem::Server + attr_reader :spec_dirs include ERB::Util @@ -874,4 +875,5 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } system("#{@launch} http://#{host}:#{@port}") end + end diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb index bed9c51346..984638c1fa 100644 --- a/lib/rubygems/source.rb +++ b/lib/rubygems/source.rb @@ -8,6 +8,7 @@ require "rubygems/text" # bundler dependency API and so-forth. class Gem::Source + include Comparable include Gem::Text @@ -222,6 +223,7 @@ class Gem::Source return if @uri.host.nil? levenshtein_distance(@uri.host, host) <= distance_threshold end + end require 'rubygems/source/git' diff --git a/lib/rubygems/source/git.rb b/lib/rubygems/source/git.rb index 9876adc24e..4d50e1b303 100644 --- a/lib/rubygems/source/git.rb +++ b/lib/rubygems/source/git.rb @@ -11,6 +11,7 @@ # source.specs class Gem::Source::Git < Gem::Source + ## # The name of the gem created by this git gem. @@ -237,4 +238,5 @@ class Gem::Source::Git < Gem::Source Digest::SHA1.hexdigest normalized end + end diff --git a/lib/rubygems/source/installed.rb b/lib/rubygems/source/installed.rb index 7e1dd7af5a..8e20cbd76d 100644 --- a/lib/rubygems/source/installed.rb +++ b/lib/rubygems/source/installed.rb @@ -3,6 +3,7 @@ # Represents an installed gem. This is used for dependency resolution. class Gem::Source::Installed < Gem::Source + def initialize # :nodoc: @uri = nil end @@ -35,4 +36,5 @@ class Gem::Source::Installed < Gem::Source def pretty_print(q) # :nodoc: q.text '[Installed]' end + end diff --git a/lib/rubygems/source/local.rb b/lib/rubygems/source/local.rb index 078b06203f..15700a0df2 100644 --- a/lib/rubygems/source/local.rb +++ b/lib/rubygems/source/local.rb @@ -4,6 +4,7 @@ # dependencies. class Gem::Source::Local < Gem::Source + def initialize # :nodoc: @specs = nil @api_uri = nil @@ -128,4 +129,5 @@ class Gem::Source::Local < Gem::Source end end end + end diff --git a/lib/rubygems/source/lock.rb b/lib/rubygems/source/lock.rb index 49f097467b..3b3f491750 100644 --- a/lib/rubygems/source/lock.rb +++ b/lib/rubygems/source/lock.rb @@ -5,6 +5,7 @@ # dependency lock files. class Gem::Source::Lock < Gem::Source + ## # The wrapped Gem::Source @@ -47,4 +48,5 @@ class Gem::Source::Lock < Gem::Source def uri # :nodoc: @wrapped.uri end + end diff --git a/lib/rubygems/source/specific_file.rb b/lib/rubygems/source/specific_file.rb index 24db1440dd..a22772b9c0 100644 --- a/lib/rubygems/source/specific_file.rb +++ b/lib/rubygems/source/specific_file.rb @@ -4,6 +4,7 @@ # local gems. class Gem::Source::SpecificFile < Gem::Source + ## # The path to the gem for this specific file. @@ -68,4 +69,5 @@ class Gem::Source::SpecificFile < Gem::Source super end end + end diff --git a/lib/rubygems/source/vendor.rb b/lib/rubygems/source/vendor.rb index 543acf1388..a87fa63331 100644 --- a/lib/rubygems/source/vendor.rb +++ b/lib/rubygems/source/vendor.rb @@ -3,6 +3,7 @@ # This represents a vendored source that is similar to an installed gem. class Gem::Source::Vendor < Gem::Source::Installed + ## # Creates a new Vendor source for a gem that was unpacked at +path+. @@ -22,4 +23,5 @@ class Gem::Source::Vendor < Gem::Source::Installed nil end end + end diff --git a/lib/rubygems/source_list.rb b/lib/rubygems/source_list.rb index 13b25b63dc..fa65f2438b 100644 --- a/lib/rubygems/source_list.rb +++ b/lib/rubygems/source_list.rb @@ -14,6 +14,7 @@ # The most common way to get a SourceList is Gem.sources. class Gem::SourceList + include Enumerable ## @@ -147,4 +148,5 @@ class Gem::SourceList @sources.delete_if {|x| x.uri.to_s == source.to_s } end end + end diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb index f748b090cc..82b7bb4618 100644 --- a/lib/rubygems/spec_fetcher.rb +++ b/lib/rubygems/spec_fetcher.rb @@ -9,6 +9,7 @@ require 'rubygems/name_tuple' # SpecFetcher handles metadata updates from remote gem repositories. class Gem::SpecFetcher + include Gem::UserInteraction include Gem::Text @@ -258,4 +259,5 @@ class Gem::SpecFetcher raise unless gracefully_ignore [] end + end diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb index 883cad35f9..5f119fde85 100644 --- a/lib/rubygems/specification.rb +++ b/lib/rubygems/specification.rb @@ -34,6 +34,7 @@ require 'rubygems/util/list' # items you may add to a specification. class Gem::Specification < Gem::BasicSpecification + extend Gem::Deprecate # REFACTOR: Consider breaking out this version stuff into a separate @@ -2662,4 +2663,5 @@ class Gem::Specification < Gem::BasicSpecification def raw_require_paths # :nodoc: @require_paths end + end diff --git a/lib/rubygems/specification_policy.rb b/lib/rubygems/specification_policy.rb index 2b8b05635e..b93ff89a3c 100644 --- a/lib/rubygems/specification_policy.rb +++ b/lib/rubygems/specification_policy.rb @@ -1,6 +1,7 @@ require 'rubygems/user_interaction' class Gem::SpecificationPolicy + include Gem::UserInteraction VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/.freeze # :nodoc: @@ -482,4 +483,5 @@ You have specified rake based extension, but rake is not added as dependency. It def help_text # :nodoc: "See https://guides.rubygems.org/specification-reference/ for help" end + end diff --git a/lib/rubygems/stub_specification.rb b/lib/rubygems/stub_specification.rb index 5d4d761953..959030fd54 100644 --- a/lib/rubygems/stub_specification.rb +++ b/lib/rubygems/stub_specification.rb @@ -5,6 +5,7 @@ # information. class Gem::StubSpecification < Gem::BasicSpecification + # :nodoc: PREFIX = "# stub: ".freeze @@ -12,6 +13,7 @@ class Gem::StubSpecification < Gem::BasicSpecification OPEN_MODE = 'r:UTF-8:-'.freeze class StubLine # :nodoc: all + attr_reader :name, :version, :platform, :require_paths, :extensions, :full_name @@ -54,6 +56,7 @@ class Gem::StubSpecification < Gem::BasicSpecification REQUIRE_PATHS[x] || x end end + end def self.default_gemspec_stub(filename, base_dir, gems_dir) @@ -209,4 +212,5 @@ class Gem::StubSpecification < Gem::BasicSpecification def stubbed? data.is_a? StubLine end + end diff --git a/lib/rubygems/syck_hack.rb b/lib/rubygems/syck_hack.rb index 051483eac8..0d87c71df4 100644 --- a/lib/rubygems/syck_hack.rb +++ b/lib/rubygems/syck_hack.rb @@ -40,11 +40,13 @@ module YAML # :nodoc: # should. module Syck class DefaultKey + remove_method :to_s rescue nil def to_s '=' end + end end diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index 7bf7142a45..3dd10d6dfc 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -83,6 +83,7 @@ end require "rubygems/command" class Gem::Command + ## # Allows resetting the hash of specific args per command. This method is # available when requiring 'rubygems/test_case' @@ -90,6 +91,7 @@ class Gem::Command def self.specific_extra_args_hash=(value) @specific_extra_args_hash = value end + end ## @@ -99,6 +101,7 @@ end # your normal set of gems is not affected. class Gem::TestCase < Minitest::Test + extend Gem::Deprecate attr_accessor :fetcher # :nodoc: @@ -1267,6 +1270,7 @@ Also, a list: end class << self + # :nodoc: ## # Return the join path, with escaping backticks, dollars, and @@ -1282,6 +1286,7 @@ Also, a list: "\"#{path.gsub(/[`$"]/, '\\&')}\"" end end + end @@good_rake = "#{rubybin} #{escape_path(TEST_PATH, 'good_rake.rb')}" @@ -1399,6 +1404,7 @@ Also, a list: # It is available by requiring Gem::TestCase. class StaticSet < Gem::Resolver::Set + ## # A StaticSet ignores remote because it has a fixed set of gems. @@ -1453,6 +1459,7 @@ Also, a list: def prefetch(reqs) # :nodoc: end + end ## @@ -1520,6 +1527,7 @@ Also, a list: PUBLIC_KEY = nil PUBLIC_CERT = nil end if defined?(OpenSSL::SSL) + end require 'rubygems/test_utilities' diff --git a/lib/rubygems/test_utilities.rb b/lib/rubygems/test_utilities.rb index 3bbe68ca0c..53c888d066 100644 --- a/lib/rubygems/test_utilities.rb +++ b/lib/rubygems/test_utilities.rb @@ -29,6 +29,7 @@ require 'rubygems/remote_fetcher' # See RubyGems' tests for more examples of FakeFetcher. class Gem::FakeFetcher + attr_reader :data attr_reader :last_request attr_accessor :paths @@ -161,13 +162,16 @@ class Gem::FakeFetcher download spec, source.uri.to_s end + end # :stopdoc: class Gem::RemoteFetcher + def self.fetcher=(fetcher) @fetcher = fetcher end + end # :startdoc: @@ -187,6 +191,7 @@ end # After the gems are created they are removed from Gem.dir. class Gem::TestCase::SpecFetcherSetup + ## # Executes a SpecFetcher setup block. Yields an instance then creates the # gems and specifications defined in the instance. @@ -341,6 +346,7 @@ class Gem::TestCase::SpecFetcherSetup io.write spec.to_ruby_for_cache end end + end ## @@ -352,6 +358,7 @@ end # This class was added to flush out problems in Rubinius' IO implementation. class TempIO < Tempfile + ## # Creates a new TempIO that will be initialized to contain +string+. @@ -369,4 +376,5 @@ class TempIO < Tempfile flush Gem.read_binary path end + end diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb index 51ac3494f3..2552fc715d 100644 --- a/lib/rubygems/uninstaller.rb +++ b/lib/rubygems/uninstaller.rb @@ -21,6 +21,7 @@ require 'rubygems/user_interaction' # file. See Gem.pre_uninstall and Gem.post_uninstall for details. class Gem::Uninstaller + include Gem::UserInteraction include Gem::InstallerUninstallerUtils @@ -373,4 +374,5 @@ class Gem::Uninstaller raise e end + end diff --git a/lib/rubygems/uri_formatter.rb b/lib/rubygems/uri_formatter.rb index ab5cc78e67..f3d510470b 100644 --- a/lib/rubygems/uri_formatter.rb +++ b/lib/rubygems/uri_formatter.rb @@ -9,6 +9,7 @@ require 'cgi' # p uf.normalize #=> 'http://example.com' class Gem::UriFormatter + ## # The URI to be formatted. @@ -43,4 +44,5 @@ class Gem::UriFormatter return unless @uri CGI.unescape @uri end + end diff --git a/lib/rubygems/uri_parser.rb b/lib/rubygems/uri_parser.rb index f350edec8c..5c7cabc436 100644 --- a/lib/rubygems/uri_parser.rb +++ b/lib/rubygems/uri_parser.rb @@ -5,6 +5,7 @@ # class Gem::UriParser + ## # Parses the #uri, raising if it's invalid @@ -31,4 +32,5 @@ class Gem::UriParser rescue URI::InvalidURIError uri end + end diff --git a/lib/rubygems/user_interaction.rb b/lib/rubygems/user_interaction.rb index 27a9957117..fe55c56999 100644 --- a/lib/rubygems/user_interaction.rb +++ b/lib/rubygems/user_interaction.rb @@ -172,6 +172,7 @@ end # Gem::StreamUI implements a simple stream based user interface. class Gem::StreamUI + extend Gem::Deprecate ## @@ -386,6 +387,7 @@ class Gem::StreamUI # An absolutely silent progress reporter. class SilentProgressReporter + ## # The count of items is never updated for the silent progress reporter. @@ -410,12 +412,14 @@ class Gem::StreamUI def done end + end ## # A basic dotted progress reporter. class SimpleProgressReporter + include Gem::DefaultUserInteraction ## @@ -453,12 +457,14 @@ class Gem::StreamUI def done @out.puts "\n#{@terminal_message}" end + end ## # A progress reporter that prints out messages about the current progress. class VerboseProgressReporter + include Gem::DefaultUserInteraction ## @@ -495,6 +501,7 @@ class Gem::StreamUI def done @out.puts @terminal_message end + end ## @@ -512,6 +519,7 @@ class Gem::StreamUI # An absolutely silent download reporter. class SilentDownloadReporter + ## # The silent download reporter ignores all arguments @@ -537,12 +545,14 @@ class Gem::StreamUI def done end + end ## # A progress reporter that behaves nicely with threaded downloading. class ThreadedDownloadReporter + MUTEX = Mutex.new ## @@ -591,7 +601,9 @@ class Gem::StreamUI @out.puts message end end + end + end ## @@ -599,6 +611,7 @@ end # STDOUT, and STDERR. class Gem::ConsoleUI < Gem::StreamUI + ## # The Console UI has no arguments as it defaults to reading input from # stdin, output to stdout and warnings or errors to stderr. @@ -606,12 +619,14 @@ class Gem::ConsoleUI < Gem::StreamUI def initialize super STDIN, STDOUT, STDERR, true end + end ## # SilentUI is a UI choice that is absolutely silent. class Gem::SilentUI < Gem::StreamUI + ## # The SilentUI has no arguments as it does not use any stream. @@ -637,4 +652,5 @@ class Gem::SilentUI < Gem::StreamUI def progress_reporter(*args) # :nodoc: SilentProgressReporter.new(@outs, *args) end + end diff --git a/lib/rubygems/util.rb b/lib/rubygems/util.rb index 2a55305172..814a4075fd 100644 --- a/lib/rubygems/util.rb +++ b/lib/rubygems/util.rb @@ -71,9 +71,11 @@ module Gem::Util end class << self + extend Gem::Deprecate rubygems_deprecate :silent_system + end ## diff --git a/lib/rubygems/util/licenses.rb b/lib/rubygems/util/licenses.rb index 29bf310ea0..5b82667785 100644 --- a/lib/rubygems/util/licenses.rb +++ b/lib/rubygems/util/licenses.rb @@ -2,6 +2,7 @@ require 'rubygems/text' class Gem::Licenses + extend Gem::Text NONSTANDARD = 'Nonstandard'.freeze @@ -434,4 +435,5 @@ class Gem::Licenses return unless lowest < license.size by_distance[lowest] end + end diff --git a/lib/rubygems/util/list.rb b/lib/rubygems/util/list.rb index 33c40af4bb..7e4d6b5de6 100644 --- a/lib/rubygems/util/list.rb +++ b/lib/rubygems/util/list.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true module Gem class List + include Enumerable attr_accessor :value, :tail @@ -33,5 +34,6 @@ module Gem return List.new(value) unless list List.new value, list end + end end diff --git a/lib/rubygems/validator.rb b/lib/rubygems/validator.rb index 30cdd93b5c..b53dff7b12 100644 --- a/lib/rubygems/validator.rb +++ b/lib/rubygems/validator.rb @@ -12,6 +12,7 @@ require 'rubygems/installer' # Validator performs various gem file and gem database validation class Gem::Validator + include Gem::UserInteraction def initialize # :nodoc: @@ -140,4 +141,5 @@ class Gem::Validator errors end + end diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb index 20bbff4fdd..5c48a02afa 100644 --- a/lib/rubygems/version.rb +++ b/lib/rubygems/version.rb @@ -150,6 +150,7 @@ # a zero to give a sensible result. class Gem::Version + autoload :Requirement, File.expand_path('requirement', __dir__) include Comparable @@ -403,4 +404,5 @@ class Gem::Version numeric_segments = string_segments.slice!(0, string_start || string_segments.size) return numeric_segments, string_segments end + end |