ref: refs/heads/network
commit b8c04d92e1285133066d0c85a9af1126b4eb8023
Author: Ladislav Slezak
Date: Thu Sep 10 14:59:18 2009 +0200
added restdoc task
---
webservice-tasks/lib/tasks/restdoc.rake | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/webservice-tasks/lib/tasks/restdoc.rake b/webservice-tasks/lib/tasks/restdoc.rake
new file mode 100644
index 0000000..10f5a82
--- /dev/null
+++ b/webservice-tasks/lib/tasks/restdoc.rake
@@ -0,0 +1,24 @@
+require 'rake'
+
+desc "Generate REST API documentation using 'restility'"
+task :restdoc do
+
+ require 'rubygems'
+ if Gem.available? 'restility'
+
+ # input file in root plugin directory
+ api_file = 'restdoc/api.txt'
+ # output directory
+ doc_target = Dir.glob('public/**/restdoc').first
+
+ if File.exists?(api_file) && File.exists?(doc_target)
+ puts "Generating REST API documentation in #{doc_target}..."
+
+ `rest_doc #{api_file} -I #{api_file.split('/').first} --html -o #{doc_target}`
+ end
+ else
+ puts 'Error: restility gem is not installed!'
+ exit 1
+ end
+end
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org