|
| 1 | +# see http://blog.jayfields.com/2008/02/rake-task-overwriting.html |
| 2 | +desc 'override bundler release task' |
| 3 | +task :release => ['build'] do |
| 4 | + STDOUT.puts "Running Bundler Release Task Override" |
| 5 | +end |
| 6 | +require 'bundler/gem_tasks' |
| 7 | + |
| 8 | +GEMSPEC = Bundler::GemHelper.gemspec |
| 9 | + |
| 10 | +# bundler-free alternative |
| 11 | +# packaging |
| 12 | +# https://github.com/YorickPeterse/ruby-lint/blob/master/Rakefile |
| 13 | +# require 'rubygems/package_task' |
| 14 | +# GEMSPEC = Gem::Specification.load('metric_fu.gemspec') |
| 15 | +# |
| 16 | +# Gem::PackageTask.new(GEMSPEC) do |pkg| |
| 17 | +# pkg.need_tar = false |
| 18 | +# pkg.need_zip = false |
| 19 | +# end |
| 20 | + |
| 21 | +# gem signing |
| 22 | +# desc 'Builds and signs a new Gem' |
| 23 | +# task :build => [:gem] do |
| 24 | +# name = "#{GEMSPEC.name}-#{GEMSPEC.version}.gem" |
| 25 | +# path = File.join(File.expand_path('../../pkg', __FILE__), name) |
| 26 | +# |
| 27 | +# sh("gem sign #{path}") |
| 28 | +# |
| 29 | +# Rake::Task['checksum'].invoke |
| 30 | +# end |
| 31 | + |
| 32 | +require 'digest/sha2' |
| 33 | + |
| 34 | +desc 'Creates a SHA512 checksum of the current version' |
| 35 | +task :checksum => ['build'] do |
| 36 | + checksums = File.expand_path('../../checksum', __FILE__) |
| 37 | + name = "#{GEMSPEC.name}-#{GEMSPEC.version}.gem" |
| 38 | + path = File.join(File.expand_path('../../pkg', __FILE__), name) |
| 39 | + |
| 40 | + checksum_name = File.basename(path) + '.sha512' |
| 41 | + checksum = Digest::SHA512.new.hexdigest(File.read(path)) |
| 42 | + |
| 43 | + File.open(File.join(checksums, checksum_name), 'w') do |handle| |
| 44 | + handle.write(checksum) |
| 45 | + end |
| 46 | +end |
0 commit comments