[packages/rpm/dev-5.4.17] gem_helper: add spec-dump to write self contained .gemspec

qboosh qboosh at pld-linux.org
Wed Feb 5 17:21:55 CET 2020


commit d85f6f92ee221ebbfc6576b658ab0813e95e1037
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Thu Jun 2 01:20:56 2016 +0300

    gem_helper: add spec-dump to write self contained .gemspec

 gem_helper.rb | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 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
 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm.git/commitdiff/cffb64ba2db7b311147604c09b2ed00ea8974d6d



More information about the pld-cvs-commit mailing list