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/25 22:15:20 UTC

svn commit: r640988 - in /incubator/buildr/docter/trunk: ./ lib/ lib/docter/ rakelib/

Author: assaf
Date: Tue Mar 25 14:15:17 2008
New Revision: 640988

URL: http://svn.apache.org/viewvc?rev=640988&view=rev
Log:
Now using Syntax by default for syntax highlighting, which works equally well on JRuby.
Removed dependency on Facets.


Added:
    incubator/buildr/docter/trunk/DISCLAIMER
    incubator/buildr/docter/trunk/NOTICE
    incubator/buildr/docter/trunk/rakelib/
    incubator/buildr/docter/trunk/rakelib/apache.rake
    incubator/buildr/docter/trunk/rakelib/release.rake
Modified:
    incubator/buildr/docter/trunk/CHANGELOG
    incubator/buildr/docter/trunk/Rakefile
    incubator/buildr/docter/trunk/lib/docter.rb
    incubator/buildr/docter/trunk/lib/docter/collection.rb
    incubator/buildr/docter/trunk/lib/docter/common.rb
    incubator/buildr/docter/trunk/lib/docter/page.rb
    incubator/buildr/docter/trunk/lib/docter/rake.rb
    incubator/buildr/docter/trunk/lib/docter/server.rb
    incubator/buildr/docter/trunk/lib/docter/template.rb
    incubator/buildr/docter/trunk/lib/docter/ultraviolet.rb

Modified: incubator/buildr/docter/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/CHANGELOG?rev=640988&r1=640987&r2=640988&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/CHANGELOG (original)
+++ incubator/buildr/docter/trunk/CHANGELOG Tue Mar 25 14:15:17 2008
@@ -1,9 +1,17 @@
+1.1.3 (Pending)
+* Changed: Now using Syntax by default for syntax highlighting, which works
+equally well on JRuby.
+* Changed: Fixed copying of resources with nested directories.
+* Removed: Dependency on Facets.
+
 1.1.2 (2007-01-25)
 * Changed: list_links now limits itself so HTTP URLs (no mailto:, FTP).
 * Changed: Upgraded to HAML 1.8.
-* Fixed:   list_links returns URLs in alphabetical order (of title) capitializing first letter of title.
+* Fixed:   list_links returns URLs in alphabetical order (of title)
+capitializing first letter of title.
 * Fixed:   list_links no longer returns URLs that have no title.
-* Fixed:   Generated IDs for headers conform to HTML spec (i.e. a-z, 0-9, hyphen, underscore, colon and period).
+* Fixed:   Generated IDs for headers conform to HTML spec (i.e. a-z, 0-9,
+hyphen, underscore, colon and period).
 * Fixed:   Empty ToC no longer included in HTML.
 
 1.1.1 (2007-01-03)
@@ -11,12 +19,17 @@
 
 1.1.0 (2007-01-03)
 * Changed: Now using YAML for nested ToC.
-* Fixed: Sleek upload with changelog for each release courtesy of Anatol Pomozov.
+* Fixed: Sleek upload with changelog for each release courtesy of Anatol
+Pomozov.
 
 1.0.1 (2007-06-06)
-* Added: renumber_footnotes to template for handling footnote numbering when creating a single page. 
-* Changed: Ultraviolet no longer used as default syntax highlighting, must require separately.
-* Changed: footnote_links is now list_links and the new method eliminates duplicates (based on URL), sorts alphabetically (the text component) and capitalizes the text description.
+* Added: renumber_footnotes to template for handling footnote numbering when
+creating a single page.
+* Changed: Ultraviolet no longer used as default syntax highlighting, must
+require separately.
+* Changed: footnote_links is now list_links and the new method eliminates
+duplicates (based on URL), sorts alphabetically (the text component) and
+capitalizes the text description.
 
 1.0.0 (2007-06-03)
 * First release of working code.

