aboutsummaryrefslogtreecommitdiffstats
path: root/gem_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'gem_helper.rb')
-rwxr-xr-xgem_helper.rb30
1 files changed, 14 insertions, 16 deletions
diff --git a/gem_helper.rb b/gem_helper.rb
index 6661575..86dfced 100755
--- a/gem_helper.rb
+++ b/gem_helper.rb
@@ -57,10 +57,8 @@ if ARGV[0] == "build" or ARGV[0] == "install"
argv.delete_at(0)
end
- file_data = Zlib::GzipReader.open("metadata.gz")
- header = YAML::load(file_data)
- file_data.close()
- body = header.instance_variable_get :@ivars
+ file_data = Zlib::GzipReader.open("metadata.gz") { |gz| gz.read() }
+ header = YAML.load(file_data)
require 'rubygems'
spec = Gem::Specification.from_yaml(YAML.dump(header))
@@ -79,7 +77,7 @@ if ARGV[0] == "build" or ARGV[0] == "install"
end
end
- if body['extensions'].size > 0
+ if header.extensions.size > 0
require 'rubygems/ext'
module Gem::Ext
class Builder
@@ -121,22 +119,22 @@ if ARGV[0] == "build" or ARGV[0] == "install"
unless dry_run
Gem::Installer.new(spec).build_extensions
else
- for ext in body['extensions']
+ for ext in header.extensions
files.push(ext[0..ext.rindex("/")-1]+".so")
end
end
- body['extensions'].clear()
+ header.extensions.clear()
end
if ARGV[0] == "build"
- body['test_files'].clear()
+ header.test_files.clear()
# We don't want ext/ in require_paths, it will only contain content for
# building extensions which needs to be installed in sitearchdir anyways..
idx = 0
- for i in 0..body['require_paths'].size()-1
- if body['require_paths'][idx].match("^ext(/|$)")
- body['require_paths'].delete_at(idx)
+ for i in 0..header.require_paths.size()-1
+ if header.require_paths[idx].match("^ext(/|$)")
+ header.require_paths.delete_at(idx)
else
idx += 1
end
@@ -144,19 +142,19 @@ if ARGV[0] == "build" or ARGV[0] == "install"
# We'll get rid of all the files we don't really need to install
idx = 0
- for i in 0..body['files'].size()-1
- if filter and body['files'][idx].match(filter)
+ for i in 0..header.files.size()-1
+ if filter and header.files[idx].match(filter)
match = true
else
match = false
- for path in body['require_paths']
- if body['files'][idx].match("^%s/" % path)
+ for path in header.require_paths
+ if header.files[idx].match("^%s/" % path)
match = true
end
end
end
if !match
- body['files'].delete_at(idx)
+ header.files.delete_at(idx)
else
idx += 1
end