Rakefile in libxml-ruby-0.3.8.4 vs Rakefile in libxml-ruby-0.5.0
- old
+ new
@@ -117,18 +117,21 @@
# Packaging / Version number tasks -----------------------------------
# Used during release packaging if a REL is supplied
task :update_version do
unless PKG_VERSION == CURRENT_VERSION
+ pkg_vernum = PKG_VERSION.tr('.','').sub(/^0*/,'')
+ pkg_vernum << '0' until pkg_vernum.length > 2
+
File.open('ext/xml/libxml.h.new','w+') do |f|
maj, min, mic, patch = /(\d+)\.(\d+)(?:\.(\d+))?(?:\.(\d+))?/.match(PKG_VERSION).captures
f << File.read('ext/xml/libxml.h').
gsub(/RUBY_LIBXML_VERSION\s+"(\d.+)"/) { "RUBY_LIBXML_VERSION \"#{PKG_VERSION}\"" }.
- gsub(/RUBY_LIBXML_VERNUM\s+\d+/) { "RUBY_LIBXML_VERNUM #{PKG_VERSION.tr('.','').sub(/^0*/,'')}" }.
- gsub(/RUBY_LIBXML_VER_MAJ\s+\d+/) { "RUBY_LIBXML_VER_MAJ #{maj}" }.
- gsub(/RUBY_LIBXML_VER_MIN\s+\d+/) { "RUBY_LIBXML_VER_MIN #{min}" }.
- gsub(/RUBY_LIBXML_VER_MIC\s+\d+/) { "RUBY_LIBXML_VER_MIC #{mic || 0}" }.
- gsub(/RUBY_LIBXML_VER_PATCH\s+\d+/) { "RUBY_LIBXML_VER_PATCH #{patch || 0}" }
+ gsub(/RUBY_LIBXML_VERNUM\s+\d+/) { "RUBY_LIBXML_VERNUM #{pkg_vernum}" }.
+ gsub(/RUBY_LIBXML_VER_MAJ\s+\d+/) { "RUBY_LIBXML_VER_MAJ #{maj}" }.
+ gsub(/RUBY_LIBXML_VER_MIN\s+\d+/) { "RUBY_LIBXML_VER_MIN #{min}" }.
+ gsub(/RUBY_LIBXML_VER_MIC\s+\d+/) { "RUBY_LIBXML_VER_MIC #{mic || 0}" }.
+ gsub(/RUBY_LIBXML_VER_PATCH\s+\d+/) { "RUBY_LIBXML_VER_PATCH #{patch || 0}" }
end
mv('ext/xml/libxml.h.new', 'ext/xml/libxml.h')
end
end