Rakefile in sinatra-1.3.0.d vs Rakefile in sinatra-1.3.0.e

- old
+ new

@@ -8,12 +8,12 @@ CLEAN.include "**/*.rbc" def source_version @source_version ||= begin - line = File.read('lib/sinatra/base.rb')[/^\s*VERSION = .*/] - line.match(/.*VERSION = '(.*)'/)[1] + load './lib/sinatra/version.rb' + Sinatra::VERSION end end def prev_feature source_version.gsub(/^(\d\.)(\d+)\..*$/) { $1 + ($2.to_i - 1).to_s } @@ -35,10 +35,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 @@ -88,22 +98,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 => ", " 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 ============================================================ @@ -139,31 +153,9 @@ git archive \ --prefix=sinatra-#{source_version}/ \ --format=tar \ HEAD | gzip > #{f.name} SH - end - - 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 - 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 =~ /^\./ }. - reject { |file| file =~ /^doc/ }. - map{ |file| " #{file}" }. - join("\n") - # piece file back together and write... - manifest = " s.files = %w[\n#{files}\n ]\n" - spec = [head,manifest,tail].join(" # = MANIFEST =\n") - File.open(f.name, 'w') { |io| io.write(spec) } - puts "updated #{f.name}" end task 'release' => ['test', package('.gem')] do sh <<-SH gem install #{package('.gem')} --local &&