Sha256: 0cb125e68573af4552643de0c7386dd675174a3db5650b6d9a2a16110b83b81a
Contents?: true
Size: 1.32 KB
Versions: 3
Compression:
Stored size: 1.32 KB
Contents
require 'bundler/gem_tasks' require 'rake/testtask' task :default => [ :tests ] Rake::TestTask.new(:tests) do |t| t.pattern = 'tests/**/*_test.rb' end desc 'Enumerate annotations. Optionally takes a pipe-separated list of tags to process' task :notes, :types do |t, args| args.with_defaults :types => 'FIXME|TODO' types = args[:types].split '|' finder = /.*# ?(?<type>[A-Z]+):? (?<note>.+)$/ result = Hash.new { |hash, key| hash[key] = {} } `git ls-files`.split("\n").each do |p| path = Pathname(p) line_number = 0 path.each_line do |line| line_number += 1 if match = finder.match(line) result[path][line_number] = { :type => match[:type], :note => match[:note] } if types.include? match[:type] end end rescue nil end numbers = [] result.each do |path, lines| lines.each do |number, note| numbers << number end end number_width = numbers.max.to_s.length type_width = types.max_by { |type| type.to_s.length }.to_s.length result.each do |path, lines| puts "\e[1m#{path}\e[0m:" lines.each do |number, note| line_number = "[\e[1m#{number.to_s.rjust(number_width)}\e[0m]" type = "[\e[0;37m#{note[:type]}\e[0m]" puts " * #{line_number} #{type.ljust(type_width + type.length - note[:type].length)} #{note[:note]}" end puts end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
staticpress-0.6.2 | Rakefile |
staticpress-0.6.1 | Rakefile |
staticpress-0.6.0 | Rakefile |