Sha256: ebfbbbc63a691fbb0fd08af7a548ccfff74649495d6e36d2a89aaa6d3967ca36

Contents?: true

Size: 1.79 KB

Versions: 23

Compression:

Stored size: 1.79 KB

Contents

# encoding: utf-8
$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
windows = RUBY_PLATFORM =~ /mswin|mingw/

desc "run specs"
task(:spec) { ruby "-S rspec spec#{" -c" unless windows}" }

desc "generate gemspec, update readme"
task :update => :completion do
  require 'travis/version'
  content = File.read('travis.gemspec')

  # fetch data
  fields = {
    :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(',')
    updated << "\n  ]"
    content.sub!(/  s\.#{field} = \[\n(    .*\n)*  \]/, updated)
  end

  # set version
  content.sub! /(s\.version.*=\s+).*/, "\\1\"#{Travis::VERSION}\""

  # 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 version\n\s+).*$/, "\\1#{Travis::VERSION}"
  readme.gsub! /(gem install travis -v )\S+/, "\\1#{Travis::VERSION}"
  readme.gsub! /^\*\*#{Regexp.escape(Travis::VERSION)}\*\* \(not yet released?\)\n/i, "**#{Travis::VERSION}** (#{Time.now.strftime("%B %-d, %Y")})\n"
  File.write('README.md', readme)
end

task :completion do
  require 'travis/tools/completion'
  Travis::Tools::Completion.compile
end

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

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
travis-1.6.6.travis.417.4 Rakefile
travis-1.6.5 Rakefile
travis-1.6.4.travis.414.4 Rakefile
travis-1.6.4.travis.413.4 Rakefile
travis-1.6.4.travis.410.4 Rakefile
travis-1.6.4.travis.411.4 Rakefile
travis-1.6.4.travis.406.4 Rakefile
travis-1.6.4.travis.405.4 Rakefile
travis-1.6.4.travis.395.4 Rakefile
travis-1.6.3 Rakefile
travis-1.6.3.travis.394.4 Rakefile
travis-1.6.3.travis.392.4 Rakefile
travis-1.6.3.travis.390.4 Rakefile
travis-1.6.3.travis.389.4 Rakefile
travis-1.6.3.travis.388.4 Rakefile
travis-1.6.3.travis.387.4 Rakefile
travis-1.6.3.travis.386.4 Rakefile
travis-1.6.3.travis.385.4 Rakefile
travis-1.6.3.travis.384.4 Rakefile
travis-1.6.3.travis.381.4 Rakefile