Rakefile in rhubarb-0.4.0 vs Rakefile in rhubarb-0.4.2

- old
+ new

@@ -44,49 +44,65 @@ def name return 'rhubarb' end def pkg_name - return "ruby-" + name() + "ruby-#{name}" end def pkg_spec - return pkg_name() + ".spec" + "#{pkg_name}.spec" end def pkg_rel return `grep -i 'define rel' #{pkg_spec} | awk '{print $3}'`.chomp() end def pkg_source - return pkg_name() + "-" + pkg_version() + "-" + pkg_rel() + ".tar.gz" + return "#{pkg_name}-#{pkg_version}.tar.gz" end def pkg_dir return pkg_name() + "-" + pkg_version() end def rpm_dirs return %w{BUILD BUILDROOT RPMS SOURCES SPECS SRPMS} end +def package_prefix + "#{pkg_name}-#{pkg_version}" +end + +def pristine_name + "#{package_prefix}.tar.gz" +end + +desc "upload a pristine tarball for the current release to fedorahosted" +task :upload_pristine => [:pristine] do + raise "Please set FH_USERNAME" unless ENV['FH_USERNAME'] + sh "scp #{pristine_name} #{ENV['FH_USERNAME']}@fedorahosted.org:grid" +end + +desc "generate a pristine tarball for the tag corresponding to the current version" +task :pristine do + sh "git archive --format=tar v#{pkg_version} --prefix=#{package_prefix}/ | gzip -9nv > #{pristine_name}" +end + desc "create RPMs" -task :rpms => [:build, :tarball, :gen_spec] do +task :rpms => [:tarball, :gen_spec] do FileUtils.cp pkg_spec(), 'SPECS' sh "rpmbuild --define=\"_topdir \${PWD}\" -ba SPECS/#{pkg_spec}" end desc "Generate the specfile" task :gen_spec do sh "cat #{pkg_spec}" + ".in" + "| sed 's/RHUBARB_VERSION/#{pkg_version}/' > #{pkg_spec}" end desc "Create a tarball" -task :tarball => [:make_rpmdirs, :gen_spec] do - FileUtils.cp_r 'lib', pkg_dir() - FileUtils.cp ['LICENSE', 'README.rdoc', 'CHANGES', 'TODO', 'VERSION'], pkg_dir() - sh "tar -cf #{pkg_source} #{pkg_dir}" - FileUtils.mv pkg_source(), 'SOURCES' +task :tarball => [:make_rpmdirs, :pristine] do + FileUtils.cp pristine_name, 'SOURCES' end desc "Make dirs for building RPM" task :make_rpmdirs => :clean do FileUtils.mkdir pkg_dir()