mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
3842ebb43d
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
18 lines
486 B
Ruby
Executable file
18 lines
486 B
Ruby
Executable file
require 'rubygems'
|
|
require 'rubygems/package'
|
|
|
|
def Gem.unpack(file, dir = nil)
|
|
policy = Gem::Security::LowSecurity
|
|
(policy = policy.dup).ui = Gem::SilentUI.new
|
|
pkg = Gem::Package.new(file)
|
|
pkg.security_policy = policy
|
|
spec = pkg.spec
|
|
target = spec.full_name
|
|
target = File.join(dir, target) if dir
|
|
pkg.extract_files target
|
|
spec_file = File.join(target, "#{spec.name}.gemspec")
|
|
open(spec_file, 'wb') do |f|
|
|
f.print spec.to_ruby
|
|
end
|
|
puts "Unpacked #{file}"
|
|
end
|