[前][次][番号順一覧][スレッド一覧]

ruby-changes:27275

From: drbrain <ko1@a...>
Date: Wed, 20 Feb 2013 09:35:49 +0900 (JST)
Subject: [ruby-changes:27275] drbrain:r39327 (trunk): * lib/rubygems/commands/update_command.rb: Create the installer after

drbrain	2013-02-20 09:34:58 +0900 (Wed, 20 Feb 2013)

  New Revision: 39327

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=39327

  Log:
    * lib/rubygems/commands/update_command.rb:  Create the installer after
      options are processed.  [ruby-trunk - Bug #7779]
    * test/rubygems/test_gem_commands_update_command.rb:  Test for the
      above.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rubygems/commands/update_command.rb
    trunk/test/rubygems/test_gem_commands_update_command.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 39326)
+++ ChangeLog	(revision 39327)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Feb 20 09:34:43 2013  Eric Hodel  <drbrain@s...>
+
+	* lib/rubygems/commands/update_command.rb:  Create the installer after
+	  options are processed.  [ruby-trunk - Bug #7779]
+	* test/rubygems/test_gem_commands_update_command.rb:  Test for the
+	  above.
+
 Wed Feb 20 07:51:19 2013  Eric Hodel  <drbrain@s...>
 
 	* lib/rubygems/installer.rb:  Use gsub instead of gsub! to avoid
Index: lib/rubygems/commands/update_command.rb
===================================================================
--- lib/rubygems/commands/update_command.rb	(revision 39326)
+++ lib/rubygems/commands/update_command.rb	(revision 39327)
@@ -14,6 +14,8 @@ class Gem::Commands::UpdateCommand < Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/update_command.rb#L14
   include Gem::LocalRemoteOptions
   include Gem::VersionOption
 
+  attr_reader :installer # :nodoc:
+
   def initialize
     super 'update', 'Update installed gems to the latest version',
       :document => %w[rdoc ri],
@@ -39,7 +41,7 @@ class Gem::Commands::UpdateCommand < Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/update_command.rb#L41
     add_prerelease_option "as update targets"
 
     @updated   = []
-    @installer = Gem::DependencyInstaller.new options
+    @installer = nil
   end
 
   def arguments # :nodoc:
@@ -85,6 +87,9 @@ class Gem::Commands::UpdateCommand < Gem https://github.com/ruby/ruby/blob/trunk/lib/rubygems/commands/update_command.rb#L87
 
   def update_gem name, version = Gem::Requirement.default
     return if @updated.any? { |spec| spec.name == name }
+
+    @installer ||= Gem::DependencyInstaller.new options
+
     success = false
 
     say "Updating #{name}"
Index: test/rubygems/test_gem_commands_update_command.rb
===================================================================
--- test/rubygems/test_gem_commands_update_command.rb	(revision 39326)
+++ test/rubygems/test_gem_commands_update_command.rb	(revision 39327)
@@ -355,6 +355,23 @@ class TestGemCommandsUpdateCommand < Gem https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_update_command.rb#L355
     assert_empty out
   end
 
+  def test_execute_user_install
+    util_clear_gems
+
+    Gem::Installer.new(@a1_path).install
+
+    @cmd.handle_options %w[--user-install]
+
+    use_ui @ui do
+      @cmd.execute
+    end
+
+    installer = @cmd.installer
+    user_install = installer.instance_variable_get :@user_install
+
+    assert user_install, 'user_install must be set on the installer'
+  end
+
   def test_handle_options_system
     @cmd.handle_options %w[--system]
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]