Rakefile in travis-1.3.1 vs Rakefile in travis-1.4.0

- old
+ new

@@ -3,24 +3,25 @@ windows = RUBY_PLATFORM =~ /mswin|mingw/ desc "run specs" task(:spec) { ruby "-S rspec spec#{" -c" unless windows}" } -desc "generate gemspec" -task 'travis.gemspec' do +desc "generate gemspec, update readme" +task 'update' do require 'travis/version' content = File.read('travis.gemspec') # fetch data fields = { - :authors => `git shortlog -sn`.b.scan(/[^\d\s].*/), + :authors => `git shortlog -sn`.b.scan(/[^\d\s].*/).map { |a| a == 'petems' ? 'Peter Souter' : a }, :email => `git shortlog -sne`.b.scan(/[^<]+@[^>]+/), :files => `git ls-files`.b.split("\n").reject { |f| f =~ /^(\.|Gemfile)/ } } # :( fields[:email].delete("konstantin.haase@gmail.com") + fields[:authors] # insert data fields.each do |field, values| updated = " s.#{field} = [" updated << values.map { |v| "\n %p" % v }.join(',') @@ -33,11 +34,19 @@ # escape unicode content.gsub!(/./) { |c| c.bytesize > 1 ? "\\u{#{c.codepoints.first.to_s(16)}}" : c } File.open('travis.gemspec', 'w') { |f| f << content } + + readme = File.read('README.md').b + readme.gsub! /^(\s+\$ travis verision\n\s+).*$/, "\\1#{Travis::VERSION}" + readme.gsub! /(gem install travis -v )\S+/, "\\1#{Travis::VERSION}" + File.write('README.md', readme) end -task :gemspec => 'travis.gemspec' +task 'travis.gemspec' => :update +task 'README.md' => :update + +task :gemspec => :update task :default => :spec task :default => :gemspec unless windows or ENV['CI'] task :test => :spec \ No newline at end of file