-
Notifications
You must be signed in to change notification settings - Fork 49
/
Rakefile
39 lines (32 loc) · 918 Bytes
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'rake'
require 'rake/gempackagetask' # TODO Remove.
task :default => :spec
# Specs.
#
require 'spec'
require 'spec/rake/spectask'
spec_root = File.join(File.dirname(__FILE__), 'spec')
desc "Run specs"
Spec::Rake::SpecTask.new(:spec) do |t|
t.spec_opts = ['--options', "\"#{File.join(spec_root, 'spec.opts')}\""]
t.spec_files = FileList[File.join(spec_root, '**', '*_spec.rb')]
end
task :simplecov do
ENV['COV'] = 'yes'
end
task :cov do
Rake::Task['simplecov'].invoke
Rake::Task['spec'].invoke
end
# Very pedestrian, coder only cloc.
#
task :stats do
%w|project_prototype lib spec test_project|.each do |dir|
original_dir = dir
dir = "#{dir}/*.rb"
dirs = 5.times.inject([dir]) do |dirs, _|
dirs << dirs.last.gsub(%r{/*.rb}, '/**/*.rb')
end
puts original_dir << ': ' << `wc -l #{dirs.join(' ')} 2>/dev/null`.chop.split("\n").last.gsub(/(\d+)\stotal$/, '\1')
end
end