Permalink
Browse files

First cut at linking api docs.

  • Loading branch information...
1 parent 613d280 commit 22869b2356d7a6426a5f1f1d3765b07c50676cf0 @tobias tobias committed Jan 5, 2012
Showing with 97 additions and 28 deletions.
  1. +1 −0 _config/releases.yml
  2. +51 −9 _ext/documentation.rb
  3. +5 −0 _ext/downloads.rb
  4. +12 −4 documentation.html.haml
  5. +28 −15 download/index.html.haml
View
@@ -1,6 +1,7 @@
- version: '2.0.0.beta1'
jira_version: 12315931
latest: true
+ api_docs: true
- version: '1.1.1'
jira_version: 12317226
- version: '1.1'
View
@@ -1,19 +1,21 @@
class Documentation
-
+ API_DOC_REPO = "http://repository-projectodd.forge.cloudbees.com/staging/org/torquebox/torquebox-complete/"
+
def initialize(enabled=true)
@enabled = enabled
end
def execute(site)
return unless @enabled
+ @tmp_dir = site.tmp_dir
+
current_path = File.join( site.output_dir, 'documentation', 'current' )
FileUtils.rm( current_path ) if File.exist?( current_path )
(site.releases).each do |release|
doc_bundle_name = "torquebox-docs-en_US-#{release.version}-html.zip"
- doc_bundle_path = File.join( site.tmp_dir, doc_bundle_name )
doc_root = File.join( site.output_dir, 'documentation', release.version )
FileUtils.mkdir_p( doc_root )
@@ -24,17 +26,57 @@ def execute(site)
end
end
- unless ( File.exist?( doc_bundle_path ) )
+ unless bundle_exists?( doc_bundle_name )
puts "Fetching doc bundle for #{release.version}"
-
- doc_url = release.urls.docs.remote_html_multi_zip
-
- `wget --quiet -P #{site.tmp_dir} #{doc_url}`
+ dl( release.urls.docs.remote_html_multi_zip )
end
- unless ( File.exist?( File.join( doc_root, "index.html" ) ) )
+
+ unless File.exist?( File.join( doc_root, "index.html" ) )
puts "Unzipping doc bundle for #{release.version}"
- `unzip -q #{doc_bundle_path} -d #{doc_root}`
+ unzip( bundle_path( doc_bundle_name ), doc_root )
+ end
+
+ if release.api_docs === true
+ api_docs( release.version, 'javadoc', doc_root )
+ api_docs( release.version, 'yardoc', doc_root )
end
+
+ end
+ end
+
+ def api_docs(version, type, root)
+ bundle_name = "torquebox-complete-#{version}-#{type}s.jar"
+ url = API_DOC_REPO + version + "/#{bundle_name}"
+
+ unless bundle_exists?( bundle_name )
+ puts "Fetching #{type} bundle for #{version}"
+ dl( url )
end
+
+ output_dir = File.join( root, type )
+ if bundle_exists?( bundle_name ) && !File.exist?( output_dir )
+ puts "Unzipping #{type} bundle for #{version}"
+ FileUtils.mkdir_p( output_dir )
+ unzip( bundle_path( bundle_name ), output_dir )
+ end
+ end
+
+ def bundle_exists?(name)
+ File.exist?( bundle_path( name ) )
+ end
+
+ def bundle_path(name)
+ File.join( @tmp_dir, name )
+ end
+
+ def unzip(bundle, dest)
+ `unzip -q #{bundle} -d #{dest}`
+ end
+
+
+
+ def dl(url, dir = @tmp_dir)
+ `wget --quiet -P #{dir} #{url}`
end
+
end
View
@@ -51,6 +51,11 @@ def all_releases(version, release)
release.urls ||= OpenStruct.new
release.urls.docs ||= OpenStruct.new
release.urls.docs.browse = "/documentation/#{release.version}/"
+ if release.api_docs === true
+ release.urls.docs.javadocs = "/documentation/#{release.version}/javadoc/"
+ release.urls.docs.yardocs = "/documentation/#{release.version}/yardoc/"
+ end
+
release.urls.docs.pdf = "#{DOCS_PREFIX}/#{release.version}/torquebox-docs-en_US-#{release.version}.pdf"
release.urls.docs.html_multi_zip = "#{DOCS_PREFIX}/#{release.version}/torquebox-docs-en_US-#{release.version}-html.zip"
release.urls.docs.remote_html_multi_zip = "#{REMOTE_DOCS_PREFIX}/#{release.version}/torquebox-docs-en_US-#{release.version}-html.zip"
View
@@ -12,15 +12,18 @@ priority: 0.9
%th
Browse
%th
- Download
+ Download Manual
%tr
%td
%a{:href=>'/2x/builds', :rel=>'beta documentation'}
2.x.incremental
%td
- %a{:href=>'/2x/builds/html-docs/', :rel=>'beta documentation'}
- Browse
+ %a{:href=>'/2x/builds/html-docs/', :rel=>'beta documentation'}Manual
+ |
+ %a{:href=>'/2x/builds/javadocs/', :rel=>'beta documentation'}JavaDocs
+ |
+ %a{:href=>'/2x/builds/yardocs/', :rel=>'beta documentation'}Gem RDocs
%td
%a{:href=>'/2x/builds/torquebox-docs.pdf', :rel=>'beta documentation'}
PDF
@@ -31,7 +34,12 @@ priority: 0.9
%td
#{release.version}
%td
- %a{:href=>"/documentation/#{release.version}/", :rel=>rel}Browse
+ %a{:href=>"/documentation/#{release.version}/", :rel=>rel}Manual
+ - unless release.urls.docs.javadocs.empty?
+ |
+ %a{:href=>"/documentation/#{release.version}/javadoc", :rel=>rel}JavaDocs
+ |
+ %a{:href=>"/documentation/#{release.version}/yardoc", :rel=>rel}Gem RDocs
%td
%a{:href=>release.urls.docs.pdf, :rel=>rel} PDF
|
View
@@ -16,29 +16,31 @@ priority: 1
# Incremental Builds
- Unstable incremental builds for [1.x](/1x/builds/) and [2.x](/2x/builds/) are produced regularly from our
- [continuous integration server](/development#ci). The 2.x builds are currently *much* closer in functionality
- than the 1.x builds to the latest official release (#{site.releases.first.version}).
+ Unstable [incremental builds](/2x/builds/) are produced regularly from our
+ [continuous integration server](/development#ci).
-
A developer build has no guarantee of actually working. *At all.* But it probably will. Feel free to try it.
- * [Download the latest 1.x incremental build](/builds/LATEST/torquebox-dist-bin.zip)
- * [Download the latest 2.x incremental build](/2x/builds/torquebox-dist-bin.zip)
+ * [Download the latest incremental build](/2x/builds/torquebox-dist-bin.zip)
#right-column
:markdown
# Documentation
- You may [browse the documentation online](#{site.releases.first.urls.docs.browse})
-
- Downloadable documentation is available in several forms:
+ You may browse the documentation online:
+
+ * [Manual for #{site.releases.first.version}](#{site.releases.first.urls.docs.browse})
+ * [JavaDocs for #{site.releases.first.version}](#{site.releases.first.urls.docs.javadocs})
+ * [Gem RDocs for #{site.releases.first.version}](#{site.releases.first.urls.docs.yardocs})
+
+ The manual is available for download in several forms:
* [PDF Manual for #{site.releases.first.version}](#{site.releases.first.urls.docs.pdf})
* [Multi-page HTML Manual for #{site.releases.first.version}](#{site.releases.first.urls.docs.html_multi_zip})
+ * [ePub Manual for #{site.releases.first.version}](#{site.releases.first.urls.docs.epub})
- You may also obtain a pdf containing the latest, un-released documentation that coincides with our developer build.
+ You may also obtain a pdf containing the latest, un-released manual that coincides with our developer build.
* [Download the latest documentation](http://torquebox.org/torquebox-doc.pdf)
@@ -74,17 +76,28 @@ priority: 1
- rel = release.latest? ? 'documentation' : 'nofollow'
%ul
%li
- %a{:href=>release.urls.docs.browse, :rel=>rel} Browse
+ - if release.urls.docs.javadocs.empty?
+ %a{:href=>release.urls.docs.browse, :rel=>rel} Browse Manual
+ - else
+ Browse:
+ %ul
+ %li
+ %a{:href=>release.urls.docs.browse, :rel=>rel} Manual
+ %li
+ %a{:href=>release.urls.docs.javadocs, :rel=>rel} JavaDocs
+ %li
+ %a{:href=>release.urls.docs.yardocs, :rel=>rel} Gem RDocs
+
%li
- %a{:href=>release.urls.docs.html_multi_zip, :rel=>rel} Multi-page HTML ZIP
+ %a{:href=>release.urls.docs.html_multi_zip, :rel=>rel} Multi-page HTML Manual (ZIP)
- unless ( release.urls.docs.html_single_zip.empty? )
%li
- %a{:href=>release.urls.docs.html_single_zip, :rel=>rel} Single-page HTML ZIP
+ %a{:href=>release.urls.docs.html_single_zip, :rel=>rel} Single-page HTML Manual (ZIP)
%li
- %a{:href=>release.urls.docs.pdf, :rel=>rel} PDF
+ %a{:href=>release.urls.docs.pdf, :rel=>rel} Manual (PDF)
- unless ( release.urls.docs.epub.empty? )
%li
- %a{:href=>release.urls.docs.epub, :rel=>rel} ePub
+ %a{:href=>release.urls.docs.epub, :rel=>rel} Manual (ePub)
%td
%ul
%li

0 comments on commit 22869b2

Please sign in to comment.