Added: incubator/buildr/docter/trunk/DISCLAIMER
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/DISCLAIMER?rev=640988&view=auto
==============================================================================
--- incubator/buildr/docter/trunk/DISCLAIMER (added)
+++ incubator/buildr/docter/trunk/DISCLAIMER Tue Mar 25 14:15:17 2008
@@ -0,0 +1,7 @@
+Apache Buildr is an effort undergoing incubation at The Apache Software
+Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of
+all newly accepted projects until a further review indicates that the
+infrastructure, communications, and decision making process have stabilized in
+a manner consistent with other successful ASF projects. While incubation status
+is not necessarily a reflection of the completeness or stability of the code,
+it does indicate that the project has yet to be fully endorsed by the ASF.

Added: incubator/buildr/docter/trunk/NOTICE
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/NOTICE?rev=640988&view=auto
==============================================================================
--- incubator/buildr/docter/trunk/NOTICE (added)
+++ incubator/buildr/docter/trunk/NOTICE Tue Mar 25 14:15:17 2008
@@ -0,0 +1,43 @@
+=========================================================================
+==  NOTICE file for use with the Apache License, Version 2.0,          ==
+==  in this case for the Apache Buildr distribution.                   ==
+=========================================================================
+
+Apache Docter (part of Apache Buildr)
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+COPYRIGHT NOTICES
+-----------------
+Copyright 2007 Intalio
+
+This product includes software developed by Intalio
+http://www.intalio.com
+
+
+THIRD-PARTY DEPENDENCIES
+------------------------
+Even though those dependencies aren't shipped with Docter, Docter needs 
+the third-party libraries listed below to run. According licenses are 
+bundled under the etc/legal directory (when available).
+
+* HAML - http://haml.hamptoncatlin.com/
+Licensed under MIT
+Copyright (c) 2006-2007 Hampton Catlin
+
+* highline - http://rubyforge.org/projects/highline
+Licensed under the Ruby License
+Copyright 2005 Gray Productions
+Copyright 2007 Jeremy Hinegardner
+
+* Rake - http://rubyforge.org/projects/rake 
+Licensed under MIT/X Consortium
+Copyright 2003, 2004 by Jim Weirich
+
+* RedCloth - http://whytheluckystiff.net/ruby/redcloth/ 
+Licensed under BSD
+Copyright 2004 why the lucky stiff (and his puppet organizations.)
+
+* Syntax -- http://syntax.rubyforge.org/
+Licensed under BSD
+Copyright 2005 Jamis Buck

Modified: incubator/buildr/docter/trunk/Rakefile
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/Rakefile?rev=640988&r1=640987&r2=640988&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/Rakefile (original)
+++ incubator/buildr/docter/trunk/Rakefile Tue Mar 25 14:15:17 2008
@@ -1,10 +1,25 @@
+# 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 'rubygems'
-Gem::manage_gems
 require 'rake/gempackagetask'
 require 'rake/rdoctask'
 require 'rubyforge'
 
-
+#
 # Gem specification comes first, other tasks rely on it.
 spec = Gem::Specification.new do |spec|
   spec.name         = 'docter'
@@ -13,38 +28,74 @@
   spec.email        = 'buildr-user@incubator.apache.org'
   spec.homepage     = 'http://incubator.apache.org/buildr/'
   spec.summary      = 'We has docs'
-  spec.files        = FileList['lib/**/*', 'CHANGELOG', 'README', 'LICENSE', 'Rakefile', 'html/**/*'].collect
+  spec.files        = FileList['lib/**/*', 'README', 'CHANGELOG', 'LICENSE', 'NOTICE', 'DISCLAIMER',
+                               'Rakefile'].collect
   spec.require_path = 'lib'
   spec.has_rdoc     = true
-  spec.extra_rdoc_files = ['README', 'CHANGELOG', 'LICENSE']
+  spec.extra_rdoc_files = ['README', 'CHANGELOG', 'LICENSE', 'NOTICE', 'DISCLAIMER']
   spec.rdoc_options << '--title' << "Docter -- #{spec.summary}" <<
                        '--main' << 'README' << '--line-numbers' << '--inline-source' << '-p' <<
                        '--webcvs' << 'http://svn.apache.org/repos/asf/incubator/buildr/docter/trunk/'
   spec.rubyforge_project = 'buildr'
 
   # Tested against these dependencies.
-  spec.add_dependency 'facets',      '~> 2.2'
   spec.add_dependency 'RedCloth',    '~> 3.0'
   spec.add_dependency 'haml',        '~> 1.8'
   spec.add_dependency 'mongrel',     '~> 1.1'
-  spec.add_dependency 'ultraviolet', '~> 0.10'
+  spec.add_dependency 'syntax',      '~> 1.0'
+end
+
+
+def ruby(*args)
+  options = Hash === args.last ? args.pop : {}
+  options[:verbose] ||= false
+  cmd = []
+  cmd << 'sudo' if options.delete(:sudo) && !Gem.win_platform?
+  cmd << Config::CONFIG['ruby_install_name']
+  cmd << '-S' << options.delete(:command) if options[:command]
+  sh *cmd.push(*args.flatten).push(options)
+end
+
+# 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('ultraviolet', '~>0.10') unless RUBY_PLATFORM =~ /java/
+  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
+end
+
+begin
+  require 'highline/import'
+rescue LoadError 
+  fail 'HighLine required, please run rake setup first'
 end
 
 
 # Packaging and local installation.
-Rake::GemPackageTask.new(spec) do |pkg|
+pkg = Rake::GemPackageTask.new(spec) do |pkg|
   pkg.need_tar = true
   pkg.need_zip = true
 end
 
 desc 'Install the package locally'
 task :install=>:package do |task|
+  say "Installing #{spec.file_name} ... "
   system 'gem', 'install', "pkg/#{spec.name}-#{spec.version}.gem"
+  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|
-  system 'gem', 'uninstall', spec.name, '-v', spec.version.to_s
+  say "Uninstalling #{spec.name} ... "
+  ruby 'uninstall', spec.name, :command=>'gem', :sudo=>true
+  say 'Done'
 end
 
 
@@ -60,44 +111,9 @@
 task('clobber') { rm_rf [rdoc.rdoc_dir.to_s] }
 
 
-# Commit to SVN, upload and do the release cycle.
-namespace :svn do
-  task :clean? do |task|
-    status = `svn status`.reject { |line| line =~ /\s(pkg|html)$/ }
-    fail "Cannot release unless all local changes are in SVN:\n#{status}" unless status.empty?
-  end
-  
-  task :tag do |task|
-    cur_url = `svn info`.scan(/URL: (.*)/)[0][0]
-    new_url = cur_url.sub(/trunk$/, "tags/#{spec.version.to_s}")
-    system 'svn', 'remove', new_url, '-m', 'Removing old copy' rescue nil
-    system 'svn', 'copy', cur_url, new_url, '-m', "Release #{spec.version.to_s}"
-  end
-end
-
-namespace :upload do
-  task :packages=>['rake:package'] do |task|
-    # Read the changes for this release.
-    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]
-    if !current && spec.version.to_s =~ /\.0$/
-      current = changes[spec.version.to_s.split('.')[0..-2].join('.')] 
-    end
-    fail "No changeset found for version #{spec.version}" unless current
+namespace 'release' do
+ 
+  # License requirement.
+  task 'check'=>'apache:license'
 
-    puts "Uploading #{spec.name} #{spec.version}"
-    files = %w( gem tgz zip ).map { |ext| "pkg/#{spec.name}-#{spec.version}.#{ext}" }
-    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'
-    puts "Release #{spec.version} uploaded"
-  end
 end
-
-desc 'Upload release to RubyForge including docs, tag SVN'
-task :release=>[ 'clobber', 'svn:clean?', 'upload:packages' ]

