You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/03/27 07:32:21 UTC

svn commit: r641713 - in /incubator/buildr/trunk: Rakefile doc/css/default.css doc/css/print.css doc/css/syntax.css doc/web.haml rakelib/ rakelib/apache.rake rakelib/doc.rake rakelib/package.rake rakelib/release.rb rakelib/rspec.rake

Author: assaf
Date: Wed Mar 26 23:32:20 2008
New Revision: 641713

URL: http://svn.apache.org/viewvc?rev=641713&view=rev
Log:
Longest Rakefile Ever(tm) now broken up into separate pieces (see rakelib).
More necessary fixes to build process.
PDF building, not as problematic as before.

Added:
    incubator/buildr/trunk/rakelib/
    incubator/buildr/trunk/rakelib/apache.rake
    incubator/buildr/trunk/rakelib/doc.rake
    incubator/buildr/trunk/rakelib/package.rake
    incubator/buildr/trunk/rakelib/release.rb
    incubator/buildr/trunk/rakelib/rspec.rake
Modified:
    incubator/buildr/trunk/Rakefile
    incubator/buildr/trunk/doc/css/default.css
    incubator/buildr/trunk/doc/css/print.css
    incubator/buildr/trunk/doc/css/syntax.css
    incubator/buildr/trunk/doc/web.haml

