buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject svn commit: r1151085 - /buildr/trunk/rakelib/doc.rake
Date Tue, 26 Jul 2011 13:21:47 GMT
Author: donaldp
Date: Tue Jul 26 13:21:47 2011
New Revision: 1151085

URL: http://svn.apache.org/viewvc?rev=1151085&view=rev
Log:
Don't define any documentation tasks if running rake on jruby as they gems required are not
available

Modified:
    buildr/trunk/rakelib/doc.rake

Modified: buildr/trunk/rakelib/doc.rake
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/doc.rake?rev=1151085&r1=1151084&r2=1151085&view=diff
==============================================================================
--- buildr/trunk/rakelib/doc.rake (original)
+++ buildr/trunk/rakelib/doc.rake Tue Jul 26 13:21:47 2011
@@ -13,117 +13,118 @@
 # License for the specific language governing permissions and limitations under
 # the License.
 
+if !RUBY_PLATFORM[/java/]
+  task 'doc:setup'
+  begin # For the Web site, we use the SDoc RDoc generator/theme (http://github.com/voloko/sdoc/)
+    require 'sdoc'
+  rescue LoadError
+    puts "Buildr uses the SDoc RDoc generator/theme. You can install it by running bundler"
+  end
 
-task 'doc:setup'
-begin # For the Web site, we use the SDoc RDoc generator/theme (http://github.com/voloko/sdoc/)
-  require 'sdoc'
-rescue LoadError
-  puts "Buildr uses the SDoc RDoc generator/theme. You can install it by running bundler"
-end
-
-require 'rdoc/task'
+  require 'rdoc/task'
 
-desc "Creates a symlink to rake's lib directory to support combined rdoc generation"
-file "rake/lib" do
-  rake_path = $LOAD_PATH.find { |p| File.exist? File.join(p, "rake.rb") }
-  mkdir_p "rake"
-  File.symlink(rake_path, "rake/lib")
-end
+  desc "Creates a symlink to rake's lib directory to support combined rdoc generation"
+  file "rake/lib" do
+    rake_path = $LOAD_PATH.find { |p| File.exist? File.join(p, "rake.rb") }
+    mkdir_p "rake"
+    File.symlink(rake_path, "rake/lib")
+  end
 
-desc "Generate RDoc documentation in rdoc/"
-Rake::RDocTask.new :rdoc do |rdoc|
-  rdoc.rdoc_dir = 'rdoc'
-  rdoc.title    = spec.name
-  rdoc.options  = spec.rdoc_options.clone
-  rdoc.rdoc_files.include('lib/**/*.rb')
-  rdoc.rdoc_files.include spec.extra_rdoc_files
+  desc "Generate RDoc documentation in rdoc/"
+  Rake::RDocTask.new :rdoc do |rdoc|
+    rdoc.rdoc_dir = 'rdoc'
+    rdoc.title = spec.name
+    rdoc.options = spec.rdoc_options.clone
+    rdoc.rdoc_files.include('lib/**/*.rb')
+    rdoc.rdoc_files.include spec.extra_rdoc_files
 
-  # include rake source for better inheritance rdoc
-  rdoc.rdoc_files.include('rake/lib/**.rb')
-end
-task :rdoc => ["rake/lib"]
+      # include rake source for better inheritance rdoc
+    rdoc.rdoc_files.include('rake/lib/**.rb')
+  end
+  task :rdoc => ["rake/lib"]
 
