diff options
-rw-r--r-- | lib/rubygems.rb | 9 | ||||
-rw-r--r-- | lib/rubygems/commands/help_command.rb | 10 | ||||
-rw-r--r-- | lib/rubygems/commands/list_command.rb | 10 | ||||
-rw-r--r-- | lib/rubygems/commands/owner_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/pristine_command.rb | 9 | ||||
-rw-r--r-- | lib/rubygems/commands/push_command.rb | 3 | ||||
-rw-r--r-- | lib/rubygems/commands/search_command.rb | 20 | ||||
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 58 | ||||
-rw-r--r-- | lib/rubygems/commands/specification_command.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/commands/update_command.rb | 2 | ||||
-rwxr-xr-x | lib/rubygems/core_ext/kernel_require.rb | 8 | ||||
-rw-r--r-- | lib/rubygems/defaults.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/dependency_installer.rb | 1 | ||||
-rw-r--r-- | lib/rubygems/dependency_resolver.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/errors.rb | 4 | ||||
-rw-r--r-- | lib/rubygems/gemcutter_utilities.rb | 18 | ||||
-rw-r--r-- | lib/rubygems/installer.rb | 11 | ||||
-rw-r--r-- | lib/rubygems/package.rb | 1 | ||||
-rw-r--r-- | lib/rubygems/platform.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/specification.rb | 50 |
20 files changed, 145 insertions, 81 deletions
@@ -8,7 +8,7 @@ require 'rbconfig' module Gem - VERSION = '2.0.3' end # Must be first since it unloads the prelude from 1.9.2 @@ -173,7 +173,12 @@ module Gem # require will try to activate the more specific version. spec = Gem::Specification.find_inactive_by_path path - return false unless spec begin spec.activate @@ -113,7 +113,15 @@ platform. format = "#{' ' * margin_width}%-#{desc_width}s%s" command_manager.command_names.each do |cmd_name| - summary = command_manager[cmd_name].summary summary = wrap(summary, summary_width).split "\n" out << sprintf(format, cmd_name, summary.shift) until summary.empty? do @@ -7,9 +7,8 @@ require 'rubygems/commands/query_command' class Gem::Commands::ListCommand < Gem::Commands::QueryCommand - def initialize(name = 'list', - summary = 'Display gems whose name starts with STRING') - super name, summary remove_option('--name-matches') end @@ -27,9 +26,8 @@ class Gem::Commands::ListCommand < Gem::Commands::QueryCommand end def execute - name = get_one_optional_argument || '' - options[:name] = /^#{name}/i - super end @@ -73,7 +73,7 @@ class Gem::Commands::OwnerCommand < Gem::Command request.add_field "Authorization", api_key end - with_response response rescue # ignore end @@ -10,7 +10,8 @@ class Gem::Commands::PristineCommand < Gem::Command def initialize super 'pristine', 'Restores installed gems to pristine condition from files located in the gem cache', - :version => Gem::Requirement.default, :extensions => true, :all => false add_option('--all', @@ -37,7 +38,7 @@ class Gem::Commands::PristineCommand < Gem::Command end def defaults_str # :nodoc: - "--all --extensions" end def description # :nodoc: @@ -52,8 +53,8 @@ for the gem are regenerated. If the cached gem cannot be found, you will need to use `gem install` to revert the gem. -If --no-extensions is provided pristine will not attempt to restore gems with -extensions. EOF end @@ -20,7 +20,8 @@ class Gem::Commands::PushCommand < Gem::Command end def initialize - super 'push', description add_proxy_option add_key_option @@ -1,17 +1,31 @@ require 'rubygems/command' -require 'rubygems/commands/list_command' -class Gem::Commands::SearchCommand < Gem::Commands::ListCommand def initialize super 'search', 'Display all gems whose name contains STRING' - @defaults[:domain] = :remote end def defaults_str # :nodoc: "--remote --no-details" end end @@ -159,29 +159,7 @@ By default, this RubyGems will install gem as: options[:previous_version] = Gem::Version.new(options[:previous_version]) - release_notes = File.join Dir.pwd, 'History.txt' - - release_notes = if File.exist? release_notes then - history = File.read release_notes - history = history.sub(/^# coding:.*?^=/m, '') - - text = history.split(HISTORY_HEADER) - text.shift # correct an off-by-one generated by split - version_lines = history.scan(HISTORY_HEADER) - versions = history.scan(VERSION_MATCHER).flatten.map { |x| Gem::Version.new(x) } - - history_string = "" - - until versions.length == 0 or versions.shift < options[:previous_version] - history_string += version_lines.shift + text.shift - end - - history_string - else - "Oh-no! Unable to find release notes!" - end - - say release_notes say say "-" * 78 @@ -458,6 +436,40 @@ abort "#{deprecation_message}" end end def uninstall_old_gemcutter require 'rubygems/uninstaller' @@ -28,7 +28,7 @@ class Gem::Commands::SpecificationCommand < Gem::Command options[:format] = :ruby end - add_option('--yaml', 'Output RUBY format') do |value, options| options[:format] = :yaml end @@ -94,7 +94,7 @@ class Gem::Commands::UpdateCommand < Gem::Command say "Updating #{name}" begin - @installer.install name, version success = true rescue Gem::InstallError => e alert_error "Error installing #{name}:\n\t#{e.message}" @@ -4,6 +4,8 @@ # See LICENSE.txt for permissions. #++ module Kernel if defined?(gem_original_require) then @@ -31,7 +33,11 @@ module Kernel # The normal <tt>require</tt> functionality of returning false if # that file has already been loaded is preserved. def require path spec = Gem.find_unresolved_default_spec(path) if spec Gem.remove_unresolved_default_spec(spec) @@ -111,6 +117,8 @@ module Kernel end raise load_error end private :require @@ -54,7 +54,9 @@ module Gem # Path for gems in the user's home directory def self.user_dir - File.join Gem.user_home, '.gem', ruby_engine, ConfigMap[:ruby_version] end ## @@ -63,7 +63,6 @@ class Gem::DependencyInstaller # HACK shouldn't change the global settings, needed for -i behavior # maybe move to the install command? See also #442 Gem::Specification.dirs = @install_dir - Gem.ensure_gem_subdirectories @install_dir end options = DEFAULT_OPTIONS.merge options @@ -349,7 +349,7 @@ module Gem when Dependency @dependency == other when DependencyRequest - @dependency == other.dep && @requester == other.requester else false end @@ -62,10 +62,10 @@ module Gem ## # A wordy description of the error. def wordy - "Found %s (%), but was for platform%s %s" % [@name, @version, - @platforms.size == 1 ? 's' : '', @platforms.join(' ,')] end end @@ -38,7 +38,7 @@ module Gem::GemcutterUtilities say "Enter your #{pretty_host} credentials." say "Don't have an account yet? " + - "Create one at https://#{sign_in_host}/sign_up" email = ask " Email: " password = ask_for_password "Password: " @@ -60,7 +60,14 @@ module Gem::GemcutterUtilities configured_host = Gem.host unless Gem.configuration.disable_default_gem_server - @host ||= ENV['RUBYGEMS_HOST'] || configured_host end def rubygems_api_request(method, path, host = nil, &block) @@ -79,7 +86,7 @@ module Gem::GemcutterUtilities Gem::RemoteFetcher.fetcher.request(uri, request_method, &block) end - def with_response(resp) case resp when Net::HTTPSuccess then if block_given? then @@ -88,7 +95,10 @@ module Gem::GemcutterUtilities say resp.body end else - say resp.body terminate_interaction 1 # TODO: question this end end @@ -331,8 +331,9 @@ class Gem::Installer # specifications directory. def write_spec - File.open(spec_file, "w") do |file| file.puts spec.to_ruby_for_cache end end @@ -773,7 +774,13 @@ EOF def write_build_info_file return if @build_args.empty? - open spec.build_info_file, 'w' do |io| @build_args.each do |arg| io.puts arg end @@ -336,7 +336,6 @@ EOM open destination, 'wb', entry.header.mode do |out| out.write entry.read - out.fsync rescue nil # for filesystems without fsync(2) end say destination if Gem.configuration.really_verbose @@ -74,6 +74,7 @@ class Gem::Platform when /hpux(\d+)?/ then [ 'hpux', $1 ] when /^java$/, /^jruby$/ then [ 'java', nil ] when /^java([\d.]*)/ then [ 'java', $1 ] when /^dotnet$/ then [ 'dotnet', nil ] when /^dotnet([\d.]*)/ then [ 'dotnet', $1 ] when /linux/ then [ 'linux', $1 ] @@ -155,6 +156,7 @@ class Gem::Platform when /^i686-darwin(\d)/ then ['x86', 'darwin', $1 ] when /^i\d86-linux/ then ['x86', 'linux', nil ] when 'java', 'jruby' then [nil, 'java', nil ] when /dotnet(\-(\d+\.\d+))?/ then ['universal','dotnet', $2 ] when /mswin32(\_(\d+))?/ then ['x86', 'mswin32', $2 ] when 'powerpc-darwin' then ['powerpc', 'darwin', nil ] @@ -5,6 +5,17 @@ # See LICENSE.txt for permissions. #++ ## # The Specification class contains the information for a Gem. Typically # defined in a .gemspec file or a Rakefile, and looks like this: @@ -20,32 +31,19 @@ # s.homepage = 'https://rubygems.org/gems/example' # end # -# Starting in RubyGems 1.9.0, a Specification can hold arbitrary -# metadata. This metadata is accessed via Specification#metadata -# and has the following restrictions: # -# * Must be a Hash object -# * All keys and values must be Strings -# * Keys can be a maximum of 128 bytes and values can be a -# maximum of 1024 bytes -# * All strings must be UTF8, no binary data is allowed # -# For example, to add metadata for the location of a bugtracker: # # s.metadata = { "bugtracker" => "http://somewhere.com/blah" } -# - - -require 'rubygems/version' -require 'rubygems/requirement' -require 'rubygems/platform' -require 'rubygems/deprecate' - -# :stopdoc: -# date.rb can't be loaded for `make install` due to miniruby -# Date is needed for old gems that stored #date as Date instead of Time. -class Date; end -# :startdoc: class Gem::Specification @@ -918,7 +916,7 @@ class Gem::Specification result = Hash.new { |h,k| h[k] = {} } native = {} - Gem::Specification._all.reverse_each do |spec| next if spec.version.prerelease? unless prerelease native[spec.name] = spec.version if spec.platform == Gem::Platform::RUBY @@ -995,7 +993,7 @@ class Gem::Specification # TODO: maybe we should switch to rubygems' version service? fetcher = Gem::SpecFetcher.fetcher - latest_specs.each do |local| dependency = Gem::Dependency.new local.name, ">= #{local.version}" remotes, _ = fetcher.search_for_dependency dependency remotes = remotes.map { |n, _| n.version } @@ -1236,7 +1234,7 @@ class Gem::Specification unless dependency.respond_to?(:name) && dependency.respond_to?(:version_requirements) - dependency = Gem::Dependency.new(dependency, requirements, type) end dependencies << dependency @@ -2270,7 +2268,7 @@ class Gem::Specification require 'rubygems/psych_tree' end - builder = Gem::NoAliasYAMLTree.create builder << self ast = builder.tree |