docapi 0.1.5 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/bin/docapi +2 -4
- data/docapi.gemspec +7 -2
- data/files/stylesheets/documentation/layout.css +1 -1
- data/lib/docapi.rb +127 -136
- data/lib/rdoc/generator/docapi.rb +149 -0
- data/test/Rakefile +19 -0
- data/test/doc/2-documentation/documentation.html +80 -84
- data/test/doc/3-tutorials/2-ruby/example-1.rb +3 -1
- metadata +15 -4
data/Rakefile
CHANGED
@@ -10,6 +10,7 @@ begin
|
|
10
10
|
gem.email = "cyril.rohr@gmail.com"
|
11
11
|
gem.homepage = "http://github.com/crohr/docapi"
|
12
12
|
gem.authors = ["Cyril Rohr"]
|
13
|
+
gem.add_dependency "rdoc", ">= 2.0.0"
|
13
14
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
14
15
|
end
|
15
16
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/bin/docapi
CHANGED
@@ -34,13 +34,11 @@ option_parser.parse!
|
|
34
34
|
|
35
35
|
@command = ARGV.shift
|
36
36
|
|
37
|
-
|
38
|
-
|
39
37
|
case @command
|
40
38
|
when 'generate'
|
41
|
-
Docapi.new.generate(input = ARGV, output = @options.delete(:output), @options)
|
39
|
+
Docapi::CLI.new.generate(input = ARGV, output = @options.delete(:output), @options)
|
42
40
|
when 'merge'
|
43
|
-
Docapi.new.merge(input = ARGV.shift, output = @options.delete(:output), @options)
|
41
|
+
Docapi::CLI.new.merge(input = ARGV.shift, output = @options.delete(:output), @options)
|
44
42
|
else
|
45
43
|
$stderr.puts option_parser.help
|
46
44
|
exit(-1)
|
data/docapi.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{docapi}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Cyril Rohr"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-03-15}
|
13
13
|
s.default_executable = %q{docapi}
|
14
14
|
s.description = %q{RDoc template for generating API documentation.}
|
15
15
|
s.email = %q{cyril.rohr@gmail.com}
|
@@ -48,6 +48,8 @@ Gem::Specification.new do |s|
|
|
48
48
|
"files/stylesheets/documentation/highlighter/zenburn.css",
|
49
49
|
"files/stylesheets/documentation/layout.css",
|
50
50
|
"lib/docapi.rb",
|
51
|
+
"lib/rdoc/generator/docapi.rb",
|
52
|
+
"test/Rakefile",
|
51
53
|
"test/code/reference_api.rb",
|
52
54
|
"test/doc/1-README.md",
|
53
55
|
"test/doc/2-documentation/documentation.html",
|
@@ -68,9 +70,12 @@ Gem::Specification.new do |s|
|
|
68
70
|
s.specification_version = 3
|
69
71
|
|
70
72
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
73
|
+
s.add_runtime_dependency(%q<rdoc>, [">= 2.0.0"])
|
71
74
|
else
|
75
|
+
s.add_dependency(%q<rdoc>, [">= 2.0.0"])
|
72
76
|
end
|
73
77
|
else
|
78
|
+
s.add_dependency(%q<rdoc>, [">= 2.0.0"])
|
74
79
|
end
|
75
80
|
end
|
76
81
|
|
data/lib/docapi.rb
CHANGED
@@ -1,150 +1,141 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
1
|
+
require 'yaml'
|
2
|
+
require 'haml'
|
3
3
|
require 'maruku'
|
4
|
-
require 'fileutils'
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
5
|
+
module Docapi
|
6
|
+
class CLI
|
7
|
+
|
8
|
+
TEMPLATE = <<TEMPLATE
|
9
|
+
- methods.each do |method|
|
10
|
+
.docapi-subsection
|
11
|
+
.docapi-title
|
12
|
+
%a{:name => method["name"].gsub(/\W/,' ').squeeze(' ').gsub(/\s/,'-')}= method["name"]
|
13
|
+
.docapi-content
|
14
|
+
= method["html_comment"].gsub(/<h2>(.*?)<\\/h2>/m, '<div class="docapi-subtitle">\\1</div>')
|
15
|
+
TEMPLATE
|
16
|
+
|
17
|
+
FILES_TO_INCLUDE = {
|
18
|
+
:javascripts => ["./javascripts/documentation/highlight.pack.js", "./javascripts/documentation/jquery-1.3.2.min.js", "./javascripts/documentation/jquery.tableofcontents.min.js", "./javascripts/documentation/documentation.js"],
|
19
|
+
:stylesheets => ["./stylesheets/documentation/layout.css", "./stylesheets/documentation/syntax.css", "./stylesheets/documentation/highlighter/default.css"]
|
20
|
+
}
|
14
21
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
# copy stylesheets and javascripts files
|
28
|
-
FileUtils.cp_r(File.join(File.dirname(__FILE__), "..", "files", "."), output_dir)
|
29
|
-
end
|
30
|
-
|
31
|
-
def convert_directory(dir, level = 1)
|
32
|
-
output = []
|
33
|
-
dir.entries.each do |entry|
|
34
|
-
next if entry.to_s =~ /^\./
|
35
|
-
path = dir+entry
|
36
|
-
title = File.basename(entry).gsub(/\d+-/, "").gsub(/\..+?$/, "")
|
37
|
-
output << "<div class='docapi-section #{title.downcase}'>"
|
38
|
-
if path.directory?
|
39
|
-
output << "<h#{level}>#{title.capitalize}</h#{level}>"
|
40
|
-
output << convert_directory(path, level+1)
|
41
|
-
else
|
42
|
-
output << convert_file(path)
|
43
|
-
end
|
44
|
-
output << '</div>'
|
22
|
+
def merge(input_path, output_path, options = {})
|
23
|
+
input_dir = Pathname.new(input_path)
|
24
|
+
raise ArgumentError, "Input directory does not exist" unless input_dir.directory?
|
25
|
+
output_dir = Pathname.new(output_path || Pathname.getwd+"generated-doc")
|
26
|
+
output_dir.mkpath
|
27
|
+
output = File.open(output_dir+"index.html", "w+")
|
28
|
+
output << header(:title => options[:title])
|
29
|
+
output << convert_directory(input_dir)
|
30
|
+
output << footer
|
31
|
+
output.close
|
32
|
+
# copy stylesheets and javascripts files
|
33
|
+
FileUtils.cp_r(File.join(File.dirname(__FILE__), "..", "files", "."), output_dir)
|
45
34
|
end
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
35
|
+
|
36
|
+
def convert_directory(dir, level = 1)
|
37
|
+
output = []
|
38
|
+
dir.entries.each do |entry|
|
39
|
+
next if entry.to_s =~ /^\./ || entry.to_s == "created.rid"
|
40
|
+
path = dir+entry
|
41
|
+
title = File.basename(entry).gsub(/\d+-/, "").gsub(/\..+?$/, "")
|
42
|
+
output << "<div class='docapi-section #{title.downcase}'>"
|
43
|
+
if path.directory?
|
44
|
+
output << "<h#{level}>#{title.capitalize}</h#{level}>"
|
45
|
+
output << convert_directory(path, level+1)
|
46
|
+
else
|
47
|
+
output << convert_file(path)
|
48
|
+
end
|
49
|
+
output << '</div>'
|
50
|
+
end
|
51
|
+
output.flatten
|
61
52
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
blocks << {:content => "", :language => language} if blocks.last.nil?
|
76
|
-
blocks.last[:content] << line
|
53
|
+
|
54
|
+
def convert_file(file)
|
55
|
+
case file.extname
|
56
|
+
when ".md"
|
57
|
+
Maruku.new( File.read(file) ).to_html
|
58
|
+
when ".rb"
|
59
|
+
process_file_sections(file, 'ruby', [/^=begin (.*)$/, /^=end$/])
|
60
|
+
when ".py"
|
61
|
+
process_file_sections(file, 'python', [/^''' (.*)$/, /^'''$/])
|
62
|
+
when ".sh"
|
63
|
+
process_file_sections(file, 'bash', [/^<<ENDCOMMENT >\/dev\/null$/, /^ENDCOMMENT$/])
|
64
|
+
when ".html"
|
65
|
+
File.read(file)
|
77
66
|
end
|
78
|
-
end
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
def process_file_sections(file, language, regexps)
|
71
|
+
blocks = []
|
72
|
+
output = ["<div class='docapi-subsection'><div class='docapi-title'>#{File.basename(file).gsub(/^\d+-/, "")}</div>"]
|
73
|
+
File.open(file, "r").each do |line|
|
74
|
+
if line =~ regexps.first
|
75
|
+
output << write_block(blocks.pop)
|
76
|
+
blocks << {:content => "", :language => ($1 || "markdown")}
|
77
|
+
elsif line =~ regexps.last
|
78
|
+
output << write_block(blocks.pop)
|
79
|
+
else
|
80
|
+
blocks << {:content => "", :language => language} if blocks.last.nil?
|
81
|
+
blocks.last[:content] << line
|
82
|
+
end
|
83
|
+
end
|
84
|
+
output << write_block(blocks.pop)
|
85
|
+
output << '</div>'
|
86
|
+
end
|
87
|
+
|
88
|
+
def write_block(block)
|
89
|
+
if block
|
90
|
+
case block[:language]
|
91
|
+
when "markdown", "text"
|
92
|
+
Maruku.new( block[:content] ).to_html.gsub(/<pre class='(.+?)'><code>(.*?)<\/code><\/pre>/m, '<pre><code class="\1">\2</code></pre>')
|
93
|
+
else
|
94
|
+
'<pre><code class="'+block[:language]+'">'+block[:content]+'</code></pre>'
|
95
|
+
end
|
90
96
|
end
|
91
97
|
end
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
old_stdout = $stdout
|
103
|
-
begin
|
104
|
-
# redirect stdout to the file
|
105
|
-
$stdout = rdoc_output
|
98
|
+
|
99
|
+
def generate(input_paths, output_path, options = {})
|
100
|
+
require 'rdoc/generator/docapi'
|
101
|
+
require 'tmpdir'
|
102
|
+
temporary_output_path = File.join(Dir.tmpdir, "docapi")
|
103
|
+
rdoc_options = %w{-f docapi --charset=UTF-8 -U --quiet -o}
|
104
|
+
rdoc_options << temporary_output_path
|
105
|
+
rdoc_options.concat input_paths
|
106
|
+
output_dir = Pathname.new(output_path || Pathname.getwd+"documentation")
|
107
|
+
raise ArgumentError, "Output directory '#{output_dir}' does not exist" unless output_dir.directory?
|
106
108
|
RDoc::RDoc.new.document(rdoc_options)
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
rdoc_output.close
|
113
|
-
date = documentation[/<tr><td>Modified:<\/td><td>(.*?)<\/td><\/tr>/, 1]
|
114
|
-
methods = documentation.split("<h4> method: ")
|
115
|
-
methods.shift
|
116
|
-
methods.map!{ |m|
|
117
|
-
["<div class='docapi-subsection'>", m.gsub(/<blockquote><pre>.*/m, "").gsub(/<a name="(.+?)">(.*?)<br \/>\s*?<\/a>/m, "<div class='docapi-title'><a name=\"\\1\">\\2<a></div>").gsub(/<h2>(.*?)<\/h2>/m, "<div class='docapi-subtitle'>\\1</div>").gsub(/<pre>(.*?)<\/pre>/m, "<pre><code>\\1</code></pre>"), "</div>"].join("")
|
118
|
-
}
|
119
|
-
|
120
|
-
File.open(File.join(output_dir.realpath, "documentation.html"), "w+") do |f|
|
121
|
-
# sort methods by :call-seq: length ASC. A bit dirty but...
|
122
|
-
methods.sort_by{|m| method = m[/<div class='docapi-title'><a name=".*?">(.+?)<a><\/div>/, 1].length rescue 0}.each{ |method| f << method }
|
109
|
+
documentation = YAML.load_file(File.join(temporary_output_path, "index.yaml"))
|
110
|
+
html = Haml::Engine.new(TEMPLATE, :ugly => true).render(Object.new, :methods => documentation["methods"], :options => options)
|
111
|
+
File.open(File.join(output_dir.realpath, "documentation.html"), "w+") do |f|
|
112
|
+
f << html.gsub(/<pre>(.*?)<\/pre>/im, '<pre><code>\1</code></pre>')
|
113
|
+
end
|
123
114
|
end
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
115
|
+
|
116
|
+
|
117
|
+
def header(options = {})
|
118
|
+
output = []
|
119
|
+
output << "<html><head><title>#{options[:title] || "Documentation"}</title>"
|
120
|
+
FILES_TO_INCLUDE[:javascripts].each do |file|
|
121
|
+
output << '<script type="text/javascript" src="'+file+'"></script>'
|
122
|
+
end
|
123
|
+
FILES_TO_INCLUDE[:stylesheets].each do |file|
|
124
|
+
output << '<link media="screen" type="text/css" href="'+file+'" rel="stylesheet"/>'
|
125
|
+
end
|
126
|
+
output << %Q{
|
127
|
+
<!--[if IE]>
|
128
|
+
<style type="text/css" media="screen">
|
129
|
+
body {padding-right: 320px}
|
130
|
+
</style>
|
131
|
+
<![endif]-->}
|
132
|
+
output << "</head><body>"
|
132
133
|
end
|
133
|
-
|
134
|
-
output
|
134
|
+
def footer
|
135
|
+
output = []
|
136
|
+
output << "<div id='generation-date'>Generated at: <span class='date'>#{Time.now.to_s}</span></div>"
|
137
|
+
output << "</body></html>"
|
135
138
|
end
|
136
|
-
|
137
|
-
<!--[if IE]>
|
138
|
-
<style type="text/css" media="screen">
|
139
|
-
body {padding-right: 320px}
|
140
|
-
</style>
|
141
|
-
<![endif]-->}
|
142
|
-
output << "</head><body>"
|
143
|
-
end
|
144
|
-
def footer
|
145
|
-
output = []
|
146
|
-
output << "<div id='generation-date'>Generated at: <span class='date'>#{Time.now.to_s}</span></div>"
|
147
|
-
output << "</body></html>"
|
139
|
+
|
148
140
|
end
|
149
|
-
|
150
141
|
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'rdoc', '>= 2.0.0'
|
3
|
+
|
4
|
+
require 'rdoc/rdoc' unless defined?( RDoc ) && defined?( RDoc::RDoc )
|
5
|
+
require 'rdoc/markup/to_html'
|
6
|
+
|
7
|
+
require 'pathname'
|
8
|
+
# require 'tempfile'
|
9
|
+
# require 'maruku'
|
10
|
+
require 'fileutils'
|
11
|
+
require 'haml'
|
12
|
+
|
13
|
+
|
14
|
+
module RDoc
|
15
|
+
module Generator
|
16
|
+
class Docapi
|
17
|
+
|
18
|
+
|
19
|
+
def self.for(options)
|
20
|
+
new(options)
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(options)
|
24
|
+
@options = options
|
25
|
+
|
26
|
+
# set up a hash to keep track of all the classes/modules we have processed
|
27
|
+
@already_processed = {}
|
28
|
+
|
29
|
+
# set up a hash to keep track of all of the objects to be output
|
30
|
+
@output = {
|
31
|
+
:files => [],
|
32
|
+
:classes => [],
|
33
|
+
:modules => [],
|
34
|
+
:attributes => [],
|
35
|
+
:methods => [],
|
36
|
+
:aliases => [],
|
37
|
+
:constants => [],
|
38
|
+
:requires => [],
|
39
|
+
:includes => []
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# Rdoc passes in TopLevel objects from the code_objects.rb tree (all files)
|
44
|
+
def generate(files)
|
45
|
+
# Each object passed in is a file, process it
|
46
|
+
files.each { |file| process_file(file) }
|
47
|
+
|
48
|
+
h = ::RDoc::Markup::ToHtml.new
|
49
|
+
|
50
|
+
yaml = YAML.dump({
|
51
|
+
"methods" => @output[:methods].map{|method|
|
52
|
+
next if method.visibility == :private
|
53
|
+
{
|
54
|
+
"name" => method.call_seq || method.name,
|
55
|
+
"comment" => method.comment,
|
56
|
+
"html_comment" => method.comment.nil? ? "" : h.convert(method.comment.gsub(/^#+ ?/, ''))
|
57
|
+
}
|
58
|
+
}.compact
|
59
|
+
})
|
60
|
+
|
61
|
+
puts yaml unless @options.quiet
|
62
|
+
File.open("index.yaml", "w+") do |f|
|
63
|
+
f << yaml
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
# process a file from the code_object.rb tree
|
70
|
+
def process_file(file)
|
71
|
+
@output[:files].push(file)
|
72
|
+
|
73
|
+
puts "#{file.comment}"
|
74
|
+
|
75
|
+
# Process all of the objects that this file contains
|
76
|
+
file.method_list.each { |child| process_method(child) }
|
77
|
+
file.aliases.each { |child| process_alias(child) }
|
78
|
+
file.constants.each { |child| process_constant(child) }
|
79
|
+
file.requires.each { |child| process_require(child) }
|
80
|
+
file.includes.each { |child| process_include(child) }
|
81
|
+
file.attributes.each { |child| process_attribute(child) }
|
82
|
+
|
83
|
+
# Recursively process contained subclasses and modules
|
84
|
+
file.each_classmodule do |child|
|
85
|
+
process_class_or_module(child)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# Process classes and modiles
|
90
|
+
def process_class_or_module(obj)
|
91
|
+
obj.class == Module ? type = :modules : type = :classes
|
92
|
+
|
93
|
+
# One important note about the code_objects.rb structure. A class or module
|
94
|
+
# definition can be spread a cross many files in Ruby so code_objects.rb handles
|
95
|
+
# this by keeping only *one* reference to each class or module that has a definition
|
96
|
+
# at the root level of a file (ie. not contained in another class or module).
|
97
|
+
# This means that when we are processing files we may run into the same class/module
|
98
|
+
# twice. So we need to keep track of what classes/modules we have
|
99
|
+
# already seen and make sure we don't create two INSERT statements for the same
|
100
|
+
# object.
|
101
|
+
if(!@already_processed.has_key?(obj.full_name)) then
|
102
|
+
@output[type].push(obj)
|
103
|
+
@already_processed[obj.full_name] = true
|
104
|
+
|
105
|
+
# Process all of the objects that this class or module contains
|
106
|
+
obj.method_list.each { |child| process_method(child) }
|
107
|
+
obj.aliases.each { |child| process_alias(child) }
|
108
|
+
obj.constants.each { |child| process_constant(child) }
|
109
|
+
obj.requires.each { |child| process_require(child) }
|
110
|
+
obj.includes.each { |child| process_include(child) }
|
111
|
+
obj.attributes.each { |child| process_attribute(child) }
|
112
|
+
end
|
113
|
+
|
114
|
+
id = @already_processed[obj.full_name]
|
115
|
+
# Recursively process contained subclasses and modules
|
116
|
+
obj.each_classmodule do |child|
|
117
|
+
process_class_or_module(child)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def process_method(obj)
|
122
|
+
@output[:methods].push(obj)
|
123
|
+
end
|
124
|
+
|
125
|
+
def process_alias(obj)
|
126
|
+
@output[:aliases].push(obj)
|
127
|
+
end
|
128
|
+
|
129
|
+
def process_constant(obj)
|
130
|
+
@output[:constants].push(obj)
|
131
|
+
end
|
132
|
+
|
133
|
+
def process_attribute(obj)
|
134
|
+
@output[:attributes].push(obj)
|
135
|
+
end
|
136
|
+
|
137
|
+
def process_require(obj)
|
138
|
+
@output[:requires].push(obj)
|
139
|
+
end
|
140
|
+
|
141
|
+
def process_include(obj)
|
142
|
+
@output[:includes].push(obj)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
RDoc::RDoc.add_generator RDoc::Generator::Docapi
|
data/test/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
|
2
|
+
namespace :test do
|
3
|
+
desc "Attempts to generate the list of methods"
|
4
|
+
task :generate do
|
5
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)+'/../lib'
|
6
|
+
require 'docapi'
|
7
|
+
require 'rdoc/generator/docapi'
|
8
|
+
Docapi::CLI.new.generate(["code/reference_api.rb"], "doc/2-documentation")
|
9
|
+
# RDoc::RDoc.new.document(["-f", "docapi", "-U", "-q", "-o", "doc/2-documentation", "code/reference_api.rb"])
|
10
|
+
end
|
11
|
+
|
12
|
+
desc "Attempts to merge"
|
13
|
+
task :merge => :generate do
|
14
|
+
$LOAD_PATH.unshift File.dirname(__FILE__)+'/../lib'
|
15
|
+
require 'docapi'
|
16
|
+
require 'rdoc/generator/docapi'
|
17
|
+
Docapi::CLI.new.merge("doc", "output", :title => "Reference API Documentation")
|
18
|
+
end
|
19
|
+
end
|
@@ -1,74 +1,13 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
<p>
|
9
|
-
Get a specific version of a Grid5000 resource.
|
10
|
-
</p>
|
11
|
-
<h2>URI parameters</h2>
|
12
|
-
<table>
|
13
|
-
<tr><td valign="top"><tt>grid5000-resource</tt>:</td><td>the URI of the grid5000 resource.
|
14
|
-
|
15
|
-
</td></tr>
|
16
|
-
</table>
|
17
|
-
<h2>Query parameters</h2>
|
18
|
-
<table>
|
19
|
-
<tr><td valign="top"><tt>version</tt>:</td><td>the requested version. It can be a version id (40 characters), or a UNIX
|
20
|
-
timestamp [default=empty (most recent version is used)].
|
21
|
-
|
22
|
-
</td></tr>
|
23
|
-
<tr><td valign="top"><tt>depth</tt>:</td><td>the number of nested sub-resources to resolve [default=1].
|
24
|
-
|
25
|
-
</td></tr>
|
26
|
-
<tr><td valign="top"><tt>resolve</tt>:</td><td>a list of comma separated sub-resources names to resolve (to be used with
|
27
|
-
the <tt>depth</tt> parameter) [default=all].
|
28
|
-
|
29
|
-
</td></tr>
|
30
|
-
</table>
|
31
|
-
<h2>Content-Types</h2>
|
32
|
-
<table>
|
33
|
-
<tr><td valign="top"><tt>application/json</tt>:</td><td>JSON
|
34
|
-
|
35
|
-
</td></tr>
|
36
|
-
<tr><td valign="top"><tt>application/xml</tt>:</td><td>XML
|
37
|
-
|
38
|
-
</td></tr>
|
39
|
-
<tr><td valign="top"><tt>application/zip</tt>:</td><td>the ZIP format will return a zip archive containing the set of directories
|
40
|
-
and files corresponding to the required data, with all its sub-resources.
|
41
|
-
|
42
|
-
</td></tr>
|
43
|
-
</table>
|
44
|
-
<h2>Status codes</h2>
|
45
|
-
<table>
|
46
|
-
<tr><td valign="top"><tt>200</tt>:</td><td>OK, the response contains the description of the resource as it was at the
|
47
|
-
requested version.
|
48
|
-
|
49
|
-
</td></tr>
|
50
|
-
<tr><td valign="top"><tt>404</tt>:</td><td>the requested grid5000 resource cannot be found, or the requested version
|
51
|
-
does not exist.
|
52
|
-
|
53
|
-
</td></tr>
|
54
|
-
<tr><td valign="top"><tt>406</tt>:</td><td>Returns 406 if the requested format is not available.
|
55
|
-
|
56
|
-
</td></tr>
|
57
|
-
</table>
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
</li><li>
|
62
|
-
|
63
|
-
<div class="synopsis"><a name="M000001">GET /:grid5000-resource/versions[.:format]<a></div>
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
1
|
+
<div class='docapi-subsection'>
|
2
|
+
<div class='docapi-title'>
|
3
|
+
<a name='GET-/:grid5000-resource/versions[.:format]'>GET /:grid5000-resource/versions[.:format]
|
4
|
+
</a>
|
5
|
+
</div>
|
6
|
+
<div class='docapi-content'>
|
68
7
|
<p>
|
69
8
|
Get the list of all versions of a particular resource.
|
70
9
|
</p>
|
71
|
-
<
|
10
|
+
<div class="docapi-subtitle">URI parameters</div>
|
72
11
|
<table>
|
73
12
|
<tr><td valign="top"><tt>grid5000-resource</tt>:</td><td>the URI of the grid5000 resource.
|
74
13
|
|
@@ -78,13 +17,13 @@ header in your HTTP request.
|
|
78
17
|
|
79
18
|
</td></tr>
|
80
19
|
</table>
|
81
|
-
<
|
20
|
+
<div class="docapi-subtitle">Query parameters</div>
|
82
21
|
<table>
|
83
22
|
<tr><td valign="top"><tt>limit</tt>:</td><td>maximum number of versions to return.
|
84
23
|
|
85
24
|
</td></tr>
|
86
25
|
</table>
|
87
|
-
<
|
26
|
+
<div class="docapi-subtitle">Content-Types</div>
|
88
27
|
<table>
|
89
28
|
<tr><td valign="top"><tt>application/json</tt>:</td><td>JSON
|
90
29
|
|
@@ -93,7 +32,7 @@ header in your HTTP request.
|
|
93
32
|
|
94
33
|
</td></tr>
|
95
34
|
</table>
|
96
|
-
<
|
35
|
+
<div class="docapi-subtitle">Status codes</div>
|
97
36
|
<table>
|
98
37
|
<tr><td valign="top"><tt>200</tt>:</td><td>OK, the response contains the list of the versions of the requested
|
99
38
|
grid5000 resource.
|
@@ -106,7 +45,7 @@ grid5000 resource.
|
|
106
45
|
|
107
46
|
</td></tr>
|
108
47
|
</table>
|
109
|
-
<
|
48
|
+
<div class="docapi-subtitle">Usage</div>
|
110
49
|
<p>
|
111
50
|
Get the 2 latest versions of the Rennes site:
|
112
51
|
</p>
|
@@ -137,50 +76,107 @@ Get the 2 latest versions of the Rennes site:
|
|
137
76
|
]
|
138
77
|
</code></pre>
|
139
78
|
|
79
|
+
</div>
|
80
|
+
</div>
|
81
|
+
<div class='docapi-subsection'>
|
82
|
+
<div class='docapi-title'>
|
83
|
+
<a name='GET-/:grid5000-resource/versions/:version[.:format]'>GET /:grid5000-resource/versions/:version[.:format]
|
84
|
+
</a>
|
85
|
+
</div>
|
86
|
+
<div class='docapi-content'>
|
87
|
+
<p>
|
88
|
+
Get info about a specific version.
|
89
|
+
</p>
|
90
|
+
<div class="docapi-subtitle">URI parameters</div>
|
91
|
+
<table>
|
92
|
+
<tr><td valign="top"><tt>grid5000-resource</tt>:</td><td>the URI of the grid5000 resource.
|
140
93
|
|
94
|
+
</td></tr>
|
95
|
+
<tr><td valign="top"><tt>version</tt>:</td><td>the version id (40 characters long) or a UNIX timestamp.
|
141
96
|
|
142
|
-
</
|
97
|
+
</td></tr>
|
98
|
+
</table>
|
99
|
+
<div class="docapi-subtitle">Content-Types</div>
|
100
|
+
<table>
|
101
|
+
<tr><td valign="top"><tt>application/json</tt>:</td><td>JSON
|
143
102
|
|
144
|
-
|
103
|
+
</td></tr>
|
104
|
+
<tr><td valign="top"><tt>application/xml</tt>:</td><td>XML
|
145
105
|
|
106
|
+
</td></tr>
|
107
|
+
</table>
|
108
|
+
<div class="docapi-subtitle">Status codes</div>
|
109
|
+
<table>
|
110
|
+
<tr><td valign="top"><tt>200</tt>:</td><td>OK.
|
146
111
|
|
112
|
+
</td></tr>
|
113
|
+
<tr><td valign="top"><tt>404</tt>:</td><td>the requested grid5000 resource cannot be found, or the requested version
|
114
|
+
does not exist.
|
115
|
+
|
116
|
+
</td></tr>
|
117
|
+
<tr><td valign="top"><tt>406</tt>:</td><td>the requested format is not available.
|
147
118
|
|
119
|
+
</td></tr>
|
120
|
+
</table>
|
148
121
|
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
<div class='docapi-subsection'>
|
125
|
+
<div class='docapi-title'>
|
126
|
+
<a name='GET-/:grid5000-resource[.:format]'>GET /:grid5000-resource[.:format]
|
127
|
+
</a>
|
128
|
+
</div>
|
129
|
+
<div class='docapi-content'>
|
149
130
|
<p>
|
150
|
-
Get
|
131
|
+
Get a specific version of a Grid5000 resource.
|
151
132
|
</p>
|
152
|
-
<
|
133
|
+
<div class="docapi-subtitle">URI parameters</div>
|
153
134
|
<table>
|
154
135
|
<tr><td valign="top"><tt>grid5000-resource</tt>:</td><td>the URI of the grid5000 resource.
|
155
136
|
|
156
137
|
</td></tr>
|
157
|
-
|
138
|
+
</table>
|
139
|
+
<div class="docapi-subtitle">Query parameters</div>
|
140
|
+
<table>
|
141
|
+
<tr><td valign="top"><tt>version</tt>:</td><td>the requested version. It can be a version id (40 characters), or a UNIX
|
142
|
+
timestamp [default=empty (most recent version is used)].
|
143
|
+
|
144
|
+
</td></tr>
|
145
|
+
<tr><td valign="top"><tt>depth</tt>:</td><td>the number of nested sub-resources to resolve [default=1].
|
146
|
+
|
147
|
+
</td></tr>
|
148
|
+
<tr><td valign="top"><tt>resolve</tt>:</td><td>a list of comma separated sub-resources names to resolve (to be used with
|
149
|
+
the <tt>depth</tt> parameter) [default=all].
|
158
150
|
|
159
151
|
</td></tr>
|
160
152
|
</table>
|
161
|
-
<
|
153
|
+
<div class="docapi-subtitle">Content-Types</div>
|
162
154
|
<table>
|
163
155
|
<tr><td valign="top"><tt>application/json</tt>:</td><td>JSON
|
164
156
|
|
165
157
|
</td></tr>
|
166
158
|
<tr><td valign="top"><tt>application/xml</tt>:</td><td>XML
|
167
159
|
|
160
|
+
</td></tr>
|
161
|
+
<tr><td valign="top"><tt>application/zip</tt>:</td><td>the ZIP format will return a zip archive containing the set of directories
|
162
|
+
and files corresponding to the required data, with all its sub-resources.
|
163
|
+
|
168
164
|
</td></tr>
|
169
165
|
</table>
|
170
|
-
<
|
166
|
+
<div class="docapi-subtitle">Status codes</div>
|
171
167
|
<table>
|
172
|
-
<tr><td valign="top"><tt>200</tt>:</td><td>OK
|
168
|
+
<tr><td valign="top"><tt>200</tt>:</td><td>OK, the response contains the description of the resource as it was at the
|
169
|
+
requested version.
|
173
170
|
|
174
171
|
</td></tr>
|
175
172
|
<tr><td valign="top"><tt>404</tt>:</td><td>the requested grid5000 resource cannot be found, or the requested version
|
176
173
|
does not exist.
|
177
174
|
|
178
175
|
</td></tr>
|
179
|
-
<tr><td valign="top"><tt>406</tt>:</td><td>the requested format is not available.
|
176
|
+
<tr><td valign="top"><tt>406</tt>:</td><td>Returns 406 if the requested format is not available.
|
180
177
|
|
181
178
|
</td></tr>
|
182
179
|
</table>
|
183
180
|
|
184
|
-
|
185
|
-
|
186
|
-
</li></ol>
|
181
|
+
</div>
|
182
|
+
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cyril Rohr
|
@@ -9,10 +9,19 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-03-15 00:00:00 +01:00
|
13
13
|
default_executable: docapi
|
14
|
-
dependencies:
|
15
|
-
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rdoc
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.0.0
|
24
|
+
version:
|
16
25
|
description: RDoc template for generating API documentation.
|
17
26
|
email: cyril.rohr@gmail.com
|
18
27
|
executables:
|
@@ -52,6 +61,8 @@ files:
|
|
52
61
|
- files/stylesheets/documentation/highlighter/zenburn.css
|
53
62
|
- files/stylesheets/documentation/layout.css
|
54
63
|
- lib/docapi.rb
|
64
|
+
- lib/rdoc/generator/docapi.rb
|
65
|
+
- test/Rakefile
|
55
66
|
- test/code/reference_api.rb
|
56
67
|
- test/doc/1-README.md
|
57
68
|
- test/doc/2-documentation/documentation.html
|