documentarian 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/app/assets/javascripts/documentarian/application.js +14 -0
- data/app/assets/stylesheets/documentarian/application.scss +506 -0
- data/app/controllers/documentarian/application_controller.rb +9 -0
- data/app/controllers/documentarian/documentation_controller.rb +18 -0
- data/app/helpers/documentarian/application_helper.rb +4 -0
- data/app/views/documentarian/application/_navigation.html.haml +4 -0
- data/app/views/documentarian/application/_navigation_item.html.haml +9 -0
- data/app/views/documentarian/documentation/index.html.haml +0 -0
- data/app/views/documentarian/documentation/show.html.haml +5 -0
- data/app/views/layouts/documentarian/application.html.haml +20 -0
- data/config/routes.rb +5 -0
- data/lib/documentarian/asset_proxy.rb +7 -0
- data/lib/documentarian/engine.rb +5 -0
- data/lib/documentarian/navigation.rb +5 -0
- data/lib/documentarian/resource.rb +76 -0
- data/lib/documentarian.rb +46 -0
- data/lib/tasks/documentarian.rake +0 -0
- metadata +73 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ODgzMmM2ZjVjNjRhMzE1MGYzYmQ4MjFmNzcxYzlmMDc0YjcyODI3OQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NGZhOTdjZTk3NzkxZGViYzIxOWM1ODU3ZDlmMGUwYmM1ZTkzZmQwZA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NmU0MmM3YzRmNjgzYzE2MzcyZWRiMTM5MDZkMjdmOTcyNDRkYWE5NjQzMzY2
|
10
|
+
NmRiNTZhOGY3ZDQ3MmRiNzZlZWRhNDE3YzIxNjBhYzA0MmFkNDhiOGVmYzIy
|
11
|
+
NDAzYmMxNzY0NTBmNWU0ZjU5M2IzZTRlOGYzZmM2M2ZjZjAxYTk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTU2MTllZjM4MDJkN2M2MjIzYTEzMWNlOTFhY2NiNzRlOWNmYjk4YTVmMzRl
|
14
|
+
MTg3MzkyODZmZGZlNDhmY2E3YmVhYmZmM2MwY2Y0ODQ4MGExNjE4YzFmNTBk
|
15
|
+
NTk4MTI1YjA5YWNmN2U4MmM5YTVlODQ1YjA5NDRjYWUwNDIzNjc=
|
@@ -0,0 +1,14 @@
|
|
1
|
+
$(document).ready(function() {
|
2
|
+
$('pre').each(function(i, el) {
|
3
|
+
var lang = $(el).attr('lang')
|
4
|
+
if (lang) {
|
5
|
+
$(el).children('code').addClass($(el).attr('lang'));
|
6
|
+
} else {
|
7
|
+
$(el).children('code').addClass($(el).attr('nohighlight'));
|
8
|
+
}
|
9
|
+
})
|
10
|
+
|
11
|
+
$('pre[lang] > code').each(function(i, block) {
|
12
|
+
hljs.highlightBlock(block);
|
13
|
+
});
|
14
|
+
});
|
@@ -0,0 +1,506 @@
|
|
1
|
+
html, body {
|
2
|
+
padding: 0;
|
3
|
+
margin: 0;
|
4
|
+
height: 100%;
|
5
|
+
width: 100%;
|
6
|
+
}
|
7
|
+
.clear {
|
8
|
+
clear: both;
|
9
|
+
}
|
10
|
+
|
11
|
+
#document-content {
|
12
|
+
clear: left;
|
13
|
+
float: left;
|
14
|
+
width: 100%;
|
15
|
+
overflow: hidden;
|
16
|
+
}
|
17
|
+
#navigation-content {
|
18
|
+
float: left;
|
19
|
+
width: 100%;
|
20
|
+
position: relative;
|
21
|
+
right: 80%;
|
22
|
+
background-color: #efefef;
|
23
|
+
}
|
24
|
+
#navigation {
|
25
|
+
float: left;
|
26
|
+
width: 20%;
|
27
|
+
position: relative;
|
28
|
+
left: 80%;
|
29
|
+
overflow: hidden;
|
30
|
+
}
|
31
|
+
#document {
|
32
|
+
float: left;
|
33
|
+
width: 80%;
|
34
|
+
position: relative;
|
35
|
+
left: 80%;
|
36
|
+
overflow: hidden;
|
37
|
+
}
|
38
|
+
|
39
|
+
|
40
|
+
#content {
|
41
|
+
width:100%;
|
42
|
+
}
|
43
|
+
#navigation {
|
44
|
+
width:20%;
|
45
|
+
float: left;
|
46
|
+
ul {
|
47
|
+
list-style: none;
|
48
|
+
width:100%;
|
49
|
+
margin: 0;
|
50
|
+
padding: 0;
|
51
|
+
li {
|
52
|
+
span {
|
53
|
+
display: block;
|
54
|
+
padding: 10px 15px;
|
55
|
+
a {
|
56
|
+
text-decoration: none;
|
57
|
+
color: #43B4DD;
|
58
|
+
}
|
59
|
+
&.active {
|
60
|
+
border-left: 5px solid #43B4DD;
|
61
|
+
a {
|
62
|
+
font-weight: bold;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
> ul {
|
67
|
+
display: none;
|
68
|
+
}
|
69
|
+
&.show {
|
70
|
+
> ul {
|
71
|
+
display: block;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
}
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
#document {
|
79
|
+
padding: 20px;
|
80
|
+
float: left;
|
81
|
+
border-radius: 5px;
|
82
|
+
width: 75%;
|
83
|
+
overflow:hidden;
|
84
|
+
font-family:"Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif;
|
85
|
+
font-size:16px;
|
86
|
+
line-height:1.6;
|
87
|
+
word-wrap:break-word
|
88
|
+
}
|
89
|
+
#document>*:first-child {
|
90
|
+
margin-top:0 !important
|
91
|
+
}
|
92
|
+
#document>*:last-child {
|
93
|
+
margin-bottom:0 !important
|
94
|
+
}
|
95
|
+
#document a {
|
96
|
+
color: #43B4DD;
|
97
|
+
}
|
98
|
+
#document a:visited {
|
99
|
+
color: #43B4DD;
|
100
|
+
}
|
101
|
+
#document a:not([href]) {
|
102
|
+
color:inherit;
|
103
|
+
text-decoration:none
|
104
|
+
}
|
105
|
+
#document a[name] {
|
106
|
+
color:inherit;
|
107
|
+
text-decoration:none
|
108
|
+
}
|
109
|
+
#document h1,
|
110
|
+
#document h2,
|
111
|
+
#document h3,
|
112
|
+
#document h4,
|
113
|
+
#document h5,
|
114
|
+
#document h6 {
|
115
|
+
position:relative;
|
116
|
+
margin-top:1em;
|
117
|
+
margin-bottom:16px;
|
118
|
+
font-weight:bold;
|
119
|
+
line-height:1.4
|
120
|
+
}
|
121
|
+
|
122
|
+
#document h1 tt,
|
123
|
+
#document h1 code,
|
124
|
+
#document h2 tt,
|
125
|
+
#document h2 code,
|
126
|
+
#document h3 tt,
|
127
|
+
#document h3 code,
|
128
|
+
#document h4 tt,
|
129
|
+
#document h4 code,
|
130
|
+
#document h5 tt,
|
131
|
+
#document h5 code,
|
132
|
+
#document h6 tt,
|
133
|
+
#document h6 code {
|
134
|
+
font-size:inherit
|
135
|
+
}
|
136
|
+
#document h1 {
|
137
|
+
padding-bottom:0.3em;
|
138
|
+
font-size:2.25em;
|
139
|
+
line-height:1.2;
|
140
|
+
border-bottom:1px solid #eee
|
141
|
+
}
|
142
|
+
#document h2 {
|
143
|
+
padding-bottom:0.3em;
|
144
|
+
font-size:1.75em;
|
145
|
+
line-height:1.225;
|
146
|
+
border-bottom:1px solid #eee
|
147
|
+
}
|
148
|
+
#document h3 {
|
149
|
+
font-size:1.5em;
|
150
|
+
line-height:1.43
|
151
|
+
}
|
152
|
+
#document h4 {
|
153
|
+
font-size:1.25em
|
154
|
+
}
|
155
|
+
#document h5 {
|
156
|
+
font-size:1em
|
157
|
+
}
|
158
|
+
#document h6 {
|
159
|
+
font-size:1em;
|
160
|
+
color:#777
|
161
|
+
}
|
162
|
+
#document p,
|
163
|
+
#document blockquote,
|
164
|
+
#document ul,
|
165
|
+
#document ol,
|
166
|
+
#document dl,
|
167
|
+
#document table,
|
168
|
+
#document pre {
|
169
|
+
margin-top:0;
|
170
|
+
margin-bottom:15px
|
171
|
+
}
|
172
|
+
#document hr {
|
173
|
+
height:4px;
|
174
|
+
padding:0;
|
175
|
+
margin:16px 0;
|
176
|
+
background-color:#e7e7e7;
|
177
|
+
border:0 none
|
178
|
+
}
|
179
|
+
#document ul,
|
180
|
+
#document ol {
|
181
|
+
padding-left:2em
|
182
|
+
}
|
183
|
+
#document ul.no-list,
|
184
|
+
#document ol.no-list {
|
185
|
+
padding:0;
|
186
|
+
list-style-type:none
|
187
|
+
}
|
188
|
+
#document ul ul,
|
189
|
+
#document ul ol,
|
190
|
+
#document ol ol,
|
191
|
+
#document ol ul {
|
192
|
+
margin-top:0;
|
193
|
+
margin-bottom:0
|
194
|
+
}
|
195
|
+
#document li>p {
|
196
|
+
margin-top:16px
|
197
|
+
}
|
198
|
+
#document dl {
|
199
|
+
padding:0
|
200
|
+
}
|
201
|
+
#document dl dt {
|
202
|
+
padding:0;
|
203
|
+
margin-top:16px;
|
204
|
+
font-size:1em;
|
205
|
+
font-style:italic;
|
206
|
+
font-weight:bold
|
207
|
+
}
|
208
|
+
#document dl dd {
|
209
|
+
padding:0 16px;
|
210
|
+
margin-bottom:16px
|
211
|
+
}
|
212
|
+
#document blockquote {
|
213
|
+
padding:0 15px;
|
214
|
+
color:#777;
|
215
|
+
border-left:4px solid #ddd
|
216
|
+
}
|
217
|
+
#document blockquote>:first-child {
|
218
|
+
margin-top:0
|
219
|
+
}
|
220
|
+
#document blockquote>:last-child {
|
221
|
+
margin-bottom:0
|
222
|
+
}
|
223
|
+
#document table {
|
224
|
+
display:block;
|
225
|
+
width:100%;
|
226
|
+
overflow:auto;
|
227
|
+
word-break:normal;
|
228
|
+
word-break:keep-all
|
229
|
+
}
|
230
|
+
#document table th {
|
231
|
+
font-weight:bold
|
232
|
+
}
|
233
|
+
#document table th,
|
234
|
+
#document table td {
|
235
|
+
padding:6px 13px;
|
236
|
+
border:1px solid #ddd
|
237
|
+
}
|
238
|
+
#document table tr {
|
239
|
+
background-color:#fff;
|
240
|
+
border-top:1px solid #ccc
|
241
|
+
}
|
242
|
+
#document table tr:nth-child(2n) {
|
243
|
+
background-color:#f8f8f8
|
244
|
+
}
|
245
|
+
#document img {
|
246
|
+
max-width:100%;
|
247
|
+
box-sizing:border-box
|
248
|
+
}
|
249
|
+
#document .emoji {
|
250
|
+
max-width:none
|
251
|
+
}
|
252
|
+
#document span.frame {
|
253
|
+
display:block;
|
254
|
+
overflow:hidden
|
255
|
+
}
|
256
|
+
#document span.frame>span {
|
257
|
+
display:block;
|
258
|
+
float:left;
|
259
|
+
width:auto;
|
260
|
+
padding:7px;
|
261
|
+
margin:13px 0 0;
|
262
|
+
overflow:hidden;
|
263
|
+
border:1px solid #ddd
|
264
|
+
}
|
265
|
+
#document span.frame span img {
|
266
|
+
display:block;
|
267
|
+
float:left
|
268
|
+
}
|
269
|
+
#document span.frame span span {
|
270
|
+
display:block;
|
271
|
+
padding:5px 0 0;
|
272
|
+
clear:both;
|
273
|
+
color:#333
|
274
|
+
}
|
275
|
+
#document span.align-center {
|
276
|
+
display:block;
|
277
|
+
overflow:hidden;
|
278
|
+
clear:both
|
279
|
+
}
|
280
|
+
#document span.align-center>span {
|
281
|
+
display:block;
|
282
|
+
margin:13px auto 0;
|
283
|
+
overflow:hidden;
|
284
|
+
text-align:center
|
285
|
+
}
|
286
|
+
#document span.align-center span img {
|
287
|
+
margin:0 auto;
|
288
|
+
text-align:center
|
289
|
+
}
|
290
|
+
#document span.align-right {
|
291
|
+
display:block;
|
292
|
+
overflow:hidden;
|
293
|
+
clear:both
|
294
|
+
}
|
295
|
+
#document span.align-right>span {
|
296
|
+
display:block;
|
297
|
+
margin:13px 0 0;
|
298
|
+
overflow:hidden;
|
299
|
+
text-align:right
|
300
|
+
}
|
301
|
+
#document span.align-right span img {
|
302
|
+
margin:0;
|
303
|
+
text-align:right
|
304
|
+
}
|
305
|
+
#document span.float-left {
|
306
|
+
display:block;
|
307
|
+
float:left;
|
308
|
+
margin-right:13px;
|
309
|
+
overflow:hidden
|
310
|
+
}
|
311
|
+
#document span.float-left span {
|
312
|
+
margin:13px 0 0
|
313
|
+
}
|
314
|
+
#document span.float-right {
|
315
|
+
display:block;
|
316
|
+
float:right;
|
317
|
+
margin-left:13px;
|
318
|
+
overflow:hidden
|
319
|
+
}
|
320
|
+
#document span.float-right>span {
|
321
|
+
display:block;
|
322
|
+
margin:13px auto 0;
|
323
|
+
overflow:hidden;
|
324
|
+
text-align:right
|
325
|
+
}
|
326
|
+
#document code,
|
327
|
+
#document tt {
|
328
|
+
padding:0;
|
329
|
+
padding-top:2px;
|
330
|
+
padding-bottom:2px;
|
331
|
+
margin:0;
|
332
|
+
color: #c5c8c6;
|
333
|
+
font-size:85%;
|
334
|
+
background-color:#000000;
|
335
|
+
border-radius:3px
|
336
|
+
}
|
337
|
+
#document code:before,
|
338
|
+
#document code:after,
|
339
|
+
#document tt:before,
|
340
|
+
#document tt:after {
|
341
|
+
letter-spacing:-0.2em;
|
342
|
+
content:"\00a0"
|
343
|
+
}
|
344
|
+
#document code br,
|
345
|
+
#document tt br {
|
346
|
+
display:none
|
347
|
+
}
|
348
|
+
#document del code {
|
349
|
+
text-decoration:inherit
|
350
|
+
}
|
351
|
+
#document pre>code {
|
352
|
+
padding:0;
|
353
|
+
margin:0;
|
354
|
+
font-size:100%;
|
355
|
+
word-break:normal;
|
356
|
+
white-space:pre;
|
357
|
+
background:transparent;
|
358
|
+
border:0
|
359
|
+
}
|
360
|
+
#document .highlight {
|
361
|
+
margin-bottom:16px
|
362
|
+
}
|
363
|
+
#document .highlight pre,
|
364
|
+
#document pre {
|
365
|
+
overflow:auto;
|
366
|
+
font-size: 12px;
|
367
|
+
line-height: normal;
|
368
|
+
background-color:#000000;
|
369
|
+
border-radius:5px;
|
370
|
+
padding: 0px 0px 15px 25px;
|
371
|
+
}
|
372
|
+
#document .highlight pre {
|
373
|
+
margin-bottom:0;
|
374
|
+
word-break:normal
|
375
|
+
}
|
376
|
+
#document pre {
|
377
|
+
word-wrap:normal
|
378
|
+
}
|
379
|
+
#document pre code,
|
380
|
+
#document pre tt {
|
381
|
+
max-width:initial;
|
382
|
+
padding:0;
|
383
|
+
margin:0;
|
384
|
+
overflow:initial;
|
385
|
+
line-height:inherit;
|
386
|
+
word-wrap:normal;
|
387
|
+
background-color:transparent;
|
388
|
+
border:0
|
389
|
+
}
|
390
|
+
#document pre code:before,
|
391
|
+
#document pre code:after,
|
392
|
+
#document pre tt:before,
|
393
|
+
#document pre tt:after {
|
394
|
+
content:normal
|
395
|
+
}
|
396
|
+
#document kbd {
|
397
|
+
display:inline-block;
|
398
|
+
padding:3px 5px;
|
399
|
+
font-size:11px;
|
400
|
+
line-height:10px;
|
401
|
+
color:#555;
|
402
|
+
vertical-align:middle;
|
403
|
+
background-color:#fcfcfc;
|
404
|
+
border:solid 1px #ccc;
|
405
|
+
border-bottom-color:#bbb;
|
406
|
+
border-radius:3px;
|
407
|
+
box-shadow:inset 0 -1px 0 #bbb
|
408
|
+
}
|
409
|
+
|
410
|
+
|
411
|
+
/* Tomorrow Night Theme */
|
412
|
+
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
|
413
|
+
/* Original theme - https://github.com/chriskempson/tomorrow-theme */
|
414
|
+
/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */
|
415
|
+
|
416
|
+
/* Tomorrow Comment */
|
417
|
+
.hljs-comment {
|
418
|
+
color: #969896;
|
419
|
+
}
|
420
|
+
|
421
|
+
/* Tomorrow Red */
|
422
|
+
.hljs-variable,
|
423
|
+
.hljs-attribute,
|
424
|
+
.hljs-tag,
|
425
|
+
.hljs-regexp,
|
426
|
+
.ruby .hljs-constant,
|
427
|
+
.xml .hljs-tag .hljs-title,
|
428
|
+
.xml .hljs-pi,
|
429
|
+
.xml .hljs-doctype,
|
430
|
+
.html .hljs-doctype,
|
431
|
+
.css .hljs-id,
|
432
|
+
.css .hljs-class,
|
433
|
+
.css .hljs-pseudo {
|
434
|
+
color: #cc6666;
|
435
|
+
}
|
436
|
+
|
437
|
+
/* Tomorrow Orange */
|
438
|
+
.hljs-number,
|
439
|
+
.hljs-preprocessor,
|
440
|
+
.hljs-pragma,
|
441
|
+
.hljs-built_in,
|
442
|
+
.hljs-literal,
|
443
|
+
.hljs-params,
|
444
|
+
.hljs-constant {
|
445
|
+
color: #de935f;
|
446
|
+
}
|
447
|
+
|
448
|
+
/* Tomorrow Yellow */
|
449
|
+
.ruby .hljs-class .hljs-title,
|
450
|
+
.css .hljs-rule .hljs-attribute {
|
451
|
+
color: #f0c674;
|
452
|
+
}
|
453
|
+
|
454
|
+
/* Tomorrow Green */
|
455
|
+
.hljs-string,
|
456
|
+
.hljs-value,
|
457
|
+
.hljs-inheritance,
|
458
|
+
.hljs-header,
|
459
|
+
.hljs-name,
|
460
|
+
.ruby .hljs-symbol,
|
461
|
+
.xml .hljs-cdata {
|
462
|
+
color: #b5bd68;
|
463
|
+
}
|
464
|
+
|
465
|
+
/* Tomorrow Aqua */
|
466
|
+
.hljs-title,
|
467
|
+
.css .hljs-hexcolor {
|
468
|
+
color: #8abeb7;
|
469
|
+
}
|
470
|
+
|
471
|
+
/* Tomorrow Blue */
|
472
|
+
.hljs-function,
|
473
|
+
.python .hljs-decorator,
|
474
|
+
.python .hljs-title,
|
475
|
+
.ruby .hljs-function .hljs-title,
|
476
|
+
.ruby .hljs-title .hljs-keyword,
|
477
|
+
.perl .hljs-sub,
|
478
|
+
.javascript .hljs-title,
|
479
|
+
.coffeescript .hljs-title {
|
480
|
+
color: #81a2be;
|
481
|
+
}
|
482
|
+
|
483
|
+
/* Tomorrow Purple */
|
484
|
+
.hljs-keyword,
|
485
|
+
.javascript .hljs-function {
|
486
|
+
color: #b294bb;
|
487
|
+
}
|
488
|
+
|
489
|
+
.hljs {
|
490
|
+
display: block;
|
491
|
+
overflow-x: auto;
|
492
|
+
background: #1d1f21;
|
493
|
+
color: #c5c8c6;
|
494
|
+
padding: 0.5em;
|
495
|
+
-webkit-text-size-adjust: none;
|
496
|
+
}
|
497
|
+
|
498
|
+
.coffeescript .javascript,
|
499
|
+
.javascript .xml,
|
500
|
+
.tex .hljs-formula,
|
501
|
+
.xml .javascript,
|
502
|
+
.xml .vbscript,
|
503
|
+
.xml .css,
|
504
|
+
.xml .hljs-cdata {
|
505
|
+
opacity: 0.5;
|
506
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Documentarian
|
2
|
+
class DocumentationController < ApplicationController
|
3
|
+
|
4
|
+
caches_action :show, :cache_path => Proc.new { |c| c.params }
|
5
|
+
|
6
|
+
def index
|
7
|
+
end
|
8
|
+
|
9
|
+
def show
|
10
|
+
@resource = Documentarian::Resource.get(params[:slug]) or redirect_to root_path
|
11
|
+
end
|
12
|
+
|
13
|
+
def asset
|
14
|
+
send_file Documentarian::AssetProxy.link(params[:path]), disposition: 'inline'
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
- children = resource.children
|
2
|
+
%li.collapsible{:class => Regexp.new(resource.slug) =~ params[:slug] && :show}
|
3
|
+
%span.part{:class => resource.slug == params[:slug] && :active}
|
4
|
+
%a{:href => documentation_path(resource)}= resource.title
|
5
|
+
- if !children.empty?
|
6
|
+
%ul
|
7
|
+
- resource.children.each do |resource|
|
8
|
+
- next if resource.directory_overview?
|
9
|
+
= render :partial => 'navigation_item', :locals => {:resource => resource}
|
File without changes
|
@@ -0,0 +1,20 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title Documentarian
|
5
|
+
|
6
|
+
= stylesheet_link_tag 'documentarian/application', media: 'all'
|
7
|
+
= javascript_include_tag '//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'
|
8
|
+
= javascript_include_tag 'documentarian/application'
|
9
|
+
= javascript_include_tag '//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/highlight.min.js'
|
10
|
+
|
11
|
+
= csrf_meta_tags
|
12
|
+
|
13
|
+
%body
|
14
|
+
#document-content
|
15
|
+
#navigation-content
|
16
|
+
#navigation
|
17
|
+
= render :partial => 'navigation'
|
18
|
+
#document
|
19
|
+
= yield
|
20
|
+
.clear
|
data/config/routes.rb
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
module Documentarian
|
2
|
+
class Resource < Pathname
|
3
|
+
|
4
|
+
alias_method :body, :read
|
5
|
+
|
6
|
+
def self.roots
|
7
|
+
Documentarian.resources.select { |resource|
|
8
|
+
String(resource.relative_path).split('/').length == 1
|
9
|
+
}.sort_by { |resource|
|
10
|
+
[resource.directory? ? 0 : 1, resource.title]
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get(slug)
|
15
|
+
Documentarian.resources.find { |resource| resource.slug == slug }
|
16
|
+
end
|
17
|
+
|
18
|
+
def children
|
19
|
+
return [] if !directory?
|
20
|
+
items = (super).map {|item| String(item)}
|
21
|
+
Documentarian.resources.select { |resource|
|
22
|
+
items.include?(String(resource))
|
23
|
+
}.sort
|
24
|
+
end
|
25
|
+
|
26
|
+
def directory_overview
|
27
|
+
return nil unless directory?
|
28
|
+
siblings.find { |sibling| sibling.title == self.title }
|
29
|
+
end
|
30
|
+
|
31
|
+
def directory_overview?
|
32
|
+
return false if directory?
|
33
|
+
siblings.find { |sibling| sibling.directory? && sibling.title == self.title }
|
34
|
+
end
|
35
|
+
|
36
|
+
def siblings
|
37
|
+
Documentarian.resources.find { |resource|
|
38
|
+
resource.to_s == parent.to_s
|
39
|
+
}.try(:children).try(:select, &Proc.new{ |child| child != self }) || []
|
40
|
+
end
|
41
|
+
|
42
|
+
def relative_path
|
43
|
+
relative_path_from(Configuration.documentation_path)
|
44
|
+
end
|
45
|
+
|
46
|
+
def slug
|
47
|
+
@slug ||= String(relative_path)
|
48
|
+
.gsub(/[^\w\/\.]/, '_')
|
49
|
+
.downcase
|
50
|
+
end
|
51
|
+
|
52
|
+
def title
|
53
|
+
String(basename).gsub(Regexp.new("(%s)$" % Configuration.extensions.join('|')), '')
|
54
|
+
end
|
55
|
+
|
56
|
+
def to_param
|
57
|
+
slug
|
58
|
+
end
|
59
|
+
|
60
|
+
def to_html
|
61
|
+
Documentarian::Resource::Renderer.render(self)
|
62
|
+
end
|
63
|
+
|
64
|
+
module Renderer
|
65
|
+
|
66
|
+
class << self
|
67
|
+
include Documentarian::Engine.routes.url_helpers
|
68
|
+
def render(resource)
|
69
|
+
GitHub::Markdown.render(ERB.new(resource.body).result(binding))
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'pathname'
|
2
|
+
require 'github/markdown'
|
3
|
+
require 'documentarian/engine'
|
4
|
+
require 'documentarian/asset_proxy'
|
5
|
+
require 'documentarian/resource'
|
6
|
+
|
7
|
+
module Documentarian
|
8
|
+
mattr_accessor :resources
|
9
|
+
|
10
|
+
module Configuration
|
11
|
+
mattr_accessor :root
|
12
|
+
mattr_accessor :extensions
|
13
|
+
|
14
|
+
def self.root=(value)
|
15
|
+
@@root ||= Pathname.new(value)
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.documentation_path
|
19
|
+
Pathname.new(File.join(self.root, 'documentation'))
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.asset_path
|
23
|
+
Pathname.new(File.join(self.root, 'assets'))
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.install
|
29
|
+
yield Configuration
|
30
|
+
self.load
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.resources
|
34
|
+
@@resources ||= []
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.load
|
38
|
+
Dir[File.join(Configuration.documentation_path, '**/*{%s}' % Configuration.extensions.join(','))].each do |path|
|
39
|
+
Pathname.new(path).relative_path_from(Configuration.documentation_path).descend do |relative_path|
|
40
|
+
relative_resource = Resource.new(File.join(Configuration.documentation_path, relative_path))
|
41
|
+
self.resources << relative_resource unless self.resources.include?(relative_resource)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: documentarian
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Christopher Jaeger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-30 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: github-markdown
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description:
|
28
|
+
email: jaeger.ca@gmail.com
|
29
|
+
executables: []
|
30
|
+
extensions: []
|
31
|
+
extra_rdoc_files: []
|
32
|
+
files:
|
33
|
+
- app/assets/javascripts/documentarian/application.js
|
34
|
+
- app/assets/stylesheets/documentarian/application.scss
|
35
|
+
- app/controllers/documentarian/application_controller.rb
|
36
|
+
- app/controllers/documentarian/documentation_controller.rb
|
37
|
+
- app/helpers/documentarian/application_helper.rb
|
38
|
+
- app/views/documentarian/application/_navigation.html.haml
|
39
|
+
- app/views/documentarian/application/_navigation_item.html.haml
|
40
|
+
- app/views/documentarian/documentation/index.html.haml
|
41
|
+
- app/views/documentarian/documentation/show.html.haml
|
42
|
+
- app/views/layouts/documentarian/application.html.haml
|
43
|
+
- config/routes.rb
|
44
|
+
- lib/documentarian.rb
|
45
|
+
- lib/documentarian/asset_proxy.rb
|
46
|
+
- lib/documentarian/engine.rb
|
47
|
+
- lib/documentarian/navigation.rb
|
48
|
+
- lib/documentarian/resource.rb
|
49
|
+
- lib/tasks/documentarian.rake
|
50
|
+
homepage:
|
51
|
+
licenses: []
|
52
|
+
metadata: {}
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options: []
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0'
|
67
|
+
requirements: []
|
68
|
+
rubyforge_project:
|
69
|
+
rubygems_version: 2.4.6
|
70
|
+
signing_key:
|
71
|
+
specification_version: 4
|
72
|
+
summary: Documentation
|
73
|
+
test_files: []
|