mirror of
				https://github.com/fog/fog.git
				synced 2022-11-09 13:51:43 -05:00 
			
		
		
		
	[docs] add task to build/publish supported services matrix
This commit is contained in:
		
							parent
							
								
									ad3ad56f10
								
							
						
					
					
						commit
						822fd3c81e
					
				
					 3 changed files with 69 additions and 1 deletions
				
			
		
							
								
								
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -4,9 +4,10 @@
 | 
			
		|||
*.sw?
 | 
			
		||||
.bundle
 | 
			
		||||
.DS_Store
 | 
			
		||||
docs/_site/*
 | 
			
		||||
coverage
 | 
			
		||||
doc/*
 | 
			
		||||
docs/_site/*
 | 
			
		||||
docs/about/supported_services.markdown
 | 
			
		||||
Gemfile.lock
 | 
			
		||||
rdoc
 | 
			
		||||
pkg
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										66
									
								
								Rakefile
									
										
									
									
									
								
							
							
						
						
									
										66
									
								
								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 << "<table border='1'>\n"
 | 
			
		||||
 | 
			
		||||
  table << "  <tr>"
 | 
			
		||||
  for column in columns
 | 
			
		||||
    table << "<th>#{column}</th>"
 | 
			
		||||
  end
 | 
			
		||||
  table << "</tr>\n"
 | 
			
		||||
 | 
			
		||||
  for datum in data
 | 
			
		||||
    table << "  <tr>"
 | 
			
		||||
    for column in columns
 | 
			
		||||
      if value = datum[column]
 | 
			
		||||
        case value
 | 
			
		||||
        when Array
 | 
			
		||||
          table << "<td>#{value.join(', ')}</td>"
 | 
			
		||||
        when '+'
 | 
			
		||||
          table << "<td style='text-align: center;'>#{value}</td>"
 | 
			
		||||
        else
 | 
			
		||||
          table << "<th>#{value}</th>"
 | 
			
		||||
        end
 | 
			
		||||
      else
 | 
			
		||||
        table << "<td></td>"
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
    table << "</tr>\n"
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  table << "</table>\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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -61,6 +61,7 @@
 | 
			
		|||
        <li><a href="/about/getting_started.html">Getting Started</a></li>
 | 
			
		||||
        <li><a href="/about/press.html">Press</a></li>
 | 
			
		||||
        <li><a href="/about/structure.html">Structure</a></li>
 | 
			
		||||
        <li><a href="/about/supported_services.html">Supported Services</a></li>
 | 
			
		||||
        <li><a href="/about/users.html">Users</a></li>
 | 
			
		||||
      </ul>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue