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 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 rake with the following.
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, to change it specify the option '-p/--path') with a index file that contain your API Documentation.
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.
@@ -19,6 +19,10 @@ class Calamum::DefinitionParser
19
19
  @definition['url']
20
20
  end
21
21
 
22
+ def get_description
23
+ @definition['description']
24
+ end
25
+
22
26
  def get_resources_names
23
27
  @definition['resources'].inject([]){|resources, (key, content)| resources << key}
24
28
  end
@@ -1,13 +1,14 @@
1
1
 
2
2
  class Calamum::DocGenerator
3
3
  include ERB::Util
4
- attr_accessor :resources, :templaete, :name, :url
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()
@@ -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, @definition.resources, @definition.get_name, @definition.get_url)
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>Rails Api Doc</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">
@@ -1,3 +1,3 @@
1
1
  module Calamum
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
data/sample/sample.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  name: 'Calamum'
2
2
  url: 'http://calamum-sample:3000/api'
3
+ description: 'Calamum is a simple ruby build program to generate a REST API documentation from a YAML file definition'
3
4
  resources:
4
5
  user:
5
6
  -
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.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-03-09 00:00:00.000000000 Z
12
+ date: 2013-04-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel