aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/commands/unpack_command.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-09 21:38:59 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-06-09 21:38:59 +0000
commit31c94ffeb5f09d09ac2c86fc9e6614e38251a43d (patch)
tree10e44506238c7af3d7c9d822111996731726e38d /lib/rubygems/commands/unpack_command.rb
parenta6afbaeb3be396c0fdea3b9077d9256c59edcfca (diff)
downloadruby-31c94ffeb5f09d09ac2c86fc9e6614e38251a43d.tar.gz
Update to RubyGems 1.3.4 r2223
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/unpack_command.rb')
-rw-r--r--lib/rubygems/commands/unpack_command.rb26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb
index ab2494b0da..075dc04203 100644
--- a/lib/rubygems/commands/unpack_command.rb
+++ b/lib/rubygems/commands/unpack_command.rb
@@ -12,7 +12,7 @@ class Gem::Commands::UnpackCommand < Gem::Command
:version => Gem::Requirement.default,
:target => Dir.pwd
- add_option('--target', 'target directory for unpacking') do |value, options|
+ add_option('--target=DIR', 'target directory for unpacking') do |value, options|
options[:target] = value
end
@@ -35,18 +35,20 @@ class Gem::Commands::UnpackCommand < Gem::Command
# TODO: allow, e.g., 'gem unpack rake-0.3.1'. Find a general solution for
# this, so that it works for uninstall as well. (And check other commands
# at the same time.)
+
def execute
- gemname = get_one_gem_name
- path = get_path(gemname, options[:version])
-
- if path then
- basename = File.basename(path).sub(/\.gem$/, '')
- target_dir = File.expand_path File.join(options[:target], basename)
- FileUtils.mkdir_p target_dir
- Gem::Installer.new(path, :unpack => true).unpack target_dir
- say "Unpacked gem: '#{target_dir}'"
- else
- alert_error "Gem '#{gemname}' not installed."
+ get_all_gem_names.each do |name|
+ path = get_path name, options[:version]
+
+ if path then
+ basename = File.basename(path).sub(/\.gem$/, '')
+ target_dir = File.expand_path File.join(options[:target], basename)
+ FileUtils.mkdir_p target_dir
+ Gem::Installer.new(path, :unpack => true).unpack target_dir
+ say "Unpacked gem: '#{target_dir}'"
+ else
+ alert_error "Gem '#{name}' not installed."
+ end
end
end