Modified: incubator/buildr/docter/trunk/lib/docter.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/lib/docter.rb?rev=640988&r1=640987&r2=640988&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/lib/docter.rb (original)
+++ incubator/buildr/docter/trunk/lib/docter.rb Tue Mar 25 14:15:17 2008
@@ -1,28 +1,43 @@
-# &:symbol goodness.
-require 'facets/symbol/to_proc'
-require 'facets/string/blank'
-require 'facets/kernel/tap'
-require 'facets/kernel/__DIR__'
+# 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.
+
 
 module Docter
-  VERSION = '1.1.2'.freeze
+  VERSION = '1.1.3'.freeze
 end
 
-$LOAD_PATH.unshift __DIR__
+#$LOAD_PATH.unshift __DIR__
+
+# Ruby 1.9 conveniences.
+module Kernel #:nodoc:
+  def tap
+    yield self if block_given?
+    self
+  end unless method_defined?('tap')
+end
 
-require 'cgi'
-require 'erb'
-# All these Gems are optional.
-['redcloth', 'haml', 'mongrel', 'uv'].each do |gem|
-  begin
-    require gem
-  rescue LoadError
-  end
+class Symbol #:nodoc:
+  def to_proc
+    Proc.new{|*args| args.shift.__send__(self, *args)}
+  end unless method_defined?('to_proc')
 end
 
 require 'docter/common.rb'
 require 'docter/page.rb'
 require 'docter/template.rb'
 require 'docter/collection.rb'
-require 'docter/server.rb' if defined?(Mongrel)
+require 'docter/server.rb'
 require 'docter/rake.rb' if defined?(Rake)
+require 'docter/ultraviolet.rb' if defined?(Uv)

Modified: incubator/buildr/docter/trunk/lib/docter/collection.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/lib/docter/collection.rb?rev=640988&r1=640987&r2=640988&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/lib/docter/collection.rb (original)
+++ incubator/buildr/docter/trunk/lib/docter/collection.rb Tue Mar 25 14:15:17 2008
@@ -1,3 +1,22 @@
+# 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 'redcloth'
+
+
 module Docter
 
   class Collection
@@ -30,21 +49,14 @@
         @toc = ToC.from_yaml(yaml, @collection)
       end
 
-      if defined?(::RedCloth)
-        def create_from_textile(text, options)
-          html = RedCloth.new(erb_this(text, binding), [:no_span_caps]).to_html(:textile)
-          create_from_html html, options
-        end
-
-        def create_from_markup(text, options)
-          html = RedCloth.new(erb_this(text, binding), [:no_span_caps]).to_html(:markup)
-          create_from_html html, options
-        end
-      else
-        def create_from_textile(text, options)
-          fail "You need to install RedCloth first:\n  gem install RedCloth"
-        end
-        alias :create_from_markup :create_from_textile
+      def create_from_textile(text, options)
+        html = RedCloth.new(erb_this(text, binding), [:no_span_caps]).to_html(:textile)
+        create_from_html html, options
+      end
+
+      def create_from_markup(text, options)
+        html = RedCloth.new(erb_this(text, binding), [:no_span_caps]).to_html(:markup)
+        create_from_html html, options
       end
 
       def create_from_html(html, options)

Modified: incubator/buildr/docter/trunk/lib/docter/common.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/lib/docter/common.rb?rev=640988&r1=640987&r2=640988&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/lib/docter/common.rb (original)
+++ incubator/buildr/docter/trunk/lib/docter/common.rb Tue Mar 25 14:15:17 2008
@@ -1,3 +1,22 @@
+# 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 'erb'
+
+
 module Docter
 
   module HTML

Modified: incubator/buildr/docter/trunk/lib/docter/page.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/lib/docter/page.rb?rev=640988&r1=640987&r2=640988&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/lib/docter/page.rb (original)
+++ incubator/buildr/docter/trunk/lib/docter/page.rb Tue Mar 25 14:15:17 2008
@@ -1,3 +1,24 @@
+# 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 'cgi'
+require 'redcloth'
+require 'syntax/convertors/html'
+
+
 module Docter
 
   # A single documentation page. Has title, content and ToC.