-begin
-  require 'jekylltask'
-  module TocFilter
-    def toc(input)
-      output = "<ol class=\"toc\">"
-      input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).each do |entry|
-        id = (entry[1][/^id=(['"])(.*)\1$/, 2] rescue nil)
-        title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
-        if id
-          output << %{<li><a href="##{id}">#{title}</a></li>}
-        else
-          output << %{<li>#{title}</li>}
+  begin
+    require 'jekylltask'
+    module TocFilter
+      def toc(input)
+        output = "<ol class=\"toc\">"
+        input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).each do |entry|
+          id = (entry[1][/^id=(['"])(.*)\1$/, 2] rescue nil)
+          title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
+          if id
+            output << %{<li><a href="##{id}">#{title}</a></li>}
+          else
+            output << %{<li>#{title}</li>}
+          end
         end
+        output << "</ol>"
+        output
       end
-      output << "</ol>"
-      output
     end
-  end
-  Liquid::Template.register_filter(TocFilter)
+    Liquid::Template.register_filter(TocFilter)
 
-  desc "Generate Buildr documentation in _site/"
-  JekyllTask.new :jekyll do |task|
-    task.source = 'doc'
-    task.target = '_site'
-  end
+    desc "Generate Buildr documentation in _site/"
+    JekyllTask.new :jekyll do |task|
+      task.source = 'doc'
+      task.target = '_site'
+    end
 
-rescue LoadError
-  puts "Buildr uses the jekyll gem to generate the Web site. You can install it by running
bundler"
-end
+  rescue LoadError
+    puts "Buildr uses the jekyll gem to generate the Web site. You can install it by running
bundler"
+  end
 
-if `pygmentize -V`.empty?
-  puts "Buildr uses the Pygments python library. You can install it by running 'sudo easy_install
Pygments'"
-end
+  if `pygmentize -V`.empty?
+    puts "Buildr uses the Pygments python library. You can install it by running 'sudo easy_install
Pygments'"
+  end
 
-desc "Generate Buildr documentation as buildr.pdf"
-file 'buildr.pdf'=>'_site' do |task|
-  pages = File.read('_site/preface.html').scan(/<li><a href=['"]([^'"]+)/).flatten.map
{ |f| "_site/#{f}" }
-  sh 'prince', '--input=html', '--no-network', '--log=prince_errors.log', "--output=#{task.name}",
'_site/preface.html', *pages
-end
+  desc "Generate Buildr documentation as buildr.pdf"
+  file 'buildr.pdf'=>'_site' do |task|
+    pages = File.read('_site/preface.html').scan(/<li><a href=['"]([^'"]+)/).flatten.map
{ |f| "_site/#{f}" }
+    sh 'prince', '--input=html', '--no-network', '--log=prince_errors.log', "--output=#{task.name}",
'_site/preface.html', *pages
+  end
 
-desc "Build a copy of the Web site in the ./_site"
-task :site=>['_site', :rdoc, '_reports/specs.html', '_reports/coverage', 'buildr.pdf']
do
-  cp_r 'rdoc', '_site'
-  fail 'No RDocs in site directory' unless File.exist?('_site/rdoc/files/lib/buildr_rb.html')
-  cp '_reports/specs.html', '_site'
-  cp_r '_reports/coverage', '_site'
-  fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
-  cp 'CHANGELOG', '_site'
-  open("_site/.htaccess", "w") do |htaccess|
-    htaccess << %Q{
+  desc "Build a copy of the Web site in the ./_site"
+  task :site=>['_site', :rdoc, '_reports/specs.html', '_reports/coverage', 'buildr.pdf']
do
+    cp_r 'rdoc', '_site'
+    fail 'No RDocs in site directory' unless File.exist?('_site/rdoc/files/lib/buildr_rb.html')
+    cp '_reports/specs.html', '_site'
+    cp_r '_reports/coverage', '_site'
+    fail 'No coverage report in site directory' unless File.exist?('_site/coverage/index.html')
+    cp 'CHANGELOG', '_site'
+    open("_site/.htaccess", "w") do |htaccess|
+      htaccess << %Q{
 <FilesMatch "CHANGELOG">
 ForceType 'text/plain; charset=UTF-8'
 </FilesMatch>
 }
+    end
+    cp 'buildr.pdf', '_site'
+    fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
+    puts 'OK'
   end
-  cp 'buildr.pdf', '_site'
-  fail 'No PDF in site directory' unless File.exist?('_site/buildr.pdf')
-  puts 'OK'
-end
 
 # Publish prerequisites to Web site.
-task 'publish'=>:site do
-  target = "people.apache.org:/www/#{spec.name}.apache.org/"
-  puts "Uploading new site to #{target} ..."
-  sh 'rsync', '--progress', '--recursive', '--delete', '_site/', target
-  sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
-  puts "Done"
-end
+  task 'publish'=>:site do
+    target = "people.apache.org:/www/#{spec.name}.apache.org/"
+    puts "Uploading new site to #{target} ..."
+    sh 'rsync', '--progress', '--recursive', '--delete', '_site/', target
+    sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
+    puts "Done"
+  end
 
 # Update HTML + PDF documentation (but not entire site; no specs, coverage, etc.)
-task 'publish-doc' => ['buildr.pdf', '_site'] do
-  cp 'buildr.pdf', '_site'
-  target = "people.apache.org:/www/#{spec.name}.apache.org/"
-  puts "Uploading new site to #{target} ..."
-  sh 'rsync', '--progress', '--recursive', '_site/', target # Note: no --delete
-  sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
-  puts "Done"
-end
+  task 'publish-doc' => ['buildr.pdf', '_site'] do
+    cp 'buildr.pdf', '_site'
+    target = "people.apache.org:/www/#{spec.name}.apache.org/"
+    puts "Uploading new site to #{target} ..."
+    sh 'rsync', '--progress', '--recursive', '_site/', target # Note: no --delete
+    sh 'ssh', 'people.apache.org', 'chmod', '-f', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
+    puts "Done"
+  end
 
-task :clobber do
-  rm_rf '_site'
-  rm_f 'buildr.pdf'
-  rm_f 'prince_errors.log'
+  task :clobber do
+    rm_rf '_site'
+    rm_f 'buildr.pdf'
+    rm_f 'prince_errors.log'
+  end
 end



Mime
View raw message