-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRakefile
38 lines (29 loc) · 902 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
require 'rake/testtask'
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['test/**/*_test.rb']
t.verbose = true
end
task :default => [:test]
task :new_kids_on_the_block do
require 'tempfile'
require 'ruby-debug'
wrapped_source = Tempfile.new('wrapped_source')
wrapped_source.puts 'debugger'
wrapped_source.write File.read('run')
wrapped_source.close
compiled_source = RubyVM::InstructionSequence
.compile_file wrapped_source.path
compiled_source.eval
end
task :clean do
`rm -rf coverage/*`
`find ./ -name \\*~ -delete`
end
task :test => [:clean]
task :stats => :clean do
tloc = `find ./test/ -name \\*.rb -exec cat {} \\; |sed /^\w*$/d |wc -l`.to_i
lloc = `find ./lib -name \\*.rb -exec cat {} \\; |sed /^\w*$/d |wc -l`.to_i
ratio = tloc.to_f / lloc
puts "Code LOC: #{lloc}\tTest LOC: #{tloc}\tCode to Test Ratio: 1:%.2f" % ratio
end