From 822fd3c81e34054935fa0e0279ea66439ff6f518 Mon Sep 17 00:00:00 2001 From: geemus Date: Tue, 9 Aug 2011 10:56:54 -0500 Subject: [PATCH] [docs] add task to build/publish supported services matrix --- .gitignore | 3 +- Rakefile | 66 ++++++++++++++++++++++++++++++++++++++ docs/_layouts/default.html | 1 + 3 files changed, 69 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2af463a7f..07303092b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,10 @@ *.sw? .bundle .DS_Store -docs/_site/* coverage doc/* +docs/_site/* +docs/about/supported_services.markdown Gemfile.lock rdoc pkg diff --git a/Rakefile b/Rakefile index 93492cd4f..d55dbde92 100644 --- a/Rakefile +++ b/Rakefile @@ -250,6 +250,7 @@ task :changelog do end task :docs do + Rake::Task[:supported_services_docs].invoke Rake::Task[:upload_fog_io].invoke Rake::Task[:upload_rdoc].invoke @@ -312,6 +313,71 @@ task :upload_fog_io do Formatador.redisplay("Uploaded docs/_site\n") end +task :supported_services_docs do + support, shared = {}, [] + for key, values in Fog.services + unless values.length == 1 + shared |= [key] + values.each do |value| + support[value] ||= {} + support[value][key] = '+' + end + else + value = values.first + support[value] ||= {} + support[value][:other] ||= [] + support[value][:other] << key + end + end + shared.sort! {|x,y| x.to_s <=> y.to_s} + columns = [:provider] + shared + [:other] + data = [] + for key in support.keys.sort {|x,y| x.to_s <=> y.to_s} + data << { :provider => key }.merge!(support[key]) + end + + table = '' + table << "\n" + + table << " " + for column in columns + table << "" + end + table << "\n" + + for datum in data + table << " " + for column in columns + if value = datum[column] + case value + when Array + table << "" + when '+' + table << "" + else + table << "" + end + else + table << "" + end + end + table << "\n" + end + + table << "
#{column}
#{value.join(', ')}#{value}#{value}
\n" + + File.open('docs/about/supported_services.markdown', 'w') do |file| + file.puts <<-METADATA +--- +layout: default +title: Supported Services +--- + +METADATA + file.puts(table) + end +end + task :upload_rdoc do # connect to storage provider Fog.credential = :geemus diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html index 4b6a31a7c..effe88a63 100755 --- a/docs/_layouts/default.html +++ b/docs/_layouts/default.html @@ -61,6 +61,7 @@
  • Getting Started
  • Press
  • Structure
  • +
  • Supported Services
  • Users