Rakefile in minitar-0.5.4 vs Rakefile in minitar-0.6

- old
+ new

@@ -1,113 +1,52 @@ -#! /usr/bin/env rake -$LOAD_PATH.unshift('lib') +# -*- ruby encoding: utf-8 -*- require 'rubygems' -require 'rake/gempackagetask' -require 'rake/contrib/rubyforgepublisher' -require 'archive/tar/minitar' -require 'zlib' +require 'hoe' +require 'rake/clean' -DISTDIR = "archive-tar-minitar-#{Archive::Tar::Minitar::VERSION}" -TARDIST = "../#{DISTDIR}.tar.gz" +$LOAD_PATH.unshift('support') -DATE_RE = %r<(\d{4})[./-]?(\d{2})[./-]?(\d{2})(?:[\sT]?(\d{2})[:.]?(\d{2})[:.]?(\d{2})?)?> +Hoe.plugin :doofus +Hoe.plugin :gemspec2 +Hoe.plugin :git +Hoe.plugin :minitest +Hoe.plugin :travis +Hoe.plugin :deprecated_gem +Hoe.plugin :email unless ENV['CI'] or ENV['TRAVIS'] -if ENV['RELEASE_DATE'] - year, month, day, hour, minute, second = DATE_RE.match(ENV['RELEASE_DATE']).captures - year ||= 0 - month ||= 0 - day ||= 0 - hour ||= 0 - minute ||= 0 - second ||= 0 - ReleaseDate = Time.mktime(year, month, day, hour, minute, second) -else - ReleaseDate = nil -end +spec = Hoe.spec 'minitar' do + developer('Austin Ziegler', 'halostatue@gmail.com') -task :test do |t| - require 'test/unit/testsuite' - require 'test/unit/ui/console/testrunner' + require_ruby_version '>= 1.8' - runner = Test::Unit::UI::Console::TestRunner + self.history_file = 'History.md' + self.readme_file = 'README.rdoc' + self.licenses = ['Ruby', 'BSD-2-Clause'] - $LOAD_PATH.unshift('tests') - Dir['tests/tc_*.rb'].each do |testcase| - load testcase - end + self.post_install_message = <<-EOS +The `minitar` executable is no longer bundled with `minitar`. If you are +expecting this executable, make sure you also install `minitar-cli`. + EOS - suite = Test::Unit::TestSuite.new - - ObjectSpace.each_object(Class) do |testcase| - suite << testcase.suite if testcase < Test::Unit::TestCase - end - - runner.run(suite) + extra_dev_deps << ['hoe-doofus', '~> 1.0'] + extra_dev_deps << ['hoe-gemspec2', '~> 1.1'] + extra_dev_deps << ['hoe-git', '~> 1.6'] + extra_dev_deps << ['hoe-rubygems', '~> 1.0'] + extra_dev_deps << ['hoe-travis', '~> 1.2'] + extra_dev_deps << ['minitest', '~> 5.3'] + extra_dev_deps << ['minitest-autotest', ['>= 1.0', '<2']] + extra_dev_deps << ['rake', '>= 10.0', '< 12'] + extra_dev_deps << ['rdoc', '>= 0.0'] end -spec = eval(File.read("archive-tar-minitar.gemspec")) -desc "Build the RubyGem for Archive::Tar::Minitar." -task :gem => [ :test ] -Rake::GemPackageTask.new(spec) do |g| - g.need_tar = false - g.need_zip = false - g.package_dir = ".." -end - -desc "Build an Archive::Tar::Minitar .tar.gz distribution." -task :tar => [ TARDIST ] -file TARDIST do |t| - current = File.basename(Dir.pwd) - Dir.chdir("..") do - begin - files = Dir["#{current}/**/*"].select { |dd| dd !~ %r{(?:/CVS/?|~$)} } - files.map! do |dd| - ddnew = dd.gsub(/^#{current}/, DISTDIR) - mtime = ReleaseDate || File.stat(dd).mtime - if File.directory?(dd) - { :name => ddnew, :mode => 0755, :dir => true, :mtime => mtime } - else - if dd =~ %r{bin/} - mode = 0755 - else - mode = 0644 - end - data = File.read(dd) - { :name => ddnew, :mode => mode, :data => data, :size => data.size, - :mtime => mtime } - end - end - - ff = File.open(t.name.gsub(%r{^\.\./}o, ''), "wb") - gz = Zlib::GzipWriter.new(ff) - tw = Archive::Tar::Minitar::Writer.new(gz) - - files.each do |entry| - if entry[:dir] - tw.mkdir(entry[:name], entry) - else - tw.add_file_simple(entry[:name], entry) { |os| os.write(entry[:data]) } - end - end - ensure - tw.close if tw - gz.close if gz +if RUBY_VERSION >= '2.0' && RUBY_ENGINE == 'ruby' + namespace :test do + desc 'Run test coverage' + task :coverage do + spec.test_prelude = 'load ".simplecov-prelude.rb"' + Rake::Task['test'].execute end end -end -task TARDIST => [ :test ] -def sign(file) - sh %("C:\\Program Files\\Windows Privacy Tools\\GnuPG\\Gpg.exe" -ba #{file}) -end - -task :signtar => [ :tar ] do - sign TARDIST -end -task :signgem => [ :gem ] do - sign "../#{DISTDIR}.gem" -end - -desc "Build everything." -task :default => [ :signtar, :signgem ] do + Rake::Task['travis'].prerequisites.replace(%w(test:coverage)) end