From d2eb086f435776799b4bde76f34ecd5f67eb171f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 2 Jun 2016 01:20:56 +0300 Subject: [PATCH] gem_helper: add spec-dump to write self contained .gemspec --- gem_helper.rb | 23 +++++++++++++++++------ rpm.spec | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/gem_helper.rb b/gem_helper.rb index 2a6bfab..11de3be 100755 --- a/gem_helper.rb +++ b/gem_helper.rb @@ -8,6 +8,22 @@ require 'optparse' require 'rubygems' +# Write the .gemspec specification (in Ruby) +def writespec(spec) + file_name = spec.full_name.untaint + '.gemspec' + File.open(file_name, "w") do |file| + file.puts spec.to_ruby_for_cache + end + print "Wrote: %s\n" % file_name +end + +# make gemspec self-contained +if ARGV[0] == "spec-dump" + spec = eval(File.read(ARGV[1])) + writespec(spec) + exit(0) +end + if ARGV[0] == "build" or ARGV[0] == "install" or ARGV[0] == "spec" require 'yaml' require 'zlib' @@ -69,12 +85,7 @@ if ARGV[0] == "build" or ARGV[0] == "install" or ARGV[0] == "spec" spec = Gem::Specification.from_yaml(YAML.dump(header)) if ARGV[0] == "spec" - # Write the .gemspec specification (in Ruby) - file_name = spec.full_name.untaint + '.gemspec' - File.open(file_name, "w") do |file| - file.puts spec.to_ruby_for_cache - end - print "Wrote: %s\n" % file_name + writespec(spec) exit(0) end diff --git a/rpm.spec b/rpm.spec index 1c6d227..ecdf9d2 100644 --- a/rpm.spec +++ b/rpm.spec @@ -51,7 +51,7 @@ Summary(ru.UTF-8): Менеджер пакетов от RPM Summary(uk.UTF-8): Менеджер пакетів від RPM Name: rpm Version: 5.4.15 -Release: 34 +Release: 35 License: LGPL v2.1 Group: Base # http://rpm5.org/files/rpm/rpm-5.4/rpm-5.4.15-0.20140824.src.rpm -- 2.44.0