Added super-hacky script to generate the wiki reference pages.
This commit is contained in:
1 parent
5d314e6454
commit
84ae475d55
13 files changed
+1010
-7
No files matched your search
+47
-7
@@ -1,11 +1,21 @@
|
||||
$LOAD_PATH.unshift(
|
||||
File.expand_path(File.join(File.dirname(__FILE__), '../yard/lib'))
|
||||
)
|
||||
$LOAD_PATH.unshift(File.expand_path('.'))
|
||||
$LOAD_PATH.uniq!
|
||||
|
||||
require 'google/api_client'
|
||||
require 'rake'
|
||||
require 'rake/clean'
|
||||
|
||||
CLOBBER.include('wiki')
|
||||
|
||||
CACHE_PREFIX =
|
||||
"http://www.gmodules.com/gadgets/proxy/container=default&debug=0&nocache=0/"
|
||||
|
||||
namespace :wiki do
|
||||
desc 'Autogenerate wiki pages'
|
||||
task :generate do
|
||||
task :supported_apis do
|
||||
output = <<-WIKI
|
||||
#summary The list of supported APIs
|
||||
|
||||
@@ -23,12 +33,15 @@ WIKI
|
||||
end
|
||||
end
|
||||
for api_name, api in preferred_apis
|
||||
output += (
|
||||
"||#{CACHE_PREFIX}#{api['icons']['x16']}||" +
|
||||
"[#{api.documentation} #{api.title}]||" +
|
||||
"#{api.description}||\n"
|
||||
)
|
||||
if api.documentation.to_s != "" && api.title != ""
|
||||
output += (
|
||||
"||#{CACHE_PREFIX}#{api['icons']['x16']}||" +
|
||||
"[#{api.documentation} #{api.title}]||" +
|
||||
"#{api.description}||\n"
|
||||
)
|
||||
end
|
||||
end
|
||||
output.gsub!(/-32\./, "-16.")
|
||||
wiki_path = File.expand_path(
|
||||
File.join(File.dirname(__FILE__), '../wiki/'))
|
||||
Dir.mkdir(wiki_path) if !File.exist?(wiki_path)
|
||||
@@ -36,6 +49,33 @@ WIKI
|
||||
file.write(output)
|
||||
end
|
||||
end
|
||||
|
||||
task 'generate' => ['wiki:supported_apis']
|
||||
end
|
||||
|
||||
# task 'clobber' => ['wiki:clobber_wiki']
|
||||
begin
|
||||
require 'yard'
|
||||
require 'yard/rake/wikidoc_task'
|
||||
|
||||
namespace :wiki do
|
||||
desc 'Generate Wiki Documentation with YARD'
|
||||
YARD::Rake::WikidocTask.new do |yardoc|
|
||||
yardoc.name = 'reference'
|
||||
yardoc.options = [
|
||||
'--verbose',
|
||||
'-e', 'yard/lib/yard-google-code.rb',
|
||||
'-p', 'yard/templates',
|
||||
'-f', 'wiki',
|
||||
'-o', 'wiki'
|
||||
]
|
||||
yardoc.files = [
|
||||
'lib/**/*.rb', 'ext/**/*.c', '-', 'README.md', 'CHANGELOG.md'
|
||||
]
|
||||
end
|
||||
|
||||
task 'generate' => ['wiki:reference', 'wiki:supported_apis']
|
||||
end
|
||||
rescue LoadError
|
||||
# If yard isn't available, it's not the end of the world
|
||||
warn('YARD unavailable. Cannot fully generate wiki.')
|
||||
end
|
||||
Reference in new issue
Block a user