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 2009/03/11 23:50:21 UTC
svn commit: r752677 - in /buildr/trunk: .gitignore doc/_layouts/default.html
doc/_layouts/preface.html doc/css/print.css doc/languages.textile
doc/preface.textile doc/print.haml rakelib/doc.rake rakelib/jekylltask.rb
Author: assaf
Date: Wed Mar 11 22:50:20 2009
New Revision: 752677
URL: http://svn.apache.org/viewvc?rev=752677&view=rev
Log:
Added PDF generation. Added a preface page for the general table of contents and otherwise using the wonderful powers of Prince to merge pages together and rewrite links so we won't have to.
Added:
buildr/trunk/doc/_layouts/preface.html
buildr/trunk/doc/preface.textile
Removed:
buildr/trunk/doc/print.haml
Modified:
buildr/trunk/.gitignore
buildr/trunk/doc/_layouts/default.html
buildr/trunk/doc/css/print.css
buildr/trunk/doc/languages.textile
buildr/trunk/rakelib/doc.rake
buildr/trunk/rakelib/jekylltask.rb
Modified: buildr/trunk/.gitignore
URL: http://svn.apache.org/viewvc/buildr/trunk/.gitignore?rev=752677&r1=752676&r2=752677&view=diff
==============================================================================
--- buildr/trunk/.gitignore (original)
+++ buildr/trunk/.gitignore Wed Mar 11 22:50:20 2009
@@ -9,3 +9,4 @@
_stage
_release
tmp
+*.log
Modified: buildr/trunk/doc/_layouts/default.html
URL: http://svn.apache.org/viewvc/buildr/trunk/doc/_layouts/default.html?rev=752677&r1=752676&r2=752677&view=diff
==============================================================================
--- buildr/trunk/doc/_layouts/default.html (original)
+++ buildr/trunk/doc/_layouts/default.html Wed Mar 11 22:50:20 2009
@@ -1,4 +1,3 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<meta content='text/html;charset=UTF-8' http-equiv='Content-Type' />
@@ -9,7 +8,6 @@
</style>
<style media='print' type='text/css'>
@import 'css/print.css';
- #header { display: none }
</style>
<meta content='Official Buildr documentation from the people in the know' name='subject' />
<link href='images/favicon.png' rel='shortcut icon' />
@@ -75,7 +73,7 @@
</form>
</div>
<div id='content'>
- <h1>{{ page.title }}</h1>
+ <h1 id='{{ page.title | downcase | replace(' ', '_') }}'>{{ page.title }}</h1>
{{ content | toc }}
{{ content }}
</div>
Added: buildr/trunk/doc/_layouts/preface.html
URL: http://svn.apache.org/viewvc/buildr/trunk/doc/_layouts/preface.html?rev=752677&view=auto
==============================================================================
--- buildr/trunk/doc/_layouts/preface.html (added)
+++ buildr/trunk/doc/_layouts/preface.html Wed Mar 11 22:50:20 2009
@@ -0,0 +1,22 @@
+<html>
+ <head>
+ <meta content='text/html;charset=UTF-8' http-equiv='Content-Type' />
+ <title>buildr</title>
+ <style type='text/css'>
+ @import 'css/default.css';
+ @import 'css/syntax.css';
+ </style>
+ <style media='print' type='text/css'>
+ @import 'css/print.css';
+ </style>
+ <meta content='Official Buildr documentation from the people in the know' name='subject' />
+ <link href='images/favicon.png' rel='shortcut icon' />
+ </head>
+ <body>
+ <div id='wrap'>
+ <div id='content'>
+ {{ content }}
+ </div>
+ </div>
+ </body>
+</html>
Modified: buildr/trunk/doc/css/print.css
URL: http://svn.apache.org/viewvc/buildr/trunk/doc/css/print.css?rev=752677&r1=752676&r2=752677&view=diff
==============================================================================
--- buildr/trunk/doc/css/print.css (original)
+++ buildr/trunk/doc/css/print.css Wed Mar 11 22:50:20 2009
@@ -73,24 +73,14 @@
border: 0;
}
- #header {
- margin-bottom: 5%;
- font-size: 120%;
- }
- #header img { width: 4in; }
- #header .tagline {
- float: none !important;
- position: static !important;
- font-size: 1.2em;
- text-align: center;
- }
+ #header { display: none }
#pages, .noprint { display: none; }
ol.toc a:link, ol.toc a:visited { text-decoration: none; }
ol.toc a:after { content: leader('.') target-counter(attr(href), page); }
- #footer { margin-top: 5%; }
+ #footer { display: none }
#license {
page-break-before: always;
Modified: buildr/trunk/doc/languages.textile
URL: http://svn.apache.org/viewvc/buildr/trunk/doc/languages.textile?rev=752677&r1=752676&r2=752677&view=diff
==============================================================================
--- buildr/trunk/doc/languages.textile (original)
+++ buildr/trunk/doc/languages.textile Wed Mar 11 22:50:20 2009
@@ -164,9 +164,11 @@
You must also require the Scala compiler in your buildfile:
-{{{!ruby
+<notextile>
+{% highlight ruby %}
require 'buildr/scala'
-}}}
+{% endhighlight %}
+</notextile>
h3. Compiling Scala
Added: buildr/trunk/doc/preface.textile
URL: http://svn.apache.org/viewvc/buildr/trunk/doc/preface.textile?rev=752677&view=auto
==============================================================================
--- buildr/trunk/doc/preface.textile (added)
+++ buildr/trunk/doc/preface.textile Wed Mar 11 22:50:20 2009
@@ -0,0 +1,34 @@
+---
+layout: preface
+---
+
+!{width:20em}images/buildr-hires.png!
+
+#(toc) "Getting Started":getting_started.html
+# "Projects":projects.html
+# "Building":building.html
+# "Artifacts":artifacts.html
+# "Packaging":packaging.html
+# "Testing":testing.html
+# "Settings & Profiles":settings_profiles.html
+# "Languages":languages.html
+# "More Stuff":more_stuff.html
+# "Extending Buildr":extending.html
+# "Recipes":recipes.html
+# "Troubleshooting":troubleshooting.html
+# "Contributing":contributing.html
+
+
+p(#license). Copyright 2007-2009 Apache Buildr
+
+Licensed 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":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.
Modified: buildr/trunk/rakelib/doc.rake
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/doc.rake?rev=752677&r1=752676&r2=752677&view=diff
==============================================================================
--- buildr/trunk/rakelib/doc.rake (original)
+++ buildr/trunk/rakelib/doc.rake Wed Mar 11 22:50:20 2009
@@ -25,7 +25,7 @@
end
-desc 'Generate RDoc documentation'
+desc "Generate RDoc documentation in rdoc/"
Rake::RDocTask.new('rdoc') do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = spec.name
@@ -34,25 +34,32 @@
rdoc.rdoc_files.include spec.extra_rdoc_files
end
-
+desc "Generate Buildr documentation in _site/"
JekyllTask.new 'jekyll' do |task|
task.source = 'doc'
task.target = '_site'
task.pygments = true
end
+desc "Generate Buildr documentation as buildr.pdf"
+file 'buildr.pdf'=>'_site' do |task|
+ pages = File.read('doc/preface.textile').scan(/^#.*":(\S*)$/).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', 'spec', 'coverage'] do
+task 'site'=>['_site', 'rdoc', 'spec', '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'
+ 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 'site_publish'=>'site' do
target = "people.apache.org:/www/#{spec.name}.apache.org"
@@ -63,5 +70,7 @@
end
task 'clobber' do
- rm_rf '_site' if File.exist?('_site')
+ rm_rf '_site'
+ rm 'buildr.pdf'
+ rm 'prince_errors.log'
end
Modified: buildr/trunk/rakelib/jekylltask.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/rakelib/jekylltask.rb?rev=752677&r1=752676&r2=752677&view=diff
==============================================================================
--- buildr/trunk/rakelib/jekylltask.rb (original)
+++ buildr/trunk/rakelib/jekylltask.rb Wed Mar 11 22:50:20 2009
@@ -23,14 +23,12 @@
@target = name
yield self if block_given?
task name, :auto, :needs=>[@source] do |task, args|
- if args.auto
- auto_generate
- else
- generate
- end
+ generate args.auto
end
if @source != @target
- file @target=>name
+ file @target=>FileList["#{@source}/**/*"] do
+ generate
+ end
task 'clobber' do
rm_rf @target
end
@@ -41,32 +39,36 @@
attr_accessor :target
attr_accessor :pygments
- def generate
- puts "Generating documentation in #{target}"
- Jekyll.pygments = @pygments
- Jekyll.process source, target
- end
-
- def auto_generate
- require 'directory_watcher'
- puts "Auto generating: just edit a page and save, watch the console to see when its done"
- dw = DirectoryWatcher.new(source)
- dw.interval = 1
- dw.glob = Dir.chdir(source) do
- dirs = Dir['*'].select { |x| File.directory?(x) }
- dirs -= [target]
- dirs = dirs.map { |x| "#{x}/**/*" }
- dirs += ['*']
- end
- dw.start
- dw.add_observer do |*args|
- t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
- puts "[#{t}] regeneration: #{args.size} files changed"
+ def generate(auto = false)
+ process = lambda do
Jekyll.pygments = @pygments
Jekyll.process source, target
- puts "Done"
+ touch target
+ end
+
+ if auto
+ require 'directory_watcher'
+ puts "Auto generating: just edit a page and save, watch the console to see when we're done regenerating pages"
+ dw = DirectoryWatcher.new(source)
+ dw.interval = 1
+ dw.glob = Dir.chdir(source) do
+ dirs = Dir['*'].select { |x| File.directory?(x) }
+ dirs -= [target]
+ dirs = dirs.map { |x| "#{x}/**/*" }
+ dirs += ['*']
+ end
+ dw.start
+ dw.add_observer do |*args|
+ t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
+ puts "[#{t}] regeneration: #{args.size} files changed"
+ process.call
+ puts "Done"
+ end
+ loop { sleep 1 }
+ else
+ puts "Generating documentation in #{target}"
+ process.call
end
- loop { sleep 1 }
end
end
@@ -89,6 +91,14 @@
end
end
+ class Jekyll::Page
+ def render(layouts, site_payload)
+ puts "... #{@name}"
+ payload = {"page" => self.data}.deep_merge(site_payload)
+ do_layout(payload, layouts)
+ end
+ end
+
module TocFilter
def toc(input)
input.scan(/<(h2)(?:>|\s+(.*?)>)(.*?)<\/\1\s*>/mi).inject(%{<ol class="toc">}) { |toc, entry|