rain-doc 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 760f009f7d9d3a776da4498ff735ac00c1f806d1
4
- data.tar.gz: 8a4b8da84914e4ac4be50a986a05fb77112beae0
3
+ metadata.gz: 17f3f57b0db1830d87f264ed478993bddae46dbf
4
+ data.tar.gz: 76ae901bacabe4b66368d80b8923e05ff1082d73
5
5
  SHA512:
6
- metadata.gz: 0b42e4e5eb24008efe96f6953decd4d6aed4930a5c590f966c265676ab09005ead820eaada555d3df4a830431e59e28cb5faf52867c211e349a2689251c875d3
7
- data.tar.gz: f22e1e5e95284334181893eaed71dc1eae88413a27db44af9523e4ce623664541437bfee7103f8072e36699c2d6d62606c9db15494efd6efaa560b17d32e601b
6
+ metadata.gz: d1f10d35fc3cf4c1715e5178d2fd4dca41379a6b4c97fc501373902d8c9488c4acab9a2f7f0cf6a7c7b381fccff49a19bdb435f3d36323f810a9fa754494d436
7
+ data.tar.gz: b9d11ecabb6012c7ac888cdf837fabe96c3c80b0e95c7c93b45c1d5a6959c7ed36cfb9fb7db1690be9ef8e9f0ef1bf7784a6d7964961be23a4340b36475f29a3
@@ -103,7 +103,7 @@ module Rain
103
103
  if current_param.nil?
104
104
  self.params << {
105
105
  name: name,
106
- text: description,
106
+ text: [description],
107
107
  type: type,
108
108
  default: default
109
109
  }
@@ -133,7 +133,7 @@ module Rain
133
133
  if current_header.nil?
134
134
  self.headers << {
135
135
  name: name,
136
- text: description
136
+ text: [description]
137
137
  }
138
138
  else
139
139
  # otherwise append to the current header
@@ -6,6 +6,9 @@ require 'fileutils'
6
6
  class Rain::CLI < Thor
7
7
  @@docs = []
8
8
 
9
+ # loops through all of the specified source
10
+ # files, parses them line by line and produces
11
+ # doc and docpart output
9
12
  desc "generate [file/sources/**]", "Generates the rain documentation"
10
13
  method_option :log_parse, aliases: "--lp", desc: "Show the output of each line parse."
11
14
  method_option :parse_signatures, aliases: "--s", desc: "Parse method and class documentation too. Defaults to false."
@@ -23,6 +26,7 @@ class Rain::CLI < Thor
23
26
 
24
27
  print "\nBuilding html output... \n"
25
28
  build_html
29
+ print "\nDone! See rain_out/ directory for output.\n"
26
30
  end
27
31
 
28
32
  # define the ascii art for the help command
@@ -39,6 +43,9 @@ class Rain::CLI < Thor
39
43
  print " \n"
40
44
  print "basic usage:\n"
41
45
  print " rain generate file/**/*.rb\n"
46
+ print "options:\n"
47
+ print " --lp logs all line parsing output to console\n"
48
+ print " --s generates docs for methods and class signatures\n"
42
49
  end
43
50
 
44
51
  no_commands do
@@ -106,7 +113,7 @@ class Rain::CLI < Thor
106
113
  else
107
114
  nav[:navdoc][:parts] << {
108
115
  title: part[:route],
109
- url: "#{html_file_name}##{part[:route].gsub('/', '-').gsub(':', '')}"
116
+ url: "#{html_file_name}##{part[:http_method].downcase}#{part[:route].gsub('/', '-').gsub(':', '')}"
110
117
  }
111
118
  end
112
119
  end
@@ -0,0 +1,36 @@
1
+ hr {
2
+ width: 80%;
3
+ }
4
+ p {
5
+ font-size: 120%;
6
+ }
7
+
8
+ /* Styles for how the route & method display as well as their color. */
9
+ .route-outer {
10
+ width: 100%;
11
+ border: 1px solid #ccc;
12
+ border-radius: 5px;
13
+ margin: 20px 0;
14
+ }
15
+ .route-method {
16
+ display: inline-block;
17
+ font-weight: bold;
18
+ padding: 5px 10px;
19
+ color: white;
20
+ }
21
+ .route-path {
22
+ display: inline-block;
23
+ padding: 5px 10px;
24
+ }
25
+ .method-get, .method-head {
26
+ background-color: #009C5d;
27
+ }
28
+ .method-post {
29
+ background-color: #e58500;
30
+ }
31
+ .method-put, .method-patch {
32
+ background-color: #075494;
33
+ }
34
+ .method-delete {
35
+ background-color: #e54400;
36
+ }
@@ -1,21 +1,26 @@
1
- <!-- loop through all of the doc parts for the doc and render output -->
2
- <% parts.each do |part| %>
1
+ <!-- loop through all of the doc doc_parts for the doc and render output -->
2
+ <% parts.each do |doc_part| %>
3
3
 
4
4
  <!-- HTTP method and route (if both specified) -->
5
- <% if !part[:route].nil? && !part[:http_method].nil? %>
6
- <p id="<%= part[:route].gsub('/', '-').gsub(':', '') %>"><strong><%= part[:http_method] %></strong> <%= part[:route] %></p>
7
- <% elsif !part[:signature].nil? %>
8
- <p id="<%= part[:signature].gsub(' ', '-').gsub(',', '').gsub('(', '-').gsub(')', '-')[0..12] %>"><strong><%= part[:signature] %></strong></p>
5
+ <% if !doc_part[:route].nil? && !doc_part[:http_method].nil? %>
6
+ <div class="route-outer">
7
+ <div id="<%= doc_part[:route].gsub('/', '-').gsub(':', '') %>" class="route-method method-<%=doc_part[:http_method].downcase %>">
8
+ <%= doc_part[:http_method] %>
9
+ </div>
10
+ <div class="route-path"><%= doc_part[:route] %></div>
11
+ </div>
12
+ <% elsif !doc_part[:signature].nil? %>
13
+ <p id="<%= doc_part[:signature].gsub(' ', '-').gsub(',', '').gsub('(', '-').gsub(')', '-')[0..12] %>"><strong><%= doc_part[:signature] %></strong></p>
9
14
  <% end %>
10
15
 
11
- <!-- display all of the docs together for the part -->
12
- <p><% part[:doc].each do |doc| %>
13
- <%= doc %>
16
+ <!-- display all of the docs together for the doc_part -->
17
+ <p><% doc_part[:doc].each do |doc| %>
18
+ <%= doc %>&nbsp;
14
19
  <% end %></p>
15
20
 
16
21
  <!-- show all of the params in a table -->
17
- <% if part[:params].length > 0 %>
18
- <h4>Parameters</h4>
22
+ <% if doc_part[:params].length > 0 %>
23
+ <h5>Parameters</h5>
19
24
  <table class="u-full-width">
20
25
  <thead>
21
26
  <tr>
@@ -25,20 +30,20 @@
25
30
  <th>Description</th>
26
31
  </tr>
27
32
  </thead>
28
- <% part[:params].each do |param| %>
33
+ <% doc_part[:params].each do |param| %>
29
34
  <tr>
30
35
  <td><%= param[:name] %></td>
31
36
  <td><%= param[:type] %></td>
32
37
  <td><%= param[:default].nil? ? 'N/A' : param[:default] %></td>
33
- <td><%= param[:text] %></td>
38
+ <td><%= param[:text].join(' ') %></td>
34
39
  </tr>
35
40
  <% end %>
36
41
  </table>
37
42
  <% end %>
38
43
 
39
44
  <!-- show all of the headers in a table -->
40
- <% if part[:headers].length > 0 %>
41
- <h4>Headers</h4>
45
+ <% if doc_part[:headers].length > 0 %>
46
+ <h5>Headers</h5>
42
47
  <table class="u-full-width">
43
48
  <thead>
44
49
  <tr>
@@ -46,21 +51,22 @@
46
51
  <th>Description</th>
47
52
  </tr>
48
53
  </thead>
49
- <% part[:headers].each do |param| %>
54
+ <% doc_part[:headers].each do |param| %>
50
55
  <tr>
51
56
  <td><%= param[:name] %></td>
52
- <td><%= param[:text] %></td>
57
+ <td><%= param[:text].join(' ') %></td>
53
58
  </tr>
54
59
  <% end %>
55
60
  </table>
56
61
  <% end %>
57
62
 
58
63
  <!-- show all of the responses with examples -->
59
- <% if part[:responses].length > 0 %>
60
- <h4>Response Examples</h4>
61
- <% part[:responses].each do |response| %>
64
+ <% if doc_part[:responses].length > 0 %>
65
+ <h5>Response Examples</h5>
66
+ <% doc_part[:responses].each do |response| %>
62
67
  <p><strong><%= response[:code] %></strong> <%= response[:id].upcase %></p>
63
68
  <pre><code><%= response[:text].join("\n") %></code></pre>
64
69
  <% end %>
65
70
  <% end %>
71
+ <hr />
66
72
  <% end %>
@@ -3,6 +3,7 @@
3
3
  <title>Rain | <%= title %></title>
4
4
  <link rel="stylesheet" type="text/css" href="css/normalize.css" />
5
5
  <link rel="stylesheet" type="text/css" href="css/skeleton.css" />
6
+ <link rel="stylesheet" type="text/css" href="css/rain.css" />
6
7
  </head>
7
8
  <body>
8
9
  <div class="container">
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rain-doc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Brennan
@@ -72,6 +72,7 @@ files:
72
72
  - lib/parser.rb
73
73
  - lib/rain.rb
74
74
  - templates/css/normalize.css
75
+ - templates/css/rain.css
75
76
  - templates/css/skeleton.css
76
77
  - templates/doc.erb
77
78
  - templates/layout.erb