@@ -155,26 +176,20 @@
 
   private
 
-    if defined?(::RedCloth)
-      # :call-seq:
-      #   use_redcloth(format, text, options)
-      #
-      # Format may be :textile or :markdown. Runs erb_this on the text first to apply ERB code,
-      # processes code sections ({{{ ... }}}), and converts the Textile/Markdown text to HTML.
-      def use_redcloth(format, text, options)
-        text = erb_this(text)
-        # Process {{{ ... }}} code sections into pre tags.
-        text = text.gsub(/^\{\{\{([^\n]*)\n(.*?)\n\}\}\}/m) do
-          code, spec = $2, $1.scan(/^!(.*?)$/).to_s.strip
-          %{<notextile><pre class='#{spec.split(',').join(' ')}'>#{CGI.escapeHTML(code)}</pre></notextile>}
-        end
-        # Create the HTML.
-        RedCloth.new(text, [:no_span_caps]).to_html(format)
-      end
-    else
-      def use_redcloth(format, text, options)
-        fail "You need to install RedCloth first:\n  gem install RedCloth"
+    # :call-seq:
+    #   use_redcloth(format, text, options)
+    #
+    # Format may be :textile or :markdown. Runs erb_this on the text first to apply ERB code,
+    # processes code sections ({{{ ... }}}), and converts the Textile/Markdown text to HTML.
+    def use_redcloth(format, text, options)
+      text = erb_this(text)
+      # Process {{{ ... }}} code sections into pre tags.
+      text = text.gsub(/^\{\{\{([^\n]*)\n(.*?)\n\}\}\}/m) do
+        code, spec = $2, $1.scan(/^!(.*?)$/).to_s.strip
+        %{<notextile><pre class='#{spec.split(',').join(' ')}'>#{CGI.escapeHTML(code)}</pre></notextile>}
       end
+      # Create the HTML.
+      RedCloth.new(text, [:no_span_caps]).to_html(format)
     end
 
     # :call-seq:
@@ -202,7 +217,7 @@
         tag, attributes, text = $1.downcase, $2.to_s, inner_text_from($3)
         # Make sure all H2/H3 headers have a usable ID, create once if necessary.
         id = CGI.unescape($3) if attributes[regexp_attribute('id')]
-        if id.to_s.blank?
+        if id.to_s.strip.empty?
           id = CGI.unescapeHTML(text.downcase).gsub(/\s+/, '_').gsub(/[^A-Za-z0-9\-_:.]/, '')
           header = %{<#{tag} #{attributes} id='#{id}'>#{text}</#{tag}>}
         end
@@ -283,6 +298,21 @@
       Page.new(*args)
     end
 
+  end
+
+
+  # Syntax highlighting filter.
+  filter_for :syntax do |html|
+    html.gsub(HTML.regexp_element('pre')) do |pre|
+      attributes, code = $2, $3
+      if attributes[HTML.regexp_attribute('class')]
+        classes = $3.split(/\s+/)
+        lang = classes.first
+      end
+      unescaped = CGI.unescapeHTML(code)
+      highlight = Syntax::Convertors::HTML.for_syntax(lang).convert(unescaped, false)
+      %{<pre class="#{lang}">#{highlight}</pre>}
+    end
   end
 
 end

Modified: incubator/buildr/docter/trunk/lib/docter/rake.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/lib/docter/rake.rb?rev=640988&r1=640987&r2=640988&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/lib/docter/rake.rb (original)
+++ incubator/buildr/docter/trunk/lib/docter/rake.rb Tue Mar 25 14:15:17 2008
@@ -1,3 +1,19 @@
+# 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.
+
+
 module Docter
   module Rake
 

Modified: incubator/buildr/docter/trunk/lib/docter/server.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/lib/docter/server.rb?rev=640988&r1=640987&r2=640988&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/lib/docter/server.rb (original)
+++ incubator/buildr/docter/trunk/lib/docter/server.rb Tue Mar 25 14:15:17 2008
@@ -1,3 +1,23 @@
+# 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 'mongrel'
+require 'cgi'
+
+
 module Docter
 
   class MongrelHandler < Mongrel::HttpHandler

Modified: incubator/buildr/docter/trunk/lib/docter/template.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/lib/docter/template.rb?rev=640988&r1=640987&r2=640988&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/lib/docter/template.rb (original)
+++ incubator/buildr/docter/trunk/lib/docter/template.rb Tue Mar 25 14:15:17 2008
@@ -1,3 +1,23 @@
+# 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 'haml'
+require 'erb'
+
+
 module Docter
 
   # A template for formatting pages. The template is parsed once and processed using each Page to
@@ -137,18 +157,7 @@
     # Copy resource files to the destination directory.
     def copy_resources(to_dir)
       mkpath to_dir
-      @sources.each do |file|
-        if File.directory?(file)
-          base = File.dirname(file) + '/'
-          FileList[File.join(file, '**/*')].each do |file|
-            target = File.join(to_dir, file.sub(base, ''))
-            mkpath File.dirname(target)
-            cp file, target
-          end
-        else
-          cp file, to_dir
-        end 
-      end
+      cp_r @sources, to_dir
       touch to_dir # For Rake dependency management.
     end
 
@@ -163,16 +172,10 @@
 
   protected
 
-    if defined?(::Haml)
-      def create_from_haml(content, options)
-        @options = options
-        template = Haml::Engine.new(content, :filename=>@filename)
-        @process = lambda { |context| template.render(context) }
-      end
-    else
-      def create_from_haml(content, options)
-        fail "You need to install HAML first:\n  gem install haml"
-      end
+    def create_from_haml(content, options)
+      @options = options
+      template = Haml::Engine.new(content, :filename=>@filename)
+      @process = lambda { |context| template.render(context) }
     end
 
     def create_from_erb(content, options)

Modified: incubator/buildr/docter/trunk/lib/docter/ultraviolet.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/lib/docter/ultraviolet.rb?rev=640988&r1=640987&r2=640988&view=diff
==============================================================================
--- incubator/buildr/docter/trunk/lib/docter/ultraviolet.rb (original)
+++ incubator/buildr/docter/trunk/lib/docter/ultraviolet.rb Tue Mar 25 14:15:17 2008
@@ -1,3 +1,19 @@
+# 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 'uv' # gem install ultraviolet
 
 module Docter

Added: incubator/buildr/docter/trunk/rakelib/apache.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/rakelib/apache.rake?rev=640988&view=auto
==============================================================================
--- incubator/buildr/docter/trunk/rakelib/apache.rake (added)
+++ incubator/buildr/docter/trunk/rakelib/apache.rake Tue Mar 25 14:15:17 2008
@@ -0,0 +1,84 @@
+# 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
+
+  LICENSE_REQUIRED = ['lib', 'doc', 'spec', 'Rakefile', 'rakelib']
+  LICENSE_EXCLUDED = []
+
+  desc 'Check that source files contain the Apache license'
+  task 'license' do
+    say 'Checking that files contain the Apache license ... '
+    required = FileList[].include(LICENSE_REQUIRED.map { |path| File.directory?(path) ? "#{path}/**/*" : path }).
+      exclude(*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'=>'pkg' 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=>['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

Added: incubator/buildr/docter/trunk/rakelib/release.rake
URL: http://svn.apache.org/viewvc/incubator/buildr/docter/trunk/rakelib/release.rake?rev=640988&view=auto
==============================================================================
--- incubator/buildr/docter/trunk/rakelib/release.rake (added)
+++ incubator/buildr/docter/trunk/rakelib/release.rake Tue Mar 25 14:15:17 2008
@@ -0,0 +1,27 @@
+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
+
+end