Rakefile in sinatra-1.2.6 vs Rakefile in sinatra-1.2.7

- old
+ new

@@ -1,10 +1,16 @@ require 'rake/clean' require 'rake/testtask' require 'fileutils' require 'date' +# CI Reporter is only needed for the CI +begin + require 'ci/reporter/rake/test_unit' +rescue LoadError +end + task :default => :test task :spec => :test CLEAN.include "**/*.rbc" @@ -35,10 +41,20 @@ t.test_files = FileList['test/*_test.rb'] t.ruby_opts = ['-rubygems'] if defined? Gem t.ruby_opts << '-I.' end +Rake::TestTask.new(:"test:core") do |t| + core_tests = %w[base delegator encoding extensions filter + helpers mapped_error middleware radius rdoc + readme request response result route_added_hook + routing server settings sinatra static templates] + t.test_files = core_tests.map {|n| "test/#{n}_test.rb"} + t.ruby_opts = ["-rubygems"] if defined? Gem + t.ruby_opts << "-I." +end + # Rcov ================================================================ namespace :test do desc 'Mesures test coverage' task :coverage do @@ -65,11 +81,11 @@ template = code[/===[^\n]*Liquid.*index\.liquid<\/tt>[^\n]*/m] if !template puts "Liquid not found in #{file}" else puts "Adding section to #{file}" - template = template.gsub(/Liquid/, args.name.capitalize).gsub(/liquid/, args.name.downcase) + template = template.gsub(/Liquid/, args.name.capitalize).gsub(/liquid/, args.name.downcase) code.gsub! /^(\s*===.*CoffeeScript)/, "\n" << template << "\n\\1" File.open(file, "w") { |f| f << code } end end end @@ -88,22 +104,26 @@ authors = commits.keys.sort_by { |n| - commits[n].size } - team puts authors[0..-2].join(', ') << " and " << authors.last, "(based on commits included in #{a.release}, but not in #{a.backports})" end -task :authors, [:format, :sep] do |t, a| - a.with_defaults :format => "%s (%d)", :sep => ', ' +desc "list of authors" +task :authors, [:commit_range, :format, :sep] do |t, a| + a.with_defaults :format => "%s (%d)", :sep => ", ", :commit_range => '--all' authors = Hash.new { |h,k| h[k] = 0 } blake = "Blake Mizerany" + overall = 0 mapping = { "blake.mizerany@gmail.com" => blake, "bmizerany" => blake, "a_user@mac.com" => blake, "ichverstehe" => "Harry Vangberg", "Wu Jiang (nouse)" => "Wu Jiang" } - `git shortlog -s`.lines.map do |line| + `git shortlog -s #{a.commit_range}`.lines.map do |line| num, name = line.split("\t", 2).map(&:strip) authors[mapping[name] || name] += num.to_i + overall += num.to_i end + puts "#{overall} commits by #{authors.count} authors:" puts authors.sort_by { |n,c| -c }.map { |e| a.format % e }.join(a.sep) end # PACKAGING ============================================================ @@ -145,12 +165,11 @@ task 'sinatra.gemspec' => FileList['{lib,test,compat}/**','Rakefile','CHANGES','*.rdoc'] do |f| # read spec file and split out manifest section spec = File.read(f.name) head, manifest, tail = spec.split(" # = MANIFEST =\n") - # replace version and date + # replace version head.sub!(/\.version = '.*'/, ".version = '#{source_version}'") - head.sub!(/\.date = '.*'/, ".date = '#{Date.today.to_s}'") # determine file list from git ls-files files = `git ls-files`. split("\n"). sort. reject{ |file| file =~ /^\./ }.