rocket_docs 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/layouts/rocket_docs/_api_description.slim +10 -0
- data/app/views/layouts/rocket_docs/_navigation.slim +1 -1
- data/app/views/layouts/rocket_docs/application.slim +2 -1
- data/lib/rocket_docs/documentation/action.rb +1 -1
- data/lib/rocket_docs/engine.rb +9 -0
- data/lib/rocket_docs/version.rb +1 -1
- data/lib/rocket_docs.rb +32 -15
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4587cecf96880c211a54e3bbe066b57cf19f12e6
|
4
|
+
data.tar.gz: 7d1488f04217d661c268ec77899089ce69f2e9c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ba39b697e13acb1f4d41427b09223be2aec3dff9f2dab7b843e20ecf59ebb1da47015b18594d68db7f1ddccbc361f0021bd620c747eaab6448953f6f9816197
|
7
|
+
data.tar.gz: 5c5c90a1b6dc45c06d8c4fb71ff42067097d9c2fbf57c16728081725905f5d25363854b86949c8045380be7b91733dce35ee950bbadbfb2f2c8a861de26750ac
|
@@ -0,0 +1,10 @@
|
|
1
|
+
- if RocketDocs.description
|
2
|
+
.panel-group id="rocket_docs_documentation_description_group"
|
3
|
+
.panel.panel-default
|
4
|
+
.panel-heading
|
5
|
+
h4.panel-title
|
6
|
+
= link_to 'Description', "#rocket_docs_documentation_description", data: { toggle: 'collapse' }
|
7
|
+
.panel-collapse.collapse id='rocket_docs_documentation_description'
|
8
|
+
.panel-body
|
9
|
+
.panel-group id="rocket_docs_documentation_description_accordion"
|
10
|
+
= RocketDocs.format_string(RocketDocs.description)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
.navbar.navbar-default.navbar-fixed-top
|
3
3
|
.container-fluid
|
4
4
|
.navbar-header
|
5
|
-
= link_to
|
5
|
+
= link_to RocketDocs.title, rocket_docs.root_path, class: 'navbar-brand'
|
6
6
|
.collapse.navbar-collapse
|
7
7
|
ul.nav.navbar-nav
|
8
8
|
li = link_to 'All versions', rocket_docs.root_path
|
@@ -1,9 +1,10 @@
|
|
1
1
|
head
|
2
|
-
title RocketDocs
|
2
|
+
title = RocketDocs.title
|
3
3
|
= stylesheet_link_tag "rocket_docs/application", media: "all"
|
4
4
|
= javascript_include_tag "rocket_docs/application"
|
5
5
|
body
|
6
6
|
= render 'layouts/rocket_docs/navigation'
|
7
7
|
.container
|
8
|
+
= render 'layouts/rocket_docs/api_description'
|
8
9
|
= yield
|
9
10
|
= render 'layouts/rocket_docs/modal'
|
@@ -23,7 +23,7 @@ module RocketDocs
|
|
23
23
|
|
24
24
|
def description(method = default_method)
|
25
25
|
desc = (@doc[method] && @doc[method]['DOC']) || @doc['DOC']
|
26
|
-
|
26
|
+
RocketDocs.format_string(desc)
|
27
27
|
end
|
28
28
|
|
29
29
|
def params(method = default_method)
|
data/lib/rocket_docs/engine.rb
CHANGED
data/lib/rocket_docs/version.rb
CHANGED
data/lib/rocket_docs.rb
CHANGED
@@ -6,24 +6,41 @@ require 'rocket_docs/parser'
|
|
6
6
|
require 'rocket_docs/documentation'
|
7
7
|
|
8
8
|
module RocketDocs
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
class << self
|
10
|
+
attr_accessor :url
|
11
|
+
attr_accessor :title
|
12
|
+
attr_accessor :description
|
13
|
+
|
14
|
+
def config(&block)
|
15
|
+
block.call(self)
|
12
16
|
end
|
13
|
-
end
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
def documentation
|
19
|
+
Router.api_full.map do |version, controller|
|
20
|
+
Documentation.new(version, controller)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def documentation_for_version(version)
|
25
|
+
Documentation.new(version.to_i, Router.api_full[version.to_i])
|
26
|
+
end
|
27
|
+
|
28
|
+
def documentation_for_files(files, version_name = 'Unknown')
|
29
|
+
fake_controlers = files.map do |file|
|
30
|
+
fake_controller = {
|
31
|
+
path: file,
|
32
|
+
actions: Hash[
|
33
|
+
Parser.method_comments(file).keys.map { |m, _c| [m, []] }
|
34
|
+
]
|
35
|
+
}
|
36
|
+
[File.basename(file, '.rb'), fake_controller]
|
37
|
+
end
|
38
|
+
Documentation.new(version_name, Hash[fake_controlers])
|
39
|
+
end
|
18
40
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
path: file,
|
23
|
-
actions: Hash[Parser.method_comments(file).keys.map { |m, _c| [m, []] }]
|
24
|
-
}
|
25
|
-
[File.basename(file, '.rb'), fake_controller]
|
41
|
+
def format_string(string)
|
42
|
+
return unless string
|
43
|
+
CGI.escapeHTML(string).gsub("\n", '<br>').html_safe
|
26
44
|
end
|
27
|
-
Documentation.new(version_name, Hash[fake_controlers])
|
28
45
|
end
|
29
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocket_docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanko Krtalić Rusendić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -258,6 +258,7 @@ files:
|
|
258
258
|
- app/views/docs/rocket_docs/index.slim
|
259
259
|
- app/views/docs/rocket_docs/show.markdown.erb
|
260
260
|
- app/views/docs/rocket_docs/show.slim
|
261
|
+
- app/views/layouts/rocket_docs/_api_description.slim
|
261
262
|
- app/views/layouts/rocket_docs/_modal.slim
|
262
263
|
- app/views/layouts/rocket_docs/_navigation.slim
|
263
264
|
- app/views/layouts/rocket_docs/application.slim
|