Permalink
Browse files

- Gem::DocManager is no longer used by RubyGems. Gem::RDoc is now used.

- Gem::FilePermissionError now has an a #directory accessor.

The "Successfully installed foo-1.0" message is now printed by a post_install hook.
  • Loading branch information...
1 parent 1146b29 commit bfafdb46e31503eff2046978e75bee91d969d042 @drbrain drbrain committed Jun 7, 2011
View
@@ -68,6 +68,7 @@ lib/rubygems/gem_path_searcher.rb
lib/rubygems/gem_runner.rb
lib/rubygems/gemcutter_utilities.rb
lib/rubygems/indexer.rb
+lib/rubygems/install_message.rb
lib/rubygems/install_update_options.rb
lib/rubygems/installer.rb
lib/rubygems/installer_test_case.rb
@@ -86,6 +87,7 @@ lib/rubygems/package/tar_writer.rb
lib/rubygems/package_task.rb
lib/rubygems/path_support.rb
lib/rubygems/platform.rb
+lib/rubygems/rdoc.rb
lib/rubygems/remote_fetcher.rb
lib/rubygems/require_paths_builder.rb
lib/rubygems/requirement.rb
@@ -104,12 +106,14 @@ lib/rubygems/version.rb
lib/rubygems/version_option.rb
lib/ubygems.rb
setup.rb
+test/rubygems/bad_rake.rb
test/rubygems/bogussources.rb
test/rubygems/data/gem-private_key.pem
test/rubygems/data/gem-public_cert.pem
test/rubygems/fake_certlib/openssl.rb
test/rubygems/fix_openssl_warnings.rb
test/rubygems/foo/discover.rb
+test/rubygems/good_rake.rb
test/rubygems/insure_session.rb
test/rubygems/plugin/exception/rubygems_plugin.rb
test/rubygems/plugin/load/rubygems_plugin.rb
@@ -176,6 +180,7 @@ test/rubygems/test_gem_package_tar_writer.rb
test/rubygems/test_gem_package_task.rb
test/rubygems/test_gem_path_support.rb
test/rubygems/test_gem_platform.rb
+test/rubygems/test_gem_rdoc.rb
test/rubygems/test_gem_remote_fetcher.rb
test/rubygems/test_gem_requirement.rb
test/rubygems/test_gem_security.rb
View
5 diff
@@ -0,0 +1,5 @@
+- Gem::DocManager is no longer used by RubyGems. Gem::RDoc is now used.
+
+- Gem::FilePermissionError now has an a #directory accessor.
+
+The "Successfully installed foo-1.0" message is now printed by a post_install hook.
@@ -1,10 +1,11 @@
require 'rubygems/command'
-require 'rubygems/doc_manager'
require 'rubygems/install_update_options'
require 'rubygems/dependency_installer'
require 'rubygems/local_remote_options'
require 'rubygems/validator'
require 'rubygems/version_option'
+require 'rubygems/install_message' # must come before rdoc for messaging
+require 'rubygems/rdoc'
##
# Gem installer command line tool
@@ -13,6 +14,8 @@
class Gem::Commands::InstallCommand < Gem::Command
+ attr_reader :installed_specs # :nodoc:
+
include Gem::VersionOption
include Gem::LocalRemoteOptions
include Gem::InstallUpdateOptions
@@ -30,6 +33,8 @@ def initialize
add_platform_option
add_version_option
add_prerelease_option "to be installed. (Only for listed gems)"
+
+ @installed_specs = nil
end
def arguments # :nodoc:
@@ -104,7 +109,7 @@ def execute
alert "use --ignore-dependencies to install only the gems you list"
end
- installed_gems = []
+ @installed_specs = []
ENV.delete 'GEM_PATH' if options[:install_dir].nil? and RUBY_VERSION > '1.9'
@@ -123,11 +128,7 @@ def execute
inst = Gem::DependencyInstaller.new options
inst.install gem_name, options[:version]
- inst.installed_gems.each do |spec|
- say "Successfully installed #{spec.full_name}"
- end
-
- installed_gems.push(*inst.installed_gems)
+ @installed_specs.push(*inst.installed_gems)
rescue Gem::InstallError => e
alert_error "Error installing #{gem_name}:\n\t#{e.message}"
exit_code |= 1
@@ -138,9 +139,9 @@ def execute
end
end
- unless installed_gems.empty? then
- gems = installed_gems.length == 1 ? 'gem' : 'gems'
- say "#{installed_gems.length} #{gems} installed"
+ unless @installed_specs.empty? then
+ gems = @installed_specs.length == 1 ? 'gem' : 'gems'
+ say "#{@installed_specs.length} #{gems} installed"
end
raise Gem::SystemExitException, exit_code
@@ -1,6 +1,6 @@
require 'rubygems/command'
require 'rubygems/version_option'
-require 'rubygems/doc_manager'
+require 'rubygems/rdoc'
class Gem::Commands::RdocCommand < Gem::Command
include Gem::VersionOption
@@ -54,37 +54,26 @@ def usage # :nodoc:
end
def execute
- if options[:all] then
- specs = Gem::SourceIndex.from_installed_gems.collect { |name, spec|
- spec
- }
- else
- gem_name = get_one_gem_name
- dep = Gem::Dependency.new gem_name, options[:version]
- specs = Gem::SourceIndex.from_installed_gems.search dep
+ specs = if options[:all] then
+ Gem::Specification.to_a
+ else
+ get_all_gem_names.map do |name|
+ Gem::Specification.find_by_name name, options[:version]
+ end.flatten.uniq
+ end
+
+ if specs.empty? then
+ alert_error 'No matching gems found'
+ terminate_interaction 1
end
- if specs.empty?
- raise "Failed to find gem #{gem_name} to generate RDoc for #{options[:version]}"
- end
-
- if options[:include_ri]
- specs.sort.each do |spec|
- doc = Gem::DocManager.new(spec)
- doc.generate_ri if options[:overwrite] || !doc.ri_installed?
- end
+ specs.each do |spec|
+ doc = Gem::RDoc.new spec, options[:include_rdoc], options[:include_ri]
- Gem::DocManager.update_ri_cache
- end
+ doc.force = options[:overwrite]
- if options[:include_rdoc]
- specs.sort.each do |spec|
- doc = Gem::DocManager.new(spec)
- doc.generate_rdoc if options[:overwrite] || !doc.rdoc_installed?
- end
+ doc.generate
end
-
- true
end
end
@@ -1,10 +1,12 @@
require 'rubygems/command'
require 'rubygems/command_manager'
+require 'rubygems/dependency_installer'
require 'rubygems/install_update_options'
require 'rubygems/local_remote_options'
require 'rubygems/spec_fetcher'
require 'rubygems/version_option'
-require 'rubygems/commands/install_command'
+require 'rubygems/install_message' # must come before rdoc for messaging
+require 'rubygems/rdoc'
class Gem::Commands::UpdateCommand < Gem::Command
@@ -96,7 +98,6 @@ def update_gem name, version = Gem::Requirement.default
@installer.installed_gems.each do |spec|
@updated << spec
- say "Successfully installed #{spec.full_name}" if success
end
end
@@ -15,8 +15,7 @@ class Gem::DependencyInstaller
attr_reader :installed_gems
##
- # Arguments for use by RDoc. Used to generate documentation by
- # Gem::DocManager
+ # Arguments for use by RDoc to generate documentation
attr_reader :rdoc_args
@@ -7,9 +7,14 @@
require 'rubygems'
##
-# The documentation manager generates RDoc and RI for RubyGems.
+# The documentation manager formerly generated RDoc and RI for RubyGems.
+#
+# This file is no longer used, see rubygems/rdoc.rb for details of modern
+# usage.
+#
+# Require 'rubygems/rdoc' and use Gem::RDoc now.
-class Gem::DocManager
+class Gem::DocManager # :nodoc: all
include Gem::UserInteraction
@@ -268,5 +273,3 @@ def uninstall_doc
end
-Gem.post_installs(&Gem::DocManager.method(:generation_hook))
-
View
@@ -26,11 +26,18 @@ class Gem::EndOfYAMLException < Gem::Exception; end
##
# Signals that a file permission error is preventing the user from
-# installing in the requested directories.
+# operating on the given directory.
+
class Gem::FilePermissionError < Gem::Exception
- def initialize(path)
- super("You don't have write permissions into the #{path} directory.")
+
+ attr_reader :directory
+
+ def initialize directory
+ @directory = directory
+
+ super "You don't have write permissions for the #{directory} directory."
end
+
end
##
@@ -4,10 +4,9 @@
# See LICENSE.txt for permissions.
#++
-require "rubygems"
+require 'rubygems'
require 'rubygems/command_manager'
require 'rubygems/config_file'
-require 'rubygems/doc_manager'
##
# Load additional plugins from $LOAD_PATH
@@ -29,7 +28,6 @@ def initialize(options={})
# TODO: nuke these options
@command_manager_class = options[:command_manager] || Gem::CommandManager
@config_file_class = options[:config_file] || Gem::ConfigFile
- @doc_manager_class = options[:doc_manager] || Gem::DocManager
end
##
@@ -78,7 +76,6 @@ def do_configuration(args)
Gem.configuration = @config_file_class.new(args)
Gem.use_paths Gem.configuration[:gemhome], Gem.configuration[:gempath]
Gem::Command.extra_args = Gem.configuration[:gem]
- @doc_manager_class.configured_args = Gem.configuration[:rdoc]
end
end
@@ -0,0 +1,8 @@
+require 'rubygems'
+require 'rubygems/user_interaction'
+
+Gem.post_install do |installer|
+ ui = Gem::DefaultUserInteraction.ui
+ ui.say "Successfully installed #{installer.spec.full_name}"
+end
+
Oops, something went wrong.

0 comments on commit bfafdb4

Please sign in to comment.