Rakefile in rb-threadframe-0.38 vs Rakefile in rb-threadframe-0.39

- old
+ new

@@ -2,25 +2,26 @@ # -*- Ruby -*- require 'rubygems' require 'fileutils' ROOT_DIR = File.dirname(__FILE__) +Gemspec_filename='rb-threadframe.gemspec' require 'rbconfig' RUBY_PATH = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['RUBY_INSTALL_NAME']) def gemspec - @gemspec ||= eval(File.read('.gemspec'), binding, '.gemspec') + @gemspec ||= eval(File.read(Gemspec_filename), binding, Gemspec_filename) end require 'rake/gempackagetask' desc "Build the gem" task :package=>:gem task :gem=>:gemspec do Dir.chdir(ROOT_DIR) do - sh "gem build .gemspec" + sh "gem build #{Gemspec_filename}" FileUtils.mkdir_p 'pkg' FileUtils.mv("#{gemspec.file_name}", "pkg/") end end @@ -48,23 +49,24 @@ derived_files = Dir.glob('.o') + Dir.glob('*.so') rm derived_files unless derived_files.empty? end end -def run_standalone_ruby_file(directory) - puts ('*' * 10) + ' ' + directory + ' ' + ('*' * 10) +def run_standalone_ruby_file(directory, opts={}) + puts(('*' * 10) + ' ' + directory + ' ' + ('*' * 10)) Dir.chdir(directory) do Dir.glob('*.rb').each do |ruby_file| - puts ('-' * 20) + ' ' + ruby_file + ' ' + ('-' * 20) + puts(('-' * 20) + ' ' + ruby_file + ' ' + ('-' * 20)) system(RUBY_PATH, ruby_file) + break if $?.exitstatus != 0 && !opts[:continue] end end end -desc "Create a GNU-style ChangeLog via git2cl" +desc 'Create a GNU-style ChangeLog via git2cl' task :ChangeLog do - system("git log --pretty --numstat --summary | git2cl > ChangeLog") + system('git log --pretty --numstat --summary | git2cl > ChangeLog') end task :default => [:test] require 'rake/testtask' @@ -107,12 +109,12 @@ gemspec.validate end # --------- RDoc Documentation ------ require 'rake/rdoctask' -desc 'Generate rdoc documentation' -Rake::RDocTask.new('rdoc') do |rdoc| +desc "Generate rdoc documentation" +Rake::RDocTask.new("rdoc") do |rdoc| rdoc.rdoc_dir = 'doc' rdoc.title = 'rb-threadframe' # Make the readme file the start page for the generated html rdoc.options += %w(--main README.md) rdoc.rdoc_files.include('ext/**/*.c', @@ -126,5 +128,12 @@ end task :clobber_rdoc do FileUtils.rm_rf File.join(ROOT_DIR, 'doc') end + +task :rm_patch_residue do + FileUtils.rm_rf FileList['**/*.{rej,orig}'].to_a +end + +desc "Remove built files" +task :clean => [:clobber_package, :clobber_rdoc, :rm_patch_residue]