calamum 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -2
- data/lib/calamum/definition_parser.rb +4 -0
- data/lib/calamum/doc_generator.rb +3 -2
- data/lib/calamum/runner.rb +2 -1
- data/lib/calamum/templates/bootstrap/index.html.erb +18 -2
- data/lib/calamum/version.rb +1 -1
- data/sample/sample.yml +1 -0
- metadata +2 -2
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Calamum is a simple ruby build program to generate a REST API documentation from
|
|
8
8
|
|
9
9
|
### Gem Installation
|
10
10
|
|
11
|
-
Download and install
|
11
|
+
Download and install calamum with the following.
|
12
12
|
|
13
13
|
$gem install calamum
|
14
14
|
|
@@ -29,7 +29,11 @@ A simple example file 'sample.yml' in sample directory.
|
|
29
29
|
Next just run the calamum command as following:
|
30
30
|
|
31
31
|
$calamum -f my_api_definition.yml
|
32
|
+
|
33
|
+
To execute with the sample YAML file
|
34
|
+
|
35
|
+
$calamum -f sample/sample.yml
|
32
36
|
|
33
|
-
A "doc" directory is generated (by default in your home path,
|
37
|
+
A "doc" directory is generated with a index file that contain your API Documentation. (by default in your home path, you can specify the destination path with the option '-p/--path')
|
34
38
|
|
35
39
|
Open the index.html file in your browser to show your api doc.
|
@@ -1,13 +1,14 @@
|
|
1
1
|
|
2
2
|
class Calamum::DocGenerator
|
3
3
|
include ERB::Util
|
4
|
-
attr_accessor :resources, :
|
4
|
+
attr_accessor :resources, :template, :name, :url, :description
|
5
5
|
|
6
|
-
def initialize(template, resources, name, url)
|
6
|
+
def initialize(template, resources, name, url, descr)
|
7
7
|
@template = template
|
8
8
|
@resources = resources
|
9
9
|
@name = name
|
10
10
|
@url = url
|
11
|
+
@description = descr
|
11
12
|
end
|
12
13
|
|
13
14
|
def render()
|
data/lib/calamum/runner.rb
CHANGED
@@ -61,7 +61,8 @@ class Calamum::Runner
|
|
61
61
|
@definition = Calamum::DefinitionParser.new(api_definition)
|
62
62
|
@definition.load_requests
|
63
63
|
template = Calamum::DocGenerator.load_template
|
64
|
-
html_output = Calamum::DocGenerator.new(template,
|
64
|
+
html_output = Calamum::DocGenerator.new(template,
|
65
|
+
@definition.resources, @definition.get_name, @definition.get_url, @definition.get_description)
|
65
66
|
html_output.save_result(File.join(Calamum::Config[:path], 'doc', 'index.html'))
|
66
67
|
end
|
67
68
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<link href="./assets/stylesheets/main.css" rel="Stylesheet"/>
|
11
11
|
<script type="text/javascript" src="./assets/javascripts/jquery-1.7.2.min.js"></script>
|
12
12
|
<script type="text/javascript" src="./assets/javascripts/bootstrap.js"></script>
|
13
|
-
<title
|
13
|
+
<title><%= @name %> Rest API Doc</title>
|
14
14
|
</head>
|
15
15
|
|
16
16
|
<body data-spy="scroll" data-target=".bs-docs-sidebar">
|
@@ -24,8 +24,14 @@
|
|
24
24
|
<div class="row">
|
25
25
|
<div class="span3 bs-docs-sidebar">
|
26
26
|
<ul class="nav nav-list bs-docs-sidenav affix-top">
|
27
|
+
<% if description %>
|
28
|
+
<li class="active">
|
29
|
+
<a href="#overview">
|
30
|
+
<i class="icon-chevron-right"></i>Overview</a>
|
31
|
+
</li>
|
32
|
+
<% end %>
|
27
33
|
<% @resources.keys.each_with_index do |key,index| %>
|
28
|
-
<li class="<%= index == 0 ? 'active': '' %>">
|
34
|
+
<li class="<%= !description && (index == 0) ? 'active': '' %>">
|
29
35
|
<a href="#<%= key %>_section">
|
30
36
|
<i class="icon-chevron-right"></i><%= key %></a>
|
31
37
|
</li>
|
@@ -33,6 +39,16 @@
|
|
33
39
|
</ul>
|
34
40
|
</div>
|
35
41
|
<div class="span9">
|
42
|
+
<% if description %>
|
43
|
+
<section id="overview">
|
44
|
+
<div class="page-header">
|
45
|
+
<h2>Overview</h2>
|
46
|
+
</div>
|
47
|
+
<div id="overview-body">
|
48
|
+
<%= description %>
|
49
|
+
</div>
|
50
|
+
</section>
|
51
|
+
<% end %>
|
36
52
|
<% @resources.each do |name, requests| %>
|
37
53
|
<section id="<%= name %>_section">
|
38
54
|
<div class="page-header">
|
data/lib/calamum/version.rb
CHANGED
data/sample/sample.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calamum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-04-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|