forked from jmchambers/code_golf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
23 lines (19 loc) · 646 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
require 'rubygems'
require 'rake'
require 'rspec/core/rake_task'
COUNT_WHITESPACE = false
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
end
task :default => [:spec, :count]
task :count do
open(File.dirname(__FILE__) "/lib/golf.rb") do |file|
solution = file.read
solution.gsub!(/\s/,"") unless COUNT_WHITESPACE
total_characters = solution.length
puts "-----------------------------------------------"
puts "| Congratulations, you've completed the course."
puts "| Total characters: #{total_characters} "
puts "-----------------------------------------------"
end
end