Modified: incubator/buildr/trunk/Rakefile
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/Rakefile?rev=641713&r1=641712&r2=641713&view=diff
==============================================================================
--- incubator/buildr/trunk/Rakefile (original)
+++ incubator/buildr/trunk/Rakefile Wed Mar 26 23:32:20 2008
@@ -13,29 +13,26 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
-require 'rubygems'
-require 'rake/gempackagetask'
-require 'rake/rdoctask'
-require 'spec/rake/spectask'
-
-# Gem specification comes first, other tasks rely on it.
-def specify(platform)
-  Gem::Specification.new do |spec|
+
+# We need two specifications, for Ruby and Java, and one for the platform we run on.
+$specs = ['ruby', 'java'].inject({}) { |hash, platform|
+  spec = Gem::Specification.new do |spec|
     spec.name         = 'buildr'
     spec.version      = File.read(__FILE__.pathmap('%d/lib/buildr.rb')).scan(/VERSION\s*=\s*(['"])(.*)\1/)[0][1]
     spec.author       = 'Apache Buildr'
     spec.email        = 'buildr-user@incubator.apache.org'
     spec.homepage     = "http://incubator.apache.org/#{spec.name}/"
     spec.summary      = 'A build system that doesn\'t suck'
-    spec.files        = FileList['lib/**/*', 'README', 'CHANGELOG', 'LICENSE', 'NOTICE', 'DISCLAIMER',
-                                 'Rakefile', 'spec/**/*', 'doc/**/*'].to_ary
+    spec.files        = FileList['lib/**/*', 'README', 'CHANGELOG', 'LICENSE', 'NOTICE', 'DISCLAIMER', 'KEYS',
+                                 'Rakefile', 'rakelib/**/*', 'spec/**/*', 'doc/**/*'].to_ary
     spec.require_path = 'lib'
     spec.has_rdoc     = true
-    spec.extra_rdoc_files = ['README', 'CHANGELOG', 'LICENSE', 'NOTICE', 'DISCLAIMER']
+    spec.extra_rdoc_files = ['README', 'CHANGELOG', 'LICENSE', 'NOTICE', 'DISCLAIMER', 'site/buildr.pdf']
     spec.rdoc_options << '--title' << "Buildr -- #{spec.summary}" <<
                          '--main' << 'README' << '--line-numbers' << '--inline-source' << '-p' <<
                          '--webcvs' << 'http://svn.apache.org/repos/asf/incubator/buildr/trunk/'
     spec.rubyforge_project = 'buildr'
+    spec.platform = platform
 
     spec.bindir = 'bin'                               # Use these for applications.
     spec.executables = ['buildr']
@@ -52,39 +49,13 @@
     spec.add_dependency 'xml-simple',           '~> 1.0'
     spec.add_dependency 'archive-tar-minitar',  '~> 0.5'
     spec.add_dependency 'rubyforge',            '~> 0.4'
-    
-    spec.platform = platform
-    spec.add_dependency 'rjb', '~> 1.1' unless platform == 'java'
+    spec.add_dependency 'rjb',                  '~> 1.1' if platform =~ /ruby/
   end
-end
-
+  hash.update(platform=>spec)
+}
+$spec = $specs[RUBY_PLATFORM =~ /java/ ? 'java' : 'ruby']
 
-ruby_spec = specify(Gem::Platform::RUBY)
-ruby_package = Rake::GemPackageTask.new(ruby_spec) { |pkg| pkg.need_tar = pkg.need_zip = true }
-
-jruby_spec = specify('java')
-jruby_package = Rake::GemPackageTask.new(jruby_spec) { |pkg| pkg.need_tar = pkg.need_zip = false }
-
-begin
-  require 'rubygems/dependency_installer'
-  require 'rubygems/doc_manager'
-  def install_gem(gem, options = {})
-    say "Installing #{gem}..."
-    installer = Gem::DependencyInstaller.new(gem, options.delete(:version), options)
-    installer.install
-    installer.installed_gems.each do |spec|
-      Gem::DocManager.new(spec).generate_ri unless options[:ri] == false
-      Gem::DocManager.new(spec).generate_rdoc unless options[:rdoc] == false
-    end
-  end
-rescue LoadError # < rubygems 1.0.1
-  require 'rubygems/remote_installer'
-  def install_gem(gem, options = {})
-    say "Installing #{gem}..."
-    Gem::RemoteInstaller.new.install(gem, options.delete(:version))
-    say 'OK'
-  end
-end
+$license_excluded = ['lib/core/progressbar.rb', 'spec/spec.opts', 'doc/css/syntax.css', '.textile', '.yaml']
 
 
 def ruby(*args)
@@ -100,345 +71,32 @@
 # Setup environment for running this Rakefile (RSpec, Docter, etc).
 desc "If you're building from sources, run this task one to setup the necessary dependencies."
 task 'setup' do
-  # Install all Buildr and documentation dependencies.
-  gems = Gem::SourceIndex.from_installed_gems
-  dependencies = specify(RUBY_PLATFORM).dependencies
-  dependencies << Gem::Dependency.new('docter', '~>1.1')
-  dependencies << Gem::Dependency.new('rcov', '~>0.8') unless RUBY_PLATFORM =~ /java/ 
-  dependencies.select { |dep| gems.search(dep.name, dep.version_requirements).empty? }.
-    each do |dep|
-      ruby 'install', dep.name, '-v', dep.version_requirements.to_s, :command=>'gem', :sudo=>true
-    end
-    #each { |dep| install_gem dep.name, :version=>dep.version_requirements }
+  dependencies = spec.dependencies
+  dependencies = dependencies.reject { |dep| dep.name == 'rjb' } if RUBY_PLATFORM =~ /java/
+  installed = Gem::SourceIndex.from_installed_gems
+  required = dependencies.select { |dep| installed.search(dep.name, dep.version_requirements).empty? }
+  required.each do |dep|
+    puts "Installing #{dep} ..."
+    ruby 'install', dep.name, '-v', dep.version_requirements.to_s, :command=>'gem', :sudo=>true
+  end
 end
 
+
 begin
   require 'highline/import'
 rescue LoadError 
   puts 'HighLine required, please run rake setup first'
 end
 
-# Packaging and local installation.
-#
-desc 'Clean up all temporary directories used for running tests, creating documentation, packaging, etc.'
-task('clobber') { rm_rf 'pkg' }
-
-desc 'Install the package locally'
-task 'install'=>['clobber', 'package'] do |task|
-  pkg = RUBY_PLATFORM =~ /java/ ? jruby_package : ruby_package
-  ruby 'install', File.expand_path(pkg.gem_file, pkg.package_dir), :command=>'gem', :sudo=>true
-end
-
-desc 'Uninstall previously installed packaged'
-task 'uninstall' do |task|
-  spec = RUBY_PLATFORM =~ /java/ ? jruby_spec : ruby_spec
-  say "Uninstalling #{spec.name} ... "
-  ruby 'install', spec.name, :command=>'gem', :sudo=>true
-  say 'Done'
-end
-
-
-# Testing is everything.
-#
-task('clobber') { rm 'failing' rescue nil }
-
-desc 'Run all specs'
-Spec::Rake::SpecTask.new('spec') do |task|
-  task.spec_files = FileList['spec/**/*_spec.rb']
-  task.spec_opts << '--options' << 'spec/spec.opts' << '--format' << 'failing_examples:failing'
-end
-
-desc 'Run all failing examples from previous run'
-Spec::Rake::SpecTask.new('failing') do |task|
-  task.spec_files = FileList['spec/**/*_spec.rb']
-  task.spec_opts << '--options' << 'spec/spec.opts' << '--format' << 'failing_examples:failing' << '--example' << 'failing'
-end
-
-
-namespace 'spec' do
-
-  directory('reports')
-  Rake::Task['rake:clobber'].enhance { rm_rf 'reports' }
-
-  desc 'Run all specs and generate specification and test coverage reports in html directory'
-  Spec::Rake::SpecTask.new('full'=>'reports') do |task|
-    task.spec_files = FileList['spec/**/*_spec.rb']
-    task.spec_opts << '--format' << 'html:reports/specs.html' << '--backtrace'
-    task.rcov = true
-    task.rcov_dir = 'reports/coverage'
-    task.rcov_opts = ['--exclude', 'spec,bin']
-  end
-
-  desc 'Run all specs specifically with Ruby'
-  task('ruby') { system 'ruby -S rake spec' }
-
-  desc 'Run all specs specifically with JRuby'
-  task('jruby') { system 'jruby -S rake spec' }
-end
-
-
-# Documentation.
-#
-desc 'Generate RDoc documentation'
-rdoc = Rake::RDocTask.new(:rdoc) do |rdoc|
-  rdoc.rdoc_dir = 'rdoc'
-  rdoc.title    = ruby_spec.name
-  rdoc.options  = ruby_spec.rdoc_options + ['--promiscuous']
-  rdoc.rdoc_files.include('lib/**/*.rb')
-  rdoc.rdoc_files.include ruby_spec.extra_rdoc_files
-  begin
-    gem 'allison'
-    rdoc.template = File.expand_path('lib/allison.rb', Gem.loaded_specs['allison'].full_gem_path)
-  rescue Exception 
-  end
-end
-
-desc 'Generate all documentation merged into the html directory'
-task 'docs'=>[rdoc.name]
-
-begin
-  require 'docter'
-  require 'docter/server'
-
-  web_docs = {
-    :collection => Docter.collection('Buildr').using('doc/web.toc.yaml').
-      include('doc/pages', 'LICENSE', 'CHANGELOG'),
-    :template   => Docter.template('doc/web.haml').
-      include('doc/css', 'doc/images', 'doc/scripts', 'reports/specs.html', 'reports/coverage', 'rdoc')
-  }
-  print_docs = {
-    :collection => Docter.collection('Buildr').using('doc/print.toc.yaml').
-      include('doc/pages', 'LICENSE'),
-    :template   => Docter.template('doc/print.haml').include('doc/css', 'doc/images')
-  }
-
-  #Docter.filter_for(:footnote) do |html|
-  #  html.gsub(/<p id="fn(\d+)">(.*?)<\/p>/, %{<p id="fn\\1" class="footnote">\\2</p>})
-  #end
-
-  desc 'Generate HTML documentation'
-  html = Docter::Rake.generate('html', web_docs[:collection], web_docs[:template])
-  html.enhance ['spec:full']
-
-  desc 'Run Docter server'
-  Docter::Rake.serve 'docter', web_docs[:collection], web_docs[:template], :port=>3000
-  task('docs').enhance [html]
-  task('clobber') { rm_rf html.to_s }
-
-  if `which prince` =~ /prince/ 
-    desc 'Produce PDF'
-    print = Docter::Rake.generate('print', print_docs[:collection], print_docs[:template], :one_page)
-    pdf = file('html/buildr.pdf'=>print) do |task|
-      mkpath 'html'
-      sh *%W{prince #{print}/index.html -o #{task.name} --media=print} do |ok, res|
-        fail 'Failed to create PDF, see errors above' unless ok
-      end
-    end
-    task('pdf'=>pdf) { |task| `open #{File.expand_path(pdf.to_s)}` }
-    task('docs').enhance [pdf]
-    task('clobber') { rm_rf print.to_s }
-  end
-
-rescue LoadError
-  puts "To generate site documentation, run rake setup first"
-end
 
+desc 'Clean up all temporary directories used for running tests, creating documentation, packaging, etc.'
+task 'clobber'
 
 namespace 'release' do
- 
-  # This task does all prerequisites checks before starting the release, for example,
-  # that we have Groovy and Scala to run all the test cases, or that we have Allison
-  # and PrinceXML to generate the full documentation.
-  task 'check'=>'setup'
-  # This task does all the preparation work before making a release and also checks
-  # that we generate all the right material, for example, that we compiled Java sources,
-  # created the PDF, have coverage report.
-  task 'prepare'=>['clobber', 'check']
-
-  # Does CHANGELOG reflects current release?
-  task 'check' do
-    say 'Checking that CHANGELOG indicates most recent version and today\'s date ... '
-    expecting = "#{ruby_spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
-    header = File.readlines('CHANGELOG').first
-    fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
-    say 'OK'
-  end
-
-  # License requirement.
-  task 'check' do
-    say 'Checking that files contain the Apache license ... '
-    directories = 'lib', 'spec', 'docs', 'bin'
-    ignore = 'class', 'opts'
-    FileList['lib/**/*', 'spec/**/*', 'bin/**', 'doc/css/*', 'doc/scripts/*'].
-      exclude('doc/css/syntax.css').reject { |file| File.directory?(file) || ignore.include?(file[/[^.]*$/]) }.each do |file|
-      comments = File.read(file).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|<!--(.*?)-->/m).
-        map { |match| match.reject(&:nil?) }.flatten.join("\n")
-      fail "File #{file} missing Apache License, please add it before making a release!" unless
-        comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
-    end
-    say 'OK'
-  end
-
-  # No local changes.
-  task 'check' do
-    status = `svn status`
-    fail "Cannot release unless all local changes are in SVN:\n#{status}" unless status.empty?
-  end
-
-  # Re-generate Java extensions and to this before running test cases.
-  task 'compile' do
-    say 'Compiling Java libraries ... '
-    cmd = [ RUBY_PLATFORM =~ /java/ ? 'jruby' : 'ruby' ] <<
-      '-I' << File.join(File.dirname(__FILE__), 'lib') <<
-      File.join(File.dirname(__FILE__), 'bin', 'buildr') <<
-      'compile'
-    system *cmd
-    say 'OK'
-  end
-
-  # Tests, specs and coverage reports.
-  task 'check' do
-    say 'Checking that we have JRuby, Scala and Groovy available ... '
-    fail 'Full testing requires JRuby!' if `which jruby`.empty?
-    fail 'Full testing requires Scala!' if `which scalac`.empty? || ENV['SCALA_HOME'].to_s.empty?
-    fail 'Full testing requires Groovy!' if `which groovyc`.empty?
-    say 'OK'
-  end
-  task 'prepare'=>'compile' do
-    say 'Running test suite using JRuby ...'
-    task('spec:jruby').invoke
-    say 'Running test suite using Ruby ...'
-    task('spec:ruby').invoke
-    say 'Done'
-  end
-
-  # Documentation (derived from above).
-  task 'check' do
-    say 'Checking that we can use Allison and PrinceXML ... '
-    fail 'Release requires the Allison RDoc template, please gem install allison!' unless rdoc.template =~ /allison.rb/
-    fail 'Release requires PrinceXML to generate PDF documentation!' if `which prince`.empty?
-    say 'OK'
-  end
-  task 'prepare'=>'spec:full' do
-    say 'Generating RDocs and PDF ...'
-    task('docs').invoke
-    say 'Done'
-
-    say 'Checking that we have PDF, RDoc, specs and coverage report ... '
-    fail 'No RDocs if html/rdoc!' unless File.exist?('html/rdoc/files/lib/buildr_rb.html')
-    fail 'No PDF generated, you need to install PrinceXML!' unless File.exist?('html/buildr.pdf')
-    fail 'No specifications in html directory!' unless File.exist?('html/specs.html') 
-    fail 'No coverage reports in html/coverage directory!' unless File.exist?('html/coverage/index.html')
-    say 'OK'
-  end
-
-  task 'check' do
-    require 'rubyforge' rescue fail 'RubyForge required, please gem install rubyforge!'
-    fail 'GnuPG required to create signatures!' if `which gpg`.empty?
-    gpg_user = ENV['GPG_USER'] or fail 'Please set GPG_USER (--local-user) environment variable so we know which key to use.'
-    sh('gpg', '--list-key', gpg_user) { |ok, res| ok or fail "No key matches for GPG_USER=#{gpg_user}" }
-  end
-
- 
-  # Cut the release: upload Gem to RubyForge before updating site (fail safe).
-  task 'cut'=>['upload:rubyforge', 'upload:site']
-
-
-  namespace 'upload' do
-    # Upload site (html directory) to Apache.
-    task 'site'=>'rake:docs' do
-      say 'Uploading Web site to people.apache.org ... '
-      args = Dir.glob('html/*') + ['people.apache.org:/www/incubator.apache.org/' + ruby_spec.rubyforge_project.downcase]
-      verbose(false) { sh 'rsync ', '-r', '--del', '--progress', *files }
-      say 'Done'
-    end
-
-    # Upload Gems to RubyForge.
-    task 'rubyforge'=>['rake:docs', 'rake:package'] do
-      require 'rubyforge'
-
-      # Read the changes for this release.
-      say 'Looking for changes between this release and previous one ... '
-      pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
-      changelog = File.read(__FILE__.pathmap('%d/CHANGELOG'))
-      changes = changelog.scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
-      current = changes[ruby_spec.version.to_s]
-      current = changes[ruby_spec.version.to_s.split('.')[0..-2].join('.')] if !current && ruby_spec.version.to_s =~ /\.0$/
-      fail "No changeset found for version #{ruby_spec.version}" unless current
-      say 'OK'
-
-      say "Uploading #{ruby_spec.version} to RubyForge ... "
-      files = Dir.glob('pkg/*.{gem,tgz,zip}')
-      rubyforge = RubyForge.new
-      rubyforge.login    
-      File.open('.changes', 'w'){|f| f.write(current)}
-      rubyforge.userconfig.merge!('release_changes' => '.changes',  'preformatted' => true)
-      rubyforge.add_release ruby_spec.rubyforge_project.downcase, ruby_spec.name.downcase, ruby_spec.version, *files
-      rm '.changes'
-      say 'Done'
-    end
-
-    task 'apache'=>['rake:package'] do
-      require 'md5'
-      require 'sha1'
-
-      gpg_user = ENV['GPG_USER'] or fail 'Please set GPG_USER (--local-user) environment variable so we know which key to use.'
-      say 'Creating -incubating packages ... '
-      rm_rf 'incubating'
-      mkpath 'incubating'
-      packages = FileList['pkg/*.{gem,zip,tgz}'].map do |package|
-        package.pathmap('incubating/%n-incubating%x').tap do |incubating|
-          cp package, incubating
-        end
-      end
-      say 'Done'
-
-      say 'Signing -incubating packages ... '
-      files = packages.each do |package|
-        binary = File.read(package)
-        File.open(package + '.md5', 'w') { |file| file.write MD5.hexdigest(binary) << ' ' << package }
-        File.open(package + '.sha1', 'w') { |file| file.write SHA1.hexdigest(binary) << ' ' << package }
-        sh 'gpg', '--local-user', gpg_user, '--armor', '--output', package + '.asc', '--detach-sig', package, :verbose=>true
-        [package, package + '.md5', package + '.sha1', package + '.asc']
-      end
-      say 'Done'
-
-      say 'Uploading packages to Apache dist ... '
-      args = files.flatten << 'KEYS' << 'people.apache.org:/www.apache.org/dist/incubator/buildr/'
-      verbose(false) { sh 'rsync', '-progress', *args }
-      say 'Done'
-    end
-    Rake::Task['rake:clobber'].enhance { rm_rf 'incubating' }
-
-  end
 
-
-  # Tag this release in SVN.
-  task 'tag' do
-    say "Tagging release as tags/#{ruby_spec.version} ... "
-    cur_url = `svn info`.scan(/URL: (.*)/)[0][0]
-    new_url = cur_url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{ruby_spec.version.to_s}")
-    sh 'svn', 'copy', cur_url, new_url, '-m', "Release #{ruby_spec.version.to_s}", :verbose=>false
-    say "OK"
-  end
-
-  # Update lib/buildr.rb to next vesion number, add new entry in CHANGELOG.
-  task 'next_version'=>'tag' do
-    next_version = ruby_spec.version.to_ints.zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
-    say "Updating lib/buildr.rb to next version number (#{next_version}) ... "
-    buildr_rb = File.read(__FILE__.pathmap('%d/lib/buildr.rb')).
-      sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" } 
-    File.open(__FILE__.pathmap('%d/lib/buildr.rb'), 'w') { |file| file.write buildr_rb }
-    say "OK"
-
-    say 'Adding new entry to CHANGELOG ... '
-    changelog = File.read(__FILE__.pathmap('%d/CHANGELOG'))
-    File.open(__FILE__.pathmap('%d/CHANGELOG'), 'w') { |file| file.write "#{next_version} (Pending)\n\n#{changelog}" }
-    say "OK"
+  task 'make' do
+    task('rubyforge').invoke
+    task('apache:upload').invoke('buildr', true)
   end
 
-  # Wrapup comes after cut, and does things like tagging in SVN, updating Buildr version number, etc.
-  task 'wrapup'=>['tag', 'next_version']
 end
-
-task 'release'=>['release:prepare', 'release:cut', 'release:wrapup']

Modified: incubator/buildr/trunk/doc/css/default.css
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/css/default.css?rev=641713&r1=641712&r2=641713&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/css/default.css (original)
+++ incubator/buildr/trunk/doc/css/default.css Wed Mar 26 23:32:20 2008
@@ -18,7 +18,7 @@
 body {
   background-color: #fff;
   color: #000;
-  font-family: "DejaVu Sans", Verdana, Helvetica, sans-serif;
+  font-family: "DejaVu Sans", Verdana, Helvetica;
   text-align: center;
 	line-height: 1.5em;
 }
@@ -41,9 +41,6 @@
 pre.wrapped {
   white-space: pre-wrap;       /* css-3 */
   white-space: -moz-pre-wrap !important;  /* Mozilla, since 1999 */
-  white-space: -pre-wrap;      /* Opera 4-6 */
-  white-space: -o-pre-wrap;    /* Opera 7 */
-  word-wrap: break-word;
 }
 
 h1, h2, h3 {
@@ -78,7 +75,7 @@
 }
 
 ul { 
-  list-style-ty pe: disc;
+  list-style-type: disc;
 }
 
 ul ul {

Modified: incubator/buildr/trunk/doc/css/print.css
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/css/print.css?rev=641713&r1=641712&r2=641713&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/css/print.css (original)
+++ incubator/buildr/trunk/doc/css/print.css Wed Mar 26 23:32:20 2008
@@ -16,6 +16,9 @@
 
 
 @page { margin: 1in 0.75in 1in 0.75in; }
+@page {
+  font-family: "DejaVu Sans", Verdana, Helvetica;
+}
 @page:left {
   @top-left { content: counter(page); }
   @top-right { content: string(pagetitle); }
@@ -54,7 +57,7 @@
 }
 a:link, a:visited {
   background: transparent;
-  text-decoration: underline;
+  text-decoration: none;
 }
 
 
@@ -89,6 +92,4 @@
 
 #license {
   padding-top: 1in;
-  page-break-before: none !important;
-  page-break-inside: always !important;
 }

Modified: incubator/buildr/trunk/doc/css/syntax.css
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/css/syntax.css?rev=641713&r1=641712&r2=641713&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/css/syntax.css (original)
+++ incubator/buildr/trunk/doc/css/syntax.css Wed Mar 26 23:32:20 2008
@@ -3,7 +3,7 @@
  */
 
 .ruby .normal   {}
-.ruby .comment  { color: #005; font-style: italic; }
+.ruby .comment  { color: #7f7f7f; }
 .ruby .keyword  { color: #A00; font-weight: bold; }
 .ruby .method   { color: #077; }
 .ruby .class    { color: #074; }
@@ -23,8 +23,8 @@
 
 .xml .normal    {}
 .xml .namespace { color: #B66; font-weight: bold; }
-.xml .tag       { color: #F88; }
-.xml .comment   { color: #005; font-style: italic; }
+.xml .tag       { color: #4c00ff; }
+.xml .comment   { color: #7f7f7f; }
 .xml .punct     { color: #447; font-weight: bold; }
 .xml .string    { color: #944; }
 .xml .number    { color: #F99; }
@@ -32,8 +32,8 @@
 
 .yaml .document { }
 .yaml .type     { }
-.yaml .key      { color: #00c0c0 }
-.yaml .comment  { color: #808080 }
+.yaml .key      { color: #4c00ff}
+.yaml .comment  { color: #7f7f7f; }
 .yaml .punct    { }
 .yaml .string   { }
 .yaml .number   { }

Modified: incubator/buildr/trunk/doc/web.haml
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/doc/web.haml?rev=641713&r1=641712&r2=641713&view=diff
==============================================================================
--- incubator/buildr/trunk/doc/web.haml (original)
+++ incubator/buildr/trunk/doc/web.haml Wed Mar 26 23:32:20 2008
@@ -18,8 +18,9 @@
   %head
     %meta{ 'http-equiv'=>'Content-Type', :content=>'text/html;charset=UTF-8' }/
     %title= "#{collection.title} &mdash; #{page.title}"
-    %link{ :rel=>'stylesheet', :type=>'text/css', :href=>'css/default.css' }
-    %link{ :rel=>'stylesheet', :type=>'text/css', :href=>'css/syntax.css' }
+    %style{ :type=>'text/css' }
+      @import 'css/default.css';
+      @import 'css/syntax.css';
     %style{ :type=>'text/css', :media=>'print' }
       @import 'css/print.css';
       \#header { display: none } 

Added: incubator/buildr/trunk/rakelib/apache.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/apache.rake?rev=641713&view=auto
==============================================================================
--- incubator/buildr/trunk/rakelib/apache.rake (added)
+++ incubator/buildr/trunk/rakelib/apache.rake Wed Mar 26 23:32:20 2008
@@ -0,0 +1,90 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership.  The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+
+require 'md5'
+require 'sha1'
+
+
+# Tasks specific to Apache projects (license, release, etc).
+namespace 'apache' do
+
+  desc 'Check that source files contain the Apache license'
+  task 'license' do
+    say 'Checking that files contain the Apache license ... '
+    excluded = ['.class', '.png', '.jar', '.tif', 'README', 'LICENSE', 'CHANGELOG', 'DISCLAIMER', 'NOTICE', 'KEYS']
+    required = FileList[$spec.files].exclude(*excluded).exclude(*Array($license_excluded)).select { |fn| File.file?(fn) }
+    required.each do |fn| 
+      comments = File.read(fn).scan(/(\/\*(.*?)\*\/)|^#\s+(.*?)$|<!--(.*?)-->/m).
+        map { |match| match.compact }.flatten.join("\n")
+      fail "File #{fn} missing Apache License, please add it before making a release!" unless
+        comments =~ /Licensed to the Apache Software Foundation/ && comments =~ /http:\/\/www.apache.org\/licenses\/LICENSE-2.0/
+    end
+    say 'OK'
+  end
+
+  file 'incubating'=>'package' do
+    rm_rf 'incubating'
+    mkpath 'incubating'
+    say 'Creating -incubating packages ... '
+    packages = FileList['pkg/*.{gem,zip,tgz}'].map do |package|
+      package.pathmap('incubating/%n-incubating%x').tap do |incubating|
+        cp package, incubating
+      end
+    end
+    say 'Done'
+  end
+
+  task 'sign', :incubating do |task, args|
+    file('incubating').invoke if args.incubating
+    sources = FileList[args.incubating ? 'incubating/*' : 'pkg/*']
+
+    gpg_user = ENV['GPG_USER'] or fail 'Please set GPG_USER (--local-user) environment variable so we know which key to use.'
+    say 'Signing release files ...'
+    sources.each do |fn|
+      contents = File.open(fn, 'rb') { |file| file.read }
+      File.open(fn + '.md5', 'w') { |file| file.write MD5.hexdigest(contents) << ' ' << File.basename(fn) }
+      File.open(fn + '.sha1', 'w') { |file| file.write SHA1.hexdigest(contents) << ' ' << File.basename(fn) }
+      sh 'gpg', '--local-user', gpg_user, '--armor', '--output', fn + '.asc', '--detach-sig', fn, :verbose=>true
+    end
+    say 'Done'
+  end
+
+  task 'upload', :project, :incubating, :depends=>['site', 'KEYS', 'sign'] do |task, args|
+    fail 'No project specified' unless project
+
+    target = 'people.apache.org:/www.apache.org/dist/'
+    target << 'incubator/' if args.incubating
+    target << "#{project}/"
+
+    dir = task('sign').prerequisite.find { |prereq| File.directory?(prereq.name) }
+    fail 'Please enhance sign task with directory containing files to release' unless dir
+    say 'Uploading packages to Apache dist ...'
+    args = FileList["#{dir}/*", 'KEYS'].flatten << target
+    
+    sh 'rsync', '-progress', *args
+    say 'Done'
+  end
+
+end
+
+
+task 'clobber' do
+  rm_rf 'incubating'
+end
+
+namespace 'release' do
+  task 'check'=>'apache:license'
+end

Added: incubator/buildr/trunk/rakelib/doc.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/doc.rake?rev=641713&view=auto
==============================================================================
--- incubator/buildr/trunk/rakelib/doc.rake (added)
+++ incubator/buildr/trunk/rakelib/doc.rake Wed Mar 26 23:32:20 2008
@@ -0,0 +1,120 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership.  The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+
+require 'rake/rdoctask'
+
+desc 'Generate RDoc documentation'
+rdoc = Rake::RDocTask.new('rdoc') do |rdoc|
+  rdoc.rdoc_dir = 'rdoc'
+  rdoc.title    = $spec.name
+  rdoc.options  = $spec.rdoc_options + ['--promiscuous']
+  rdoc.rdoc_files.include('lib/**/*.rb')
+  rdoc.rdoc_files.include $spec.extra_rdoc_files
+end
+
+
+begin
+  gem 'allison'
+  rdoc.template = File.expand_path('lib/allison.rb', Gem.loaded_specs['allison'].full_gem_path)
+rescue LoadError
+  say 'Please run rake setup to install the Allison RDoc template'
+  task 'setup' do
+    ruby 'install', 'allison', :command=>'gem', :sudo=>true
+  end
+  task 'release:check' do
+    fail 'Please run rake setup to install the Allison RDoc template'
+  end
+end
+
+
+begin
+  require 'docter'
+  require 'docter/server'
+
+  web_docs = {
+    :collection => Docter.collection($spec.name).using('doc/web.toc.yaml').
+      include('doc/pages', 'LICENSE', 'CHANGELOG'),
+    :template   => Docter.template('doc/web.haml').
+      include('doc/css', 'doc/images', 'doc/scripts', 'reports/specs.html', 'reports/coverage', 'rdoc')
+  }
+  print_docs = {
+    :collection => Docter.collection($spec.name).using('doc/print.toc.yaml').
+      include('doc/pages', 'LICENSE'),
+    :template   => Docter.template('doc/print.haml').include('doc/css', 'doc/images')
+  }
+
+  #Docter.filter_for(:footnote) do |html|
+  #  html.gsub(/<p id="fn(\d+)">(.*?)<\/p>/, %{<p id="fn\\1" class="footnote">\\2</p>})
+  #end
+
+  desc 'Run Docter server on port 3000'
+  Docter::Rake.serve 'docter', web_docs[:collection], web_docs[:template], :port=>3000
+
+  desc 'Generate HTML documentation'
+  Docter::Rake.generate('site', web_docs[:collection], web_docs[:template])
+  task 'site'=>'reports'
+
+  task 'clobber' do
+    rm_rf 'site'
+  end
+
+rescue LoadError
+  say 'Please run rake setup to install the Docter document generation library'
+  task 'setup' do
+    ruby 'install', 'docter', :command=>'gem', :sudo=>true
+  end
+  task 'release:check' do
+    fail 'Please run rake setup to install the Docter document generation library'
+  end
+end
+
+
+if `prince --version` && $?.exitstatus == 0
+
+  Docter::Rake.generate('print', print_docs[:collection], print_docs[:template], :one_page)
+  file('site/buildr.pdf'=>'print') do |task|
+    mkpath 'site'
+    sh 'prince', 'print/index.html', '-o', task.name, '--media=print' do |ok, res|
+      fail 'Failed to create PDF, see errors above' unless ok
+    end
+  end
+
+  desc 'Produce PDF'
+  task 'pdf'=>'site/buildr.pdf' do |task|
+    sh 'open', 'site/buildr.pdf'
+  end
+
+  task 'docs'=>'site/buildr.pdf'
+  task 'clobber' do
+    rm_rf 'print'
+  end
+
+else
+  task 'release:check' do
+    fail 'Release requires PrinceXML to generate PDF documentation!'
+  end
+end
+
+
+namespace 'release' do
+  task 'prepare'=>'docs' do
+    say 'Checking that we have site documentation, RDoc and PDF ... '
+    fail 'No PDF generated, you need to install PrinceXML!' unless File.exist?('site/buildr.pdf')
+    fail 'No RDocs in site directory' unless File.exist?('site/rdoc/files/lib/buildr_rb.html')
+    fail 'No site documentation in site directory' unless File.exist?('site/index.html')
+    say 'OK'
+  end
+end

Added: incubator/buildr/trunk/rakelib/package.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/package.rake?rev=641713&view=auto
==============================================================================
--- incubator/buildr/trunk/rakelib/package.rake (added)
+++ incubator/buildr/trunk/rakelib/package.rake Wed Mar 26 23:32:20 2008
@@ -0,0 +1,47 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership.  The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+
+require 'rake/gempackagetask'
+require 'yaml'
+
+desc 'Compile Java libraries used by Buildr'
+task 'compile' do
+  say 'Compiling Java libraries ... '
+  ruby '-Ilib', 'bin/buildr', 'compile'
+  say 'OK'
+end
+
+Rake::GemPackageTask.new($specs['ruby']) do |pkg|
+  pkg.need_tar = pkg.need_zip = true
+  file pkg.package_dir_path=>'compile'
+  file pkg.package_dir=>'compile'
+end
+Rake::GemPackageTask.new($specs['java']) do |pkg|
+  file pkg.package_dir_path=>'compile'
+end
+
+current = Rake::GemPackageTask.new($spec)
+desc 'Install the package locally'
+task 'install'=>['clobber', "#{current.package_dir}/#{current.gem_file}"] do |task|
+  ruby 'install',  "#{current.package_dir}/#{current.gem_file}", :command=>'gem', :sudo=>true
+end
+
+desc 'Uninstall previously installed packaged'
+task 'uninstall' do |task|
+  say "Uninstalling #{$spec.name} ... "
+  ruby 'install', $spec.name, :command=>'gem', :sudo=>true
+  say 'Done'
+end

Added: incubator/buildr/trunk/rakelib/release.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/release.rb?rev=641713&view=auto
==============================================================================
--- incubator/buildr/trunk/rakelib/release.rb (added)
+++ incubator/buildr/trunk/rakelib/release.rb Wed Mar 26 23:32:20 2008
@@ -0,0 +1,111 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership.  The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+
+begin
+  require 'rubyforge'
+rescue LoadError
+  say 'Please run rake setup to install the RubyForge gem'
+  task 'setup' do
+    ruby 'install', 'rubyforge', :command=>'gem', :sudo=>true
+  end
+  task 'release:check' do
+    fail 'Please run rake setup to install the RubyForge gem'
+  end
+end
+
+
+namespace 'release' do
+ 
+  # This task does all prerequisites checks before starting the release, for example,
+  # that we have Groovy and Scala to run all the test cases, or that we have Allison
+  # and PrinceXML to generate the full documentation.
+  task 'check'=>'setup'
+  # This task does all the preparation work before making a release and also checks
+  # that we generate all the right material, for example, that we compiled Java sources,
+  # created the PDF, have coverage report.
+  task 'prepare'=>['clobber', 'check']
+
+  # Does CHANGELOG reflects current release?
+  task 'check' do
+    say 'Checking that CHANGELOG indicates most recent version and today\'s date ... '
+    expecting = "#{ruby_spec.version} (#{Time.now.strftime('%Y-%m-%d')})"
+    header = File.readlines('CHANGELOG').first
+    fail "Expecting CHANGELOG to start with #{expecting}, but found #{header} instead" unless expecting == header
+    say 'OK'
+  end
+
+  # No local changes.
+  task 'check' do
+    status = `svn status`
+    fail "Cannot release unless all local changes are in SVN:\n#{status}" unless status.empty?
+  end
+
+  desc 'Make a release'
+  task 'make'=>'prepare' do
+    enhance do
+      task('release:wrapup').invoke
+    end
+  end
+
+  task 'rubyforge'=>'pacakge' do
+    # Read the changes for this release.
+    say 'Looking for changes between this release and previous one ... '
+    pattern = /(^(\d+\.\d+(?:\.\d+)?)\s+\(\d{4}-\d{2}-\d{2}\)\s*((:?^[^\n]+\n)*))/
+    changelog = File.read(__FILE__.pathmap('%d/CHANGELOG'))
+    changes = changelog.scan(pattern).inject({}) { |hash, set| hash[set[1]] = set[2] ; hash }
+    current = changes[$spec.version.to_s]
+    current = changes[$spec.version.to_s.split('.')[0..-2].join('.')] if !current && $spec.version.to_s =~ /\.0$/
+    fail "No changeset found for version #{$spec.version}" unless current
+    say 'OK'
+
+    say "Uploading #{$spec.version} to RubyForge ... "
+    files = Dir.glob('pkg/*.{gem,tgz,zip}')
+    rubyforge = RubyForge.new
+    rubyforge.login    
+    File.open('.changes', 'w'){|f| f.write(current)}
+    rubyforge.userconfig.merge!('release_changes' => '.changes',  'preformatted' => true)
+    rubyforge.add_release $spec.rubyforge_project.downcase, $spec.name.downcase, $spec.version, *files
+    rm '.changes'
+    say 'Done'
+  end
+
+  # Tag this release in SVN.
+  task 'tag' do
+    say "Tagging release as tags/#{ruby_spec.version} ... "
+    cur_url = `svn info`.scan(/URL: (.*)/)[0][0]
+    new_url = cur_url.sub(/(trunk$)|(branches\/\w*)$/, "tags/#{ruby_spec.version.to_s}")
+    sh 'svn', 'copy', cur_url, new_url, '-m', "Release #{ruby_spec.version.to_s}", :verbose=>false
+    say "OK"
+  end
+
+  # Update lib/buildr.rb to next vesion number, add new entry in CHANGELOG.
+  task 'next_version'=>'tag' do
+    next_version = ruby_spec.version.to_ints.zip([0, 0, 1]).map { |a| a.inject(0) { |t,i| t + i } }.join('.')
+    say "Updating lib/buildr.rb to next version number (#{next_version}) ... "
+    buildr_rb = File.read(__FILE__.pathmap('%d/lib/buildr.rb')).
+      sub(/(VERSION\s*=\s*)(['"])(.*)\2/) { |line| "#{$1}#{$2}#{next_version}#{$2}" } 
+    File.open(__FILE__.pathmap('%d/lib/buildr.rb'), 'w') { |file| file.write buildr_rb }
+    say "OK"
+
+    say 'Adding new entry to CHANGELOG ... '
+    changelog = File.read(__FILE__.pathmap('%d/CHANGELOG'))
+    File.open(__FILE__.pathmap('%d/CHANGELOG'), 'w') { |file| file.write "#{next_version} (Pending)\n\n#{changelog}" }
+    say "OK"
+  end
+
+  task 'wrapup'=>['tag', 'next_version']
+
+end

Added: incubator/buildr/trunk/rakelib/rspec.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/rakelib/rspec.rake?rev=641713&view=auto
==============================================================================
--- incubator/buildr/trunk/rakelib/rspec.rake (added)
+++ incubator/buildr/trunk/rakelib/rspec.rake Wed Mar 26 23:32:20 2008
@@ -0,0 +1,91 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with this
+# work for additional information regarding copyright ownership.  The ASF
+# licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations under
+# the License.
+
+
+begin
+  require 'spec/rake/spectask'
+
+  desc 'Run all specs'
+  Spec::Rake::SpecTask.new('spec') do |task|
+    task.spec_files = FileList['spec/**/*_spec.rb']
+    task.spec_opts << '--options' << 'spec/spec.opts' << '--format' << 'failing_examples:failing'
+  end
+
+  desc 'Run all failing examples from previous run'
+  Spec::Rake::SpecTask.new('failing') do |task|
+    task.spec_files = FileList['spec/**/*_spec.rb']
+    task.spec_opts << '--options' << 'spec/spec.opts' << '--format' << 'failing_examples:failing' << '--example' << 'failing'
+  end
+
+  directory 'reports'
+  desc 'Run RSpec and generate Spec and coverage reports (slow)'
+  Spec::Rake::SpecTask.new('reports') do |task|
+    task.spec_files = FileList['spec/**/*_spec.rb']
+    task.spec_opts << '--format' << 'html:reports/specs.html' << '--backtrace'
+    task.rcov = true
+    task.rcov_dir = 'reports/coverage'
+    task.rcov_opts = ['--exclude', 'spec,bin']
+  end
+
+  task 'clobber' do
+    rm 'failing' rescue nil
+    rm_rf 'reports'
+  end
+
+rescue LoadError
+  say 'Please run rake setup to install RSpec'
+  task 'setup' do
+    ruby 'install', 'rspec', :command=>'gem', :sudo=>true
+  end
+  task 'release:check' do
+    fail 'Please run rake setup to install RSpec'
+  end
+end
+
+
+# Useful for testing with JRuby when using Ruby and vice versa.
+namespace 'spec' do
+  desc 'Run all specs specifically with Ruby'
+  task 'ruby' do
+    say 'Running test suite using Ruby ...'
+    system 'ruby -S rake spec'
+  end
+
+  desc 'Run all specs specifically with JRuby'
+  task 'jruby' do
+    say 'Running test suite using JRuby ...'
+    system 'jruby -S rake spec'
+  end
+end
+
+namespace 'release' do
+  # Full test suite depends on having JRuby, Scala and Groovy installed.
+  task 'check' do
+    say 'Checking that we have JRuby, Scala and Groovy available ... '
+    fail 'Full testing requires JRuby!' unless `jruby --version` && $?.exitstatus == 0
+    fail 'Full testing requires Scala!' unless `scala --version` && $?.exitstatus == 0
+    fail 'Full testing requires Groovy!' unless `groovy --version` && $?.exitstatus == 0
+    say 'OK'
+  end
+
+  # Release requires RSpec and test coverage reports, uploaded as part of site.
+  # Primary test environment is Ruby (RCov), also test on JRuby.
+  task 'prepare'=>['compile', 'reports', 'spec:jruby'] do
+    say 'Checking that we have specs and coverage report ... '
+    fail 'No specifications in site directory!' unless File.exist?('site/specs.html') 
+    fail 'No coverage reports in site directory!' unless File.exist?('site/coverage/index.html')
+    say 'OK'
+  end
+end