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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 32c39440dae0113b812390a602c5da058815b478
4
- data.tar.gz: e3ff07453b005d8a134b70a07e4893e25a72920a
3
+ metadata.gz: 4587cecf96880c211a54e3bbe066b57cf19f12e6
4
+ data.tar.gz: 7d1488f04217d661c268ec77899089ce69f2e9c5
5
5
  SHA512:
6
- metadata.gz: d58b04d62b3a5fd2498c5e5fbbe7b63f1231acc35c5751ee90ee19f7df33b930db39d35872726fdf71dce214c264efb6dd49c017fc640ce0809ecf14168a2e77
7
- data.tar.gz: 64bbe547bcc27b02fa786f752daa759555c9a23adf54e8a99d638dddd630a675e6f38a4f0adb9294ec365b03138e9fc3101206a56333e622541d98c71e103ee5
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 'Documentation', rocket_docs.root_path, class: 'navbar-brand'
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
- desc && CGI.escapeHTML(desc).gsub("\n", '<br>').html_safe
26
+ RocketDocs.format_string(desc)
27
27
  end
28
28
 
29
29
  def params(method = default_method)
@@ -8,5 +8,14 @@ module RocketDocs
8
8
  g.test_framework :rspec
9
9
  g.fixture_replacement :factory_girl, dir: 'spec/factories'
10
10
  end
11
+
12
+ class << self
13
+ def setup(&block)
14
+ block.call(RocketDocs)
15
+ {
16
+ self => RocketDocs.url
17
+ }
18
+ end
19
+ end
11
20
  end
12
21
  end
@@ -1,3 +1,3 @@
1
1
  module RocketDocs
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
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
- def self.documentation
10
- Router.api_full.map do |version, controller|
11
- Documentation.new(version, controller)
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
- def self.documentation_for_version(version)
16
- Documentation.new(version, Router.api_full[version])
17
- end
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
- def self.documentation_for_files(files, version_name = 'Unknown')
20
- fake_controlers = files.map do |file|
21
- fake_controller = {
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.7
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-18 00:00:00.000000000 Z
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