Skip to content

Commit

Permalink
Rakefile love
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Feb 26, 2011
1 parent 64f6052 commit 9de4278
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions Rakefile
Expand Up @@ -9,11 +9,14 @@ task :spec => :test
CLEAN.include "**/*.rbc"

def source_version
line = File.read('lib/sinatra/base.rb')[/^\s*VERSION = .*/]
line.match(/.*VERSION = '(.*)'/)[1]
@source_version ||= begin
line = File.read('lib/sinatra/base.rb')[/^\s*VERSION = .*/]
line.match(/.*VERSION = '(.*)'/)[1]
end
end

# SPECS ===============================================================

task :test do
ENV['LANG'] = 'C'
ENV.delete 'LC_CTYPE'
Expand All @@ -24,26 +27,26 @@ Rake::TestTask.new(:test) do |t|
t.ruby_opts = ['-rubygems'] if defined? Gem
t.ruby_opts << '-I.'
end

# Rcov ================================================================

namespace :test do
desc 'Mesures test coverage'
task :coverage do
rm_f "coverage"
rcov = "rcov --text-summary -Ilib"
system("#{rcov} --no-html --no-color test/*_test.rb")
sh "rcov -Ilib test/*_test.rb"
end
end

# Website =============================================================
# Building docs requires HAML and the hanna gem:
# gem install mislav-hanna --source=http://gems.github.com

desc 'Generate RDoc under doc/api'
task 'doc' => ['doc:api']
task('doc:api') { sh "yardoc -o doc/api" }
CLEAN.include 'doc/api'

# README ===============================================================

task :add_template, [:name] do |t, args|
Dir.glob('README.*') do |file|
code = File.read(file)
Expand Down

0 comments on commit 9de4278

Please sign in to comment.