Rakefile in sinatra-0.9.0.5 vs Rakefile in sinatra-0.9.1

- old
+ new

@@ -1,25 +1,20 @@ -require 'rubygems' require 'rake/clean' +require 'rake/testtask' require 'fileutils' -task :default => :test +task :default => [:test] +task :spec => :test # SPECS =============================================================== -desc 'Run specs with story style output' -task :spec do - pattern = ENV['TEST'] || '.*' - sh "specrb --testcase '#{pattern}' --specdox -Ilib:test test/*_test.rb" +Rake::TestTask.new(:test) do |t| + t.test_files = FileList['test/*_test.rb'] + t.ruby_opts = ['-rubygems'] if defined? Gem end -desc 'Run specs with unit test style output' -task :test do |t| - sh "specrb -Ilib:test test/*_test.rb" -end - -desc 'Run compatibility specs' +desc 'Run compatibility specs (requires test/spec)' task :compat do |t| pattern = ENV['TEST'] || '.*' sh "specrb --testcase '#{pattern}' -Ilib:test compat/*_test.rb" end @@ -48,10 +43,11 @@ task :install => package('.gem') do sh "gem install #{package('.gem')}" end directory 'dist/' +CLOBBER.include('dist') file package('.gem') => %w[dist/ sinatra.gemspec] + spec.files do |f| sh "gem build sinatra.gemspec" mv File.basename(f.name), f.name end @@ -65,15 +61,10 @@ SH end # Rubyforge Release / Publish Tasks ================================== -desc 'Publish website to rubyforge' -task 'publish:doc' => 'doc/api/index.html' do - sh 'scp -rp doc/* rubyforge.org:/var/www/gforge-projects/sinatra/' -end - desc 'Publish gem and tarball to rubyforge' task 'publish:gem' => [package('.gem'), package('.tar.gz')] do |t| sh <<-end rubyforge add_release sinatra sinatra #{spec.version} #{package('.gem')} && rubyforge add_file sinatra sinatra #{spec.version} #{package('.tar.gz')} @@ -82,11 +73,11 @@ # Website ============================================================ # Building docs requires HAML and the hanna gem: # gem install mislav-hanna --source=http://gems.github.com -task 'doc' => ['doc:api','doc:site'] +task 'doc' => ['doc:api'] desc 'Generate Hanna RDoc under doc/api' task 'doc:api' => ['doc/api/index.html'] file 'doc/api/index.html' => FileList['lib/**/*.rb','README.rdoc'] do |f| @@ -107,50 +98,9 @@ def rdoc_to_html(file_name) require 'rdoc/markup/to_html' rdoc = RDoc::Markup::ToHtml.new rdoc.convert(File.read(file_name)) end - -def haml(locals={}) - require 'haml' - template = File.read('doc/template.haml') - haml = Haml::Engine.new(template, :format => :html4, :attr_wrapper => '"') - haml.render(Object.new, locals) -end - -desc 'Build website HTML and stuff' -task 'doc:site' => ['doc/index.html', 'doc/book.html'] - -file 'doc/index.html' => %w[README.rdoc doc/template.haml] do |file| - File.open(file.name, 'w') do |file| - file << haml(:title => 'Sinatra', :content => rdoc_to_html('README.rdoc')) - end -end -CLEAN.include 'doc/index.html' - -file 'doc/book.html' => ['book/output/sinatra-book.html'] do |file| - File.open(file.name, 'w') do |file| - book_content = File.read('book/output/sinatra-book.html') - file << haml(:title => 'Sinatra Book', :content => book_content) - end -end -CLEAN.include 'doc/book.html' - -file 'book/output/sinatra-book.html' => FileList['book/**'] do |f| - unless File.directory?('book') - sh 'git clone git://github.com/cschneid/sinatra-book.git book' - end - sh((<<-SH).strip.gsub(/\s+/, ' ')) - cd book && - git fetch origin && - git rebase origin/master && - thor book:build - SH -end -CLEAN.include 'book/output/sinatra-book.html' - -desc 'Build the Sinatra book' -task 'doc:book' => ['book/output/sinatra-book.html'] # Gemspec Helpers ==================================================== def source_version line = File.read('lib/sinatra/base.rb')[/^\s*VERSION = .*/]