summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/pristine_command.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-17 22:04:18 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-06-17 22:04:18 +0000
commit9d4f37f51fb2ffdef5e318afb3cb81516dcba4f7 (patch)
tree2eb3c16c59259a25f5d9315edacc61dfc8c59d62 /lib/rubygems/commands/pristine_command.rb
parentf98e6b91dec68ddd010ccb3bad651a18e7dca338 (diff)
Update RubyGems to 1.1.1 r1778 (almost 1.2)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/pristine_command.rb')
-rw-r--r--lib/rubygems/commands/pristine_command.rb47
1 files changed, 3 insertions, 44 deletions
diff --git a/lib/rubygems/commands/pristine_command.rb b/lib/rubygems/commands/pristine_command.rb
index bbea835133..3e55a1bb30 100644
--- a/lib/rubygems/commands/pristine_command.rb
+++ b/lib/rubygems/commands/pristine_command.rb
@@ -82,51 +82,10 @@ revert the gem.
end
# TODO use installer options
- installer = Gem::Installer.new gem, :wrappers => true
+ installer = Gem::Installer.new gem, :wrappers => true, :force => true
+ installer.install
- gem_file = File.join install_dir, "cache", "#{spec.full_name}.gem"
-
- security_policy = nil # TODO use installer option
-
- format = Gem::Format.from_file_by_path gem_file, security_policy
-
- target_directory = File.join(install_dir, "gems", format.spec.full_name)
- target_directory.untaint
-
- pristine_files = format.file_entries.collect { |data| data[0]["path"] }
- file_map = {}
-
- format.file_entries.each do |entry, file_data|
- file_map[entry["path"]] = file_data
- end
-
- Dir.chdir target_directory do
- deployed_files = Dir.glob(File.join("**", "*")) +
- Dir.glob(File.join("**", ".*"))
-
- pristine_files = pristine_files.map { |f| File.expand_path f }
- deployed_files = deployed_files.map { |f| File.expand_path f }
-
- to_redeploy = (pristine_files - deployed_files)
- to_redeploy = to_redeploy.map { |path| path.untaint}
-
- if to_redeploy.length > 0 then
- say "Restoring #{to_redeploy.length} file#{to_redeploy.length == 1 ? "" : "s"} to #{spec.full_name}..."
-
- to_redeploy.each do |path|
- say " #{path}"
- FileUtils.mkdir_p File.dirname(path)
- File.open(path, "wb") do |out|
- out.write file_map[path]
- end
- end
- else
- say "#{spec.full_name} is in pristine condition"
- end
- end
-
- installer.generate_bin
- installer.build_extensions
+ say "Restored #{spec.full_name}"
end
end