Skip to content
This repository
tag: v1.2.0
Fetching contributors…

Cannot retrieve contributors at this time

file 24 lines (20 sloc) 0.505 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
task :default => [:loc, :spec]

desc %(Run specs)
task :spec do
  exec %(ruby -Ilib -rubygems lib/nibbler.rb --color)
end

desc %(Count lines of code in implementation)
task :loc do
  File.open('lib/nibbler.rb') do |file|
    loc, counting = 1, false
    
    file.each_line do |line|
      case line
      when /^class\b/ then counting = true
      when /^\s*(#|$)/ then next
      when /^end\b/ then break
      end
      loc += 1 if counting
    end
    
    puts "#{loc} lines of code"
  end
end
Something went wrong with that request. Please try again.