# File lib/rubygems/commands/unpack_command.rb, line 38
  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."
    end
  end