Rakefile in gumdrop-0.8.0 vs Rakefile in gumdrop-1.0.0

- old
+ new

@@ -1,30 +1,46 @@ -$LOAD_PATH.unshift File.expand_path("../lib", __FILE__) -require "gumdrop/version" +#!/usr/bin/env rake + require 'rake/testtask' +require "bundler/gem_tasks" -desc "builds gem" -task :build do - system "gem build gumdrop.gemspec" +Rake::TestTask.new do |t| + t.libs.push "lib" + t.test_files = FileList['specs/*_spec.rb'] + t.verbose = false end - -desc "releases gem" -task :release => :build do - system "gem push gumdrop-#{Gumdrop::VERSION}.gem" + +task :default do + puts `rake -T` end -desc "installs gem" -task :install => :build do - system "gem install gumdrop-#{Gumdrop::VERSION}" +desc 'clears fixture generated output' +task :test_output_clear do + require 'fileutils' + here= File.dirname __FILE__ + FileUtils.rm_rf File.join( here, 'specs', 'fixtures', 'output' ) end -desc "uninstalls gem" -task :uninstall do - system "gem uninstall gumdrop" +desc "generates fixture site then tests output against expected fixture data" +task :test_output => :test_output_clear do + sh "cd specs/fixtures/source && bundle exec gumdrop build -f" + diff_results= `diff -w -r -y -N -q --suppress-common-lines specs/fixtures/output specs/fixtures/expected` + if diff_results.empty? + puts "\n\nPASS: All files matched!" + puts "#{ diff_results }" + diff_results.split("\n") + else + puts "\n\nFAIL: Not all files matched:\n\n" + puts "#{ diff_results }" + matcher= Regexp.new('Files (.*) and', 'i') + diff_results.scan(matcher).flatten.each do |fname| + puts "\n\n" + puts `diff -w -C 3 #{fname} #{fname.gsub('fixtures/output', 'fixtures/expected')}` + end + end + puts "" end - -Rake::TestTask.new do |t| - t.libs.push "lib" - t.test_files = FileList['specs/*_spec.rb'] - t.verbose = true -end \ No newline at end of file +desc "test generated output > OpenDiff" +task :test_output_ui do + sh "cd specs/fixtures/source && bundle exec gumdrop build -f && opendiff ../output ../expected" +end