calamum 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmFkMDE0YWU2M2NhZGYyNjk1MjZjYmFlZjlhNzI3ZTZhZGRkYjdmOQ==
4
+ NTNmOTAzNzRjNmU2NGE3ZDQxNjFmMGQyMmNkYWI1NDBkNWQ4NDE1Mg==
5
5
  data.tar.gz: !binary |-
6
- ZjlhZmIwY2UzZTdjMTA0MmZiYmNkMDFjNTk1MzM4MTAxODgzNjc4Ng==
6
+ ZGM2NmUzY2NhYmZlNmExNmM5ZDFmZmUyYzY1ZDJiYjhjNTM3YjI4Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTk4ZTY2NjVhODBkZjc5NTlkYTEyOWM2Zjk4N2NjZjg1ZmVhZDZjMmYxNjUz
10
- ZDhjMzA1NTZiYzM1NTkyMGM2MTc1ODgxMWYzNGUwYWMzNThkN2NmY2FiNmY2
11
- YTgwZDcwNjU5ZTdlYmIxNDJhY2FhNjg2OTBiOTlmNzRjZTEzMjY=
9
+ MmNhZTk2Mzc1MDdmNDNkOGZkNTUxMWRjMTY0YTlhYjcwMGU4YmYzMjhkMzM4
10
+ ZjY4YTkyOGZkNDJjYzBhMGI4OWRiOTAzNDM4OTNjMzI5NWYwMjc4MjczNTRk
11
+ NGY2ZDJjZTY3NTE2ODI0ZjU5NmYxOTY3YzQ4NjI1YjdjY2MzNDk=
12
12
  data.tar.gz: !binary |-
13
- MjVmYjA3MDdiZjFiMjkxZWJiMTlkMmUxNTdiZGY4NGU1NTAxMTk2OWYyNTYy
14
- ZGY5ZTEyYzZmYmZlNjgzNDM5N2ZhNzBiY2FhYjgzOWI5M2I5ZDEzM2FhOWZk
15
- Zjk5YTczODVkMWZiODJkM2U1MGE3YmY1MzA3ODE3YzQ0NmQwN2U=
13
+ OWI3MGQ5YWQ0ZDc1ZjljZThlY2Q5M2RlZmJmNmU1ZDUzNzJmZjllODk3Njc3
14
+ MWNhZjY5OWU5ZGQ0YmY3NGUyNWUxMWFjN2U1ZjA4YzZmMjhhMGUyZjFmZDM3
15
+ NGRkNjFhNWU0YmMxYzcyNDZmNWYyYWZlYjE2YjhjZDEzZWQ0Yzk=
data/bin/calamum CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # Calamum is a simple REST API documentation generator.
4
4
  # This is a fork, that allows you to work with JSON format.
5
- $: << File.join(File.dirname(__FILE__), '..', 'lib')
5
+ $LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib')
6
6
 
7
7
  require 'rubygems'
8
8
  require 'calamum/runner'
@@ -1,4 +1,3 @@
1
- # require 'calamum'
2
1
  require 'mixlib/config'
3
2
 
4
3
  # Provides a class-based configuration object.
@@ -14,8 +13,11 @@ class Calamum::Config
14
13
  merge!(config)
15
14
 
16
15
  self.doc_path = File.join(config[:path], 'docs')
17
- self.tpl_path = File.join(File.dirname(__FILE__), 'templates', config[:template])
18
- raise "Unknown template #{config[:template]}" unless Calamum::VALID_TEMPLATES.include?(config[:template])
16
+ self.tpl_path = File.join(File.dirname(__FILE__),
17
+ 'templates',
18
+ config[:template])
19
+ unless Calamum::VALID_TEMPLATES.include?(config[:template])
20
+ fail "Unknown template #{config[:template]}"
21
+ end
19
22
  end
20
-
21
23
  end
@@ -18,10 +18,18 @@ class Calamum::DocParser
18
18
  @definition['version']
19
19
  end
20
20
 
21
+ def get_authentication
22
+ @definition['authentication']
23
+ end
24
+
21
25
  def get_description
22
26
  @definition['description']
23
27
  end
24
28
 
29
+ def get_errors
30
+ @definition['errors']
31
+ end
32
+
25
33
  def get_resources
26
34
  resources = @definition['resources'].kind_of?(String) ? get_seperate_resources : @definition['resources']
27
35
  Calamum::Config[:sort]? resources.sort : resources
@@ -66,7 +66,13 @@ class Calamum::Runner
66
66
  @definition.load_resources
67
67
  Calamum::DocGenerator.init_base_dir
68
68
  process_index
69
- process_pages if config[:template] == 'twitter'
69
+
70
+ if config[:template] == 'twitter'
71
+ process_pages
72
+ process_section("overview", @definition.get_description)
73
+ process_section("authentication", @definition.get_authentication)
74
+ process_errors
75
+ end
70
76
  rescue => ex
71
77
  puts_error ex.message
72
78
  end
@@ -97,6 +103,28 @@ class Calamum::Runner
97
103
  page.save_template('index.html', bindings)
98
104
  end
99
105
 
106
+ # Bind values to overview and authentication pages and save them.
107
+ def process_section(section, content)
108
+ bindings = {
109
+ :section => section,
110
+ :name => @definition.get_name,
111
+ :version => @definition.get_version,
112
+ :description => content,
113
+ }
114
+ page = Calamum::DocGenerator.new(:section)
115
+ page.save_template("#{section}.html", bindings)
116
+ end
117
+
118
+ def process_errors
119
+ bindings = {
120
+ :name => @definition.get_name,
121
+ :version => @definition.get_version,
122
+ :errors => @definition.get_errors,
123
+ }
124
+ page = Calamum::DocGenerator.new(:errors)
125
+ page.save_template("errors.html", bindings)
126
+ end
127
+
100
128
  # Bind values to view pages and save them.
101
129
  def process_pages
102
130
  bindings = {
@@ -0,0 +1,100 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Developers API</title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
+ <link type="text/css" rel="stylesheet" href="assets/css/main.css" />
7
+ </head>
8
+ <body class="no-sidebars">
9
+ <div id="page">
10
+ <div id="header-outer">
11
+ <div id="header">
12
+ <a href="/" id="logo" title="Home"><%= @name %></a>
13
+
14
+ <ul id="title-nav">
15
+ <li><a href="overview.html">Overview</a></li>
16
+ <li><a href="authentication.html">Authentication</a></li>
17
+ <li><a href="index.html">Resources</a></li>
18
+ <li><a href="errors.html">Errors</a></li>
19
+ </ul>
20
+ </div>
21
+ </div>
22
+
23
+ <div id="content-outer">
24
+ <h1>Error Codes</h1>
25
+ <% unless @errors.nil? %>
26
+ <div class="content api-docs">
27
+ <% unless @errors['http_errors'].empty? %>
28
+ <table>
29
+ <caption>
30
+ <strong> HTTP Status Codes</strong>
31
+ <p>The API attempts to return appropriate
32
+ <a rel="nofollow" href="http://en.wikipedia.org/wiki/List_of_HTTP_status_codes" class="ext" target="_blank">
33
+ HTTP status codes
34
+ </a>for every request.<p>
35
+ </caption>
36
+ <thead>
37
+ <tr>
38
+ <th class="views-field-title">Code</th>
39
+ <th class="views-field-title">Text</th>
40
+ <th class="views-field-title">Description</th>
41
+ </tr>
42
+ </thead>
43
+ <tbody>
44
+ <% @errors['http_errors'].each do |error| %>
45
+ <tr>
46
+ <td class="">
47
+ <%= error['code'] %>
48
+ </td>
49
+ <td class="views-field">
50
+ <%= error['text'] %>
51
+ </td>
52
+ <td class="views-field">
53
+ <%= error['description'] %>
54
+ </td>
55
+ </tr>
56
+ <% end %>
57
+ </tbody>
58
+ </table>
59
+ <% end %>
60
+ <% unless @errors['api_errors'].empty? %>
61
+ <table>
62
+ <caption>
63
+ <strong> API Status Codes</strong>
64
+ <p> Description of the Api specific errors codes.
65
+ </caption>
66
+ <thead>
67
+ <tr>
68
+ <th class="views-field-title">Code</th>
69
+ <th class="views-field-title">Text</th>
70
+ <th class="views-field-title">Description</th>
71
+ </tr>
72
+ </thead>
73
+ <tbody>
74
+ <% @errors['api_errors'].each do |error| %>
75
+ <tr>
76
+ <td class="">
77
+ <%= error['code'] %>
78
+ </td>
79
+ <td class="views-field">
80
+ <%= error['text'] %>
81
+ </td>
82
+ <td class="views-field">
83
+ <%= error['description'] %>
84
+ </td>
85
+ </tr>
86
+ <% end %>
87
+ </tbody>
88
+ </table>
89
+ <% end %>
90
+ </div>
91
+ <% end %>
92
+ </div>
93
+
94
+ <div id="footer-outer">
95
+ <div id="footer"><%= @name %> &copy; 2013</div>
96
+ </div>
97
+
98
+ </div>
99
+ </body>
100
+ </html>
@@ -7,7 +7,6 @@
7
7
  </head>
8
8
  <body class="no-sidebars">
9
9
  <div id="page">
10
-
11
10
  <div id="header-outer">
12
11
  <div id="header">
13
12
  <a href="/" id="logo" title="Home"><%= @name %></a>
@@ -15,7 +14,6 @@
15
14
  <ul id="title-nav">
16
15
  <li><a href="overview.html">Overview</a></li>
17
16
  <li><a href="authentication.html">Authentication</a></li>
18
- <li><a href="entities.html">Entities</a></li>
19
17
  <li><a href="index.html">Resources</a></li>
20
18
  <li><a href="errors.html">Errors</a></li>
21
19
  </ul>
@@ -0,0 +1,36 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>Developers API</title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
+ <link type="text/css" rel="stylesheet" href="assets/css/main.css" />
7
+ </head>
8
+ <body class="no-sidebars">
9
+ <div id="page">
10
+
11
+ <div id="header-outer">
12
+ <div id="header">
13
+ <a href="/" id="logo" title="Home"><%= @name %></a>
14
+
15
+ <ul id="title-nav">
16
+ <li><a href="overview.html">Overview</a></li>
17
+ <li><a href="authentication.html">Authentication</a></li>
18
+ <li><a href="index.html">Resources</a></li>
19
+ <li><a href="errors.html">Errors</a></li>
20
+ </ul>
21
+ </div>
22
+ </div>
23
+
24
+ <div id="content-outer">
25
+ <h1><%= @section.capitalize %></h1>
26
+ <div class="content api-docs">
27
+ <%= @description %>
28
+ </div>
29
+ </div>
30
+
31
+ <div id="footer-outer">
32
+ <div id="footer"><%= @name %> &copy; 2013</div>
33
+ </div>
34
+ </div>
35
+ </body>
36
+ </html>
@@ -15,7 +15,6 @@
15
15
  <ul id="title-nav">
16
16
  <li><a href="overview.html">Overview</a></li>
17
17
  <li><a href="authentication.html">Authentication</a></li>
18
- <li><a href="entities.html">Entities</a></li>
19
18
  <li><a href="index.html">Resources</a></li>
20
19
  <li><a href="errors.html">Errors</a></li>
21
20
  </ul>
@@ -1,3 +1,3 @@
1
1
  module Calamum
2
- VERSION = '1.2.0'
2
+ VERSION = '1.2.1'
3
3
  end
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.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Y.
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-26 00:00:00.000000000 Z
12
+ date: 2014-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yajl-ruby
@@ -54,7 +54,7 @@ dependencies:
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
- name: rspec
57
+ name: rake
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - ! '>='
@@ -67,6 +67,20 @@ dependencies:
67
67
  - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rspec
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 3.0.0
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ~>
82
+ - !ruby/object:Gem::Version
83
+ version: 3.0.0
70
84
  - !ruby/object:Gem::Dependency
71
85
  name: rspec-its
72
86
  requirement: !ruby/object:Gem::Requirement
@@ -81,6 +95,48 @@ dependencies:
81
95
  - - ! '>='
82
96
  - !ruby/object:Gem::Version
83
97
  version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: bundler
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ! '>='
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rainbow
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - '='
117
+ - !ruby/object:Gem::Version
118
+ version: 1.1.4
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - '='
124
+ - !ruby/object:Gem::Version
125
+ version: 1.1.4
126
+ - !ruby/object:Gem::Dependency
127
+ name: rubocop
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ~>
131
+ - !ruby/object:Gem::Version
132
+ version: 0.15.0
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ~>
138
+ - !ruby/object:Gem::Version
139
+ version: 0.15.0
84
140
  description:
85
141
  email:
86
142
  - lachheb.mehrez@gmail.com
@@ -112,7 +168,9 @@ files:
112
168
  - lib/calamum/templates/twitter/assets/css/main.css
113
169
  - lib/calamum/templates/twitter/assets/javascripts/bootstrap.js
114
170
  - lib/calamum/templates/twitter/assets/javascripts/jquery-1.7.2.min.js
171
+ - lib/calamum/templates/twitter/errors.html.erb
115
172
  - lib/calamum/templates/twitter/index.html.erb
173
+ - lib/calamum/templates/twitter/section.html.erb
116
174
  - lib/calamum/templates/twitter/view.html.erb
117
175
  - lib/calamum/version.rb
118
176
  homepage: https://github.com/malachheb/calamum
@@ -140,3 +198,4 @@ signing_key:
140
198
  specification_version: 4
141
199
  summary: REST API documentation generator
142
200
  test_files: []
201
+ has_rdoc: