vocco 0.1.3 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,160 @@
1
+ <?xml version="1.0" encoding="utf8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <title>Vocco : source_file.rb</title>
6
+ <meta name="Generator" content="Vim/7.2" />
7
+ <meta content="text/html; charset=utf8" http-equiv="content-type" />
8
+ <style type="text/css">
9
+ <!--
10
+ .Identifier { color: #c6b6ee; }
11
+ .rubyIdentifier { color: #c6b6fe; }
12
+ .PreProc { color: #8fbfdc; }
13
+ .StringDelimiter { color: #556633; }
14
+ .String { color: #99ad6a; }
15
+ .Function { color: #fad07a; }
16
+ .rubyInstanceVariable { color: #c6b6fe; }
17
+ .Statement { color: #8197bf; }
18
+ .rubySymbol { color: #7697d6; }
19
+ .Comment { color: #888888; font-style: italic; }
20
+ .rubyRegexpDelimiter { color: #540063; }
21
+ .rubyRegexpSpecial { color: #a40073; }
22
+ .rubyControl { color: #7597c6; }
23
+ .Type { color: #ffb964; }
24
+ body { color: #e8e8d3; background-color: #151515; font-family: monospace; }
25
+ .rubyClass { color: #447799; }
26
+ -->
27
+ </style><style type="text/css">body {
28
+ font-family: "Palatino Linotype", "Book Antiqua", Palatino, FreeSerif, serif;
29
+ font-size: 15px; }
30
+
31
+ html, body {
32
+ height: 100%; }
33
+
34
+ body {
35
+ padding: 1em; }
36
+
37
+ .code {
38
+ font-family: Menlo, Monaco, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace;
39
+ font-size: 16px;
40
+ padding: 1em;
41
+ width: 50%; }
42
+
43
+ .nav {
44
+ width: 40%;
45
+ position: fixed;
46
+ top: 0;
47
+ left: 55%;
48
+ height: 100%;
49
+ font-size: 15px;
50
+ line-height: 22px;
51
+ color: #252519; }
52
+ .nav .wrapper {
53
+ color: black;
54
+ height: 100%; }
55
+ .nav .wrapper .area {
56
+ background-color: #cccccc;
57
+ padding: 1em 1em 1em 1em;
58
+ border-bottom: 1px dashed #bbbbbb;
59
+ border-top: 1px dashed #666666; }
60
+ .nav .wrapper .area .autohide {
61
+ opacity: 0;
62
+ height: 0px;
63
+ -webkit-transition: all 0.2s linear;
64
+ overflow: auto; }
65
+ .nav .wrapper .area:hover .autohide {
66
+ height: 150px;
67
+ opacity: 1; }
68
+ .nav .wrapper .notes {
69
+ max-height: 40%;
70
+ overflow: auto; }
71
+
72
+ table th {
73
+ text-align: right; }
74
+
75
+ </style>
76
+ </head>
77
+ <body><div class="code">
78
+ <br />
79
+ <br />
80
+ <br />
81
+ <span class="rubyClass">class</span>&nbsp;<span class="Type">Vocco</span>::<span class="Type">Generator</span>::<span class="Type">SourceFile</span><br />
82
+ &nbsp;&nbsp;<span class="PreProc">require</span>&nbsp;<span class="StringDelimiter">'</span><span class="String">vocco/generator/source_file/html_template</span><span class="StringDelimiter">'</span><br />
83
+ <br />
84
+ &nbsp;&nbsp;<span class="Type">NOTE_FORMATS</span>&nbsp;= <span class="StringDelimiter">'</span><span class="String">.{textile,md,mkd,markdown,rdoc}</span><span class="StringDelimiter">'</span><br />
85
+ <br />
86
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">initialize</span>(file, generator)<br />
87
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@file</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = file<br />
88
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@gen</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= generator<br />
89
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
90
+ <br />
91
+ &nbsp;&nbsp;<span class="Statement">attr_reader</span>&nbsp;<span class="rubySymbol">:file</span>&nbsp;<span class="Comment"># full file path</span><br />
92
+ <br />
93
+ &nbsp;&nbsp;<span class="Comment"># full dirname</span><br />
94
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">dirname</span><br />
95
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">File</span>.dirname(<span class="rubyInstanceVariable">@file</span>)<br />
96
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
97
+ <br />
98
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">basename</span><br />
99
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">File</span>.basename(<span class="rubyInstanceVariable">@file</span>)<br />
100
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
101
+ <br />
102
+ &nbsp;&nbsp;<span class="Comment"># file path with glob dir scope trimmed off</span><br />
103
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">short_path</span><br />
104
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@short_path</span>&nbsp;||= <span class="rubyInstanceVariable">@file</span>.sub(<span class="rubyInstanceVariable">@gen</span>.glob_regex, <span class="StringDelimiter">''</span>)<br />
105
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
106
+ <br />
107
+ &nbsp;&nbsp;<span class="Comment"># dirname of the above</span><br />
108
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">short_dirname</span><br />
109
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">File</span>.dirname(short_path).sub(<span class="rubyRegexpDelimiter">/</span><span class="rubyRegexpSpecial">^</span><span class="rubyRegexpSpecial">\.\/</span><span class="rubyRegexpDelimiter">/</span>, <span class="StringDelimiter">''</span>)<br />
110
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
111
+ <br />
112
+ &nbsp;&nbsp;<span class="Comment"># corresponding doc file basename</span><br />
113
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">doc_basename</span><br />
114
+ &nbsp;&nbsp;&nbsp;&nbsp;doc_scope + basename + <span class="StringDelimiter">'</span><span class="String">.html</span><span class="StringDelimiter">'</span><br />
115
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
116
+ <br />
117
+ &nbsp;&nbsp;<span class="Comment"># corresponding doc file path</span><br />
118
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">doc_path</span><br />
119
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">File</span>.join(<span class="rubyInstanceVariable">@gen</span>.out, doc_basename)<br />
120
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
121
+ <br />
122
+ &nbsp;&nbsp;<span class="Comment"># relative link to doc</span><br />
123
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">doc_link</span><br />
124
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="StringDelimiter">'</span><span class="String">./</span><span class="StringDelimiter">'</span>&nbsp;+ doc_basename<br />
125
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
126
+ <br />
127
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">notes</span><br />
128
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@notes</span>&nbsp;||= <span class="Type">Dir</span>[note_glob].map <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">path</span>|<br />
129
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">Tilt</span>.new(path).render<br />
130
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span><br />
131
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
132
+ <br />
133
+ &nbsp;&nbsp;<span class="Comment"># make a method for the html template</span><br />
134
+ &nbsp;&nbsp;<span class="Statement">class_eval</span>&nbsp;&lt;&lt;-<span class="StringDelimiter">EOF</span>, <span class="StringDelimiter">'</span><span class="String">(template)</span><span class="StringDelimiter">'</span><br />
135
+ <span class="String">&nbsp;&nbsp;&nbsp;&nbsp;def render_template</span><br />
136
+ <span class="String">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="Identifier">#{</span><span class="Type">HTML_TEMPLATE</span><span class="Identifier">}</span><br />
137
+ <span class="String">&nbsp;&nbsp;&nbsp;&nbsp;end</span><br />
138
+ <span class="String">&nbsp;&nbsp;</span><span class="StringDelimiter">EOF</span><br />
139
+ <br />
140
+ &nbsp;&nbsp;<span class="Statement">private</span><br />
141
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Comment"># doc filename prefix based on source file folder</span><br />
142
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">doc_scope</span><br />
143
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;short_dirname == <span class="StringDelimiter">'</span><span class="String">.</span><span class="StringDelimiter">'</span>&nbsp;? <span class="StringDelimiter">''</span>&nbsp;: short_dirname.gsub(<span class="StringDelimiter">'</span><span class="String">/</span><span class="StringDelimiter">'</span>, <span class="StringDelimiter">'</span><span class="String">-</span><span class="StringDelimiter">'</span>) + <span class="StringDelimiter">'</span><span class="String">-</span><span class="StringDelimiter">'</span><br />
144
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">end</span><br />
145
+ <br />
146
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Comment"># the dirs in which to look for notes concerning this file.</span><br />
147
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">note_dirs</span><br />
148
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@gen</span>.notes.inject([dirname]) <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">dirs</span>, <span class="rubyIdentifier">dir</span>|<br />
149
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dirs &lt;&lt; <span class="Type">File</span>.join(dir, short_dirname)<br />
150
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span><br />
151
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">end</span><br />
152
+ <br />
153
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Comment"># glob matching notes concerning this file</span><br />
154
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">note_glob</span><br />
155
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="StringDelimiter">'</span><span class="String">{</span><span class="StringDelimiter">'</span>&nbsp;+ note_dirs.join(<span class="StringDelimiter">'</span><span class="String">,</span><span class="StringDelimiter">'</span>) + <span class="StringDelimiter">'</span><span class="String">}/</span><span class="StringDelimiter">'</span>&nbsp;+ basename + <span class="Type">NOTE_FORMATS</span><br />
156
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">end</span><br />
157
+ <span class="rubyClass">end</span><br />
158
+ <br />
159
+ </div><div class="nav"><div class="wrapper"><div class="area"><h3><strong><a href="http://github.com/jbe/vocco">Vocco</a></strong><span> : </span><span>source_file.rb</span></h3><p class="autohide">lib/vocco/<a href="./lib-vocco-generator.rb.html">generator.rb</a><br />lib/vocco/generator/<a href="./lib-vocco-generator-css.rb.html">css.rb</a><br />lib/vocco/generator/source_file/<a href="./lib-vocco-generator-source_file-html_template.rb.html">html_template.rb</a><br />lib/vocco/generator/<a href="./lib-vocco-generator-source_file.rb.html">source_file.rb</a><br />lib/vocco/<a href="./lib-vocco-cli.rb.html">cli.rb</a><br />lib/<a href="./lib-vocco.rb.html">vocco.rb</a><br /><a href="./README.html">README</a><br /></p></div><div class="area"><table><tr><th>Generated:</th><td>Mon Mar 14 01:26:25 +0100 2011</td></tr></table></div></div></div></body>
160
+ </html>
@@ -0,0 +1,189 @@
1
+ <?xml version="1.0" encoding="utf8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <title>Vocco : generator.rb</title>
6
+ <meta name="Generator" content="Vim/7.2" />
7
+ <meta content="text/html; charset=utf8" http-equiv="content-type" />
8
+ <style type="text/css">
9
+ <!--
10
+ .Special { color: #799d6a; }
11
+ .Identifier { color: #c6b6ee; }
12
+ .rubyIdentifier { color: #c6b6fe; }
13
+ .rubyRegexpDelimiter { color: #540063; }
14
+ .rubyRegexpSpecial { color: #a40073; }
15
+ .Constant { color: #cf6a4c; }
16
+ .Comment { color: #888888; font-style: italic; }
17
+ .Statement { color: #8197bf; }
18
+ .rubySymbol { color: #7697d6; }
19
+ .Function { color: #fad07a; }
20
+ .rubyInstanceVariable { color: #c6b6fe; }
21
+ .rubyControl { color: #7597c6; }
22
+ .Type { color: #ffb964; }
23
+ .StringDelimiter { color: #556633; }
24
+ .String { color: #99ad6a; }
25
+ .rubyClass { color: #447799; }
26
+ body { color: #e8e8d3; background-color: #151515; font-family: monospace; }
27
+ .PreProc { color: #8fbfdc; }
28
+ -->
29
+ </style><style type="text/css">body {
30
+ font-family: "Palatino Linotype", "Book Antiqua", Palatino, FreeSerif, serif;
31
+ font-size: 15px; }
32
+
33
+ html, body {
34
+ height: 100%; }
35
+
36
+ body {
37
+ padding: 1em; }
38
+
39
+ .code {
40
+ font-family: Menlo, Monaco, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace;
41
+ font-size: 16px;
42
+ padding: 1em;
43
+ width: 50%; }
44
+
45
+ .nav {
46
+ width: 40%;
47
+ position: fixed;
48
+ top: 0;
49
+ left: 55%;
50
+ height: 100%;
51
+ font-size: 15px;
52
+ line-height: 22px;
53
+ color: #252519; }
54
+ .nav .wrapper {
55
+ color: black;
56
+ height: 100%; }
57
+ .nav .wrapper .area {
58
+ background-color: #cccccc;
59
+ padding: 1em 1em 1em 1em;
60
+ border-bottom: 1px dashed #bbbbbb;
61
+ border-top: 1px dashed #666666; }
62
+ .nav .wrapper .area .autohide {
63
+ opacity: 0;
64
+ height: 0px;
65
+ -webkit-transition: all 0.2s linear;
66
+ overflow: auto; }
67
+ .nav .wrapper .area:hover .autohide {
68
+ height: 150px;
69
+ opacity: 1; }
70
+ .nav .wrapper .notes {
71
+ max-height: 40%;
72
+ overflow: auto; }
73
+
74
+ table th {
75
+ text-align: right; }
76
+
77
+ </style>
78
+ </head>
79
+ <body><div class="code">
80
+ <br />
81
+ <span class="PreProc">require</span>&nbsp;<span class="StringDelimiter">'</span><span class="String">fileutils</span><span class="StringDelimiter">'</span><br />
82
+ <br />
83
+ <br />
84
+ <span class="rubyClass">class</span>&nbsp;<span class="Type">Vocco</span>::<span class="Type">Generator</span><br />
85
+ <br />
86
+ &nbsp;&nbsp;<span class="Comment">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What</span><br />
87
+ &nbsp;&nbsp;<span class="PreProc">require</span>&nbsp;<span class="StringDelimiter">'</span><span class="String">vocco/generator/css</span><span class="StringDelimiter">'</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="Comment"># CSS additions</span><br />
88
+ &nbsp;&nbsp;<span class="PreProc">require</span>&nbsp;<span class="StringDelimiter">'</span><span class="String">vocco/generator/source_file</span><span class="StringDelimiter">'</span>&nbsp;<span class="Comment"># SourceFile class</span><br />
89
+ <br />
90
+ &nbsp;&nbsp;<span class="Statement">attr_reader</span>&nbsp;<span class="rubySymbol">:globs</span>, <span class="rubySymbol">:notes</span>, <span class="rubySymbol">:out</span>, <span class="rubySymbol">:name</span>, <span class="rubySymbol">:site</span><br />
91
+ <br />
92
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">initialize</span>(opts)<br />
93
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@globs</span>&nbsp;&nbsp;= Array(opts[<span class="rubySymbol">:files</span>]<br />
94
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;).compact.map <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">glob</span>|<br />
95
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;glob.gsub(<span class="rubyRegexpDelimiter">/</span><span class="rubyRegexpSpecial">(</span><span class="rubyRegexpSpecial">^</span><span class="rubyRegexpSpecial">\.\/</span><span class="rubyRegexpSpecial">)|(</span><span class="rubyRegexpSpecial">\/</span><span class="rubyRegexpSpecial">$</span><span class="rubyRegexpSpecial">)</span><span class="rubyRegexpDelimiter">/</span>, <span class="StringDelimiter">''</span>)<br />
96
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span><br />
97
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@out</span>&nbsp;&nbsp;&nbsp;&nbsp;= opts[<span class="rubySymbol">:out</span>]<br />
98
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@notes</span>&nbsp;&nbsp;= Array(opts[<span class="rubySymbol">:notes</span>]).compact<br />
99
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@name</span>&nbsp;&nbsp; = opts[<span class="rubySymbol">:name</span>].capitalize<br />
100
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@site</span>&nbsp;&nbsp; = opts[<span class="rubySymbol">:site</span>]<br />
101
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@vim</span>&nbsp;&nbsp;&nbsp;&nbsp;= Array(opts[<span class="rubySymbol">:vim</span>]).compact<br />
102
+ <br />
103
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">FileUtils</span>.mkdir_p(<span class="rubyInstanceVariable">@out</span>) <span class="Comment"># ensure out dir exists</span><br />
104
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
105
+ <br />
106
+ &nbsp;&nbsp;<span class="Comment"># the paths underneath which the @globs are globbing;</span><br />
107
+ &nbsp;&nbsp;<span class="Comment"># the static part of the glob, or &quot;scope&quot; of sorts</span><br />
108
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">scopes</span><br />
109
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@scopes</span>&nbsp;||= <span class="rubyInstanceVariable">@globs</span>.map <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">glob</span>|<br />
110
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tokens = glob.split(<span class="StringDelimiter">'</span><span class="String">*</span><span class="StringDelimiter">'</span>)<br />
111
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tokens.size &gt; <span class="Constant">1</span>&nbsp;? tokens.first : <span class="Constant">nil</span><br />
112
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span>.compact<br />
113
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
114
+ <br />
115
+ &nbsp;&nbsp;<span class="Comment"># regex to trim the glob dir scopes off a source</span><br />
116
+ &nbsp;&nbsp;<span class="Comment"># file path.</span><br />
117
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">glob_regex</span><br />
118
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@glob_regex</span>&nbsp;||= <span class="rubyControl">begin</span><br />
119
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;str = scopes.map <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">scope</span>|<br />
120
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">Regexp</span>::escape(scope)<br />
121
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span>.join(<span class="StringDelimiter">'</span><span class="String">|</span><span class="StringDelimiter">'</span>)<br />
122
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyRegexpDelimiter">/</span><span class="rubyRegexpSpecial">^</span><span class="rubyRegexpSpecial">(</span><span class="rubyRegexpSpecial">\.\/</span><span class="rubyRegexpSpecial">)</span><span class="rubyRegexpSpecial">?</span><span class="rubyRegexpSpecial">(</span><span class="Identifier">#{</span>str<span class="Identifier">}</span><span class="rubyRegexpSpecial">)(</span><span class="rubyRegexpSpecial">\/</span><span class="rubyRegexpSpecial">)</span><span class="rubyRegexpSpecial">?</span><span class="rubyRegexpDelimiter">/</span><br />
123
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span><br />
124
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
125
+ <br />
126
+ &nbsp;&nbsp;<span class="Comment"># array of SourceFile's mapped from the glob matches</span><br />
127
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">files</span><br />
128
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@files</span>&nbsp;||= <span class="rubyInstanceVariable">@globs</span>.map <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">glob</span>|<br />
129
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">Dir</span>[glob]<br />
130
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span>.flatten.uniq.map <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">path</span>|<br />
131
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">SourceFile</span>.new(path, <span class="Constant">self</span>)<br />
132
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span><br />
133
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
134
+ <br />
135
+ &nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">run</span><br />
136
+ &nbsp;&nbsp;&nbsp;&nbsp;run_vim; postprocess<br />
137
+ &nbsp;&nbsp;<span class="PreProc">end</span><br />
138
+ &nbsp;&nbsp;<span class="PreProc">alias</span>&nbsp;<span class="rubySymbol">:run!</span>&nbsp;<span class="rubySymbol">:run</span><br />
139
+ <br />
140
+ &nbsp;&nbsp;<span class="Statement">private</span><br />
141
+ <br />
142
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">run_vim</span><br />
143
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;script = <span class="Type">Tempfile</span>.new(<span class="StringDelimiter">'</span><span class="String">vimdocco</span><span class="StringDelimiter">'</span>)<br />
144
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;script.write(vimscript)<br />
145
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;script.close<br />
146
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;puts <span class="StringDelimiter">'</span><span class="String">Running </span><span class="StringDelimiter">'</span>&nbsp;+ vim_command + <span class="StringDelimiter">'</span><span class="String">:</span><span class="StringDelimiter">'</span><br />
147
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;system <span class="StringDelimiter">&quot;</span><span class="Identifier">#{</span>vim_command<span class="Identifier">}</span><span class="String">&nbsp;-f -S </span><span class="Identifier">#{</span>script.path<span class="Identifier">}</span><span class="StringDelimiter">&quot;</span><br />
148
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;script.delete<br />
149
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">end</span><br />
150
+ <br />
151
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">vim_command</span><br />
152
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@vim_command</span>&nbsp;||= <span class="rubyInstanceVariable">@vim</span>.detect <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">c</span>|<br />
153
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="StringDelimiter">`</span><span class="String">which </span><span class="Identifier">#{</span>c<span class="Identifier">}</span><span class="StringDelimiter">`</span>.chomp.strip != <span class="StringDelimiter">''</span><br />
154
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span>&nbsp;|| <span class="rubyControl">abort</span>(<span class="StringDelimiter">&quot;</span><span class="String">You must install one of </span><span class="Identifier">#{</span><span class="rubyInstanceVariable">@vim</span>.inspect<span class="Identifier">}</span><span class="String">.</span><span class="StringDelimiter">&quot;</span>)<br />
155
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">end</span><br />
156
+ <br />
157
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">vimscript</span><br />
158
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@vimscript</span>&nbsp;||= <span class="rubyControl">begin</span><br />
159
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s = <span class="StringDelimiter">&quot;</span><span class="String">let html_no_pre = 1</span><span class="Special">\n</span><span class="StringDelimiter">&quot;</span><br />
160
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;files.each <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">file</span>|<br />
161
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s &lt;&lt; <span class="StringDelimiter">&quot;</span><span class="String">view! </span><span class="Identifier">#{</span>file.file<span class="Identifier">}</span><span class="Special">\n</span><span class="StringDelimiter">&quot;</span><br />
162
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s &lt;&lt; <span class="StringDelimiter">&quot;</span><span class="String">TOhtml</span><span class="Special">\n</span><span class="StringDelimiter">&quot;</span><br />
163
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s &lt;&lt; <span class="StringDelimiter">&quot;</span><span class="String">w! </span><span class="Identifier">#{</span>file.doc_path<span class="Identifier">}</span><span class="Special">\n</span><span class="StringDelimiter">&quot;</span><br />
164
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span><br />
165
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;s &lt;&lt; <span class="StringDelimiter">&quot;</span><span class="String">:qall!</span><span class="Special">\n</span><span class="StringDelimiter">&quot;</span><br />
166
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span><br />
167
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">end</span><br />
168
+ <br />
169
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">postprocess</span><br />
170
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hpricotify_docs <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">doc</span>, <span class="rubyIdentifier">file</span>|<br />
171
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doc.at(<span class="StringDelimiter">'</span><span class="String">style</span><span class="StringDelimiter">'</span>).after(<span class="StringDelimiter">'</span><span class="String">&lt;style type=&quot;text/css&quot;&gt;</span><span class="StringDelimiter">'</span>&nbsp;+ <span class="Type">CSS</span>&nbsp;+ <span class="StringDelimiter">'</span><span class="String">&lt;/style&gt;</span><span class="StringDelimiter">'</span>)<br />
172
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doc.at(<span class="StringDelimiter">'</span><span class="String">title</span><span class="StringDelimiter">'</span>).inner_html = name + <span class="StringDelimiter">'</span><span class="String">&nbsp;: </span><span class="StringDelimiter">'</span>&nbsp;+ file.basename<br />
173
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;inner = doc.at(<span class="StringDelimiter">'</span><span class="String">body</span><span class="StringDelimiter">'</span>).inner_html<br />
174
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doc.at(<span class="StringDelimiter">'</span><span class="String">body</span><span class="StringDelimiter">'</span>).swap <span class="StringDelimiter">&quot;</span><span class="String">&lt;body&gt;&lt;div class='code'&gt;</span><span class="Identifier">#{</span>inner<span class="Identifier">}</span><span class="String">&lt;/div&gt;&lt;/body&gt;</span><span class="StringDelimiter">&quot;</span><br />
175
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doc.at(<span class="StringDelimiter">'</span><span class="String">.code</span><span class="StringDelimiter">'</span>).after file.render_template<br />
176
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span><br />
177
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">end</span><br />
178
+ <br />
179
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">hpricotify_docs</span><br />
180
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;files.each <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">file</span>|<br />
181
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doc = <span class="Type">File</span>.open(file.doc_path) {|<span class="rubyIdentifier">f</span>|&nbsp;Hpricot(f) }<br />
182
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Statement">yield</span>(doc, file)<br />
183
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">File</span>.open(file.doc_path, <span class="StringDelimiter">'</span><span class="String">w</span><span class="StringDelimiter">'</span>)&nbsp;&nbsp;{|<span class="rubyIdentifier">f</span>|&nbsp;f.write(doc.to_html) }<br />
184
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span><br />
185
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">end</span><br />
186
+ <span class="rubyClass">end</span><br />
187
+ <br />
188
+ </div><div class="nav"><div class="wrapper"><div class="area"><h3><strong><a href="http://github.com/jbe/vocco">Vocco</a></strong><span> : </span><span>generator.rb</span></h3><p class="autohide">lib/vocco/<a href="./lib-vocco-generator.rb.html">generator.rb</a><br />lib/vocco/generator/<a href="./lib-vocco-generator-css.rb.html">css.rb</a><br />lib/vocco/generator/source_file/<a href="./lib-vocco-generator-source_file-html_template.rb.html">html_template.rb</a><br />lib/vocco/generator/<a href="./lib-vocco-generator-source_file.rb.html">source_file.rb</a><br />lib/vocco/<a href="./lib-vocco-cli.rb.html">cli.rb</a><br />lib/<a href="./lib-vocco.rb.html">vocco.rb</a><br /><a href="./README.html">README</a><br /></p></div><div class="area"><table><tr><th>Generated:</th><td>Mon Mar 14 01:26:25 +0100 2011</td></tr></table></div></div></div></body>
189
+ </html>
@@ -0,0 +1,173 @@
1
+ <?xml version="1.0" encoding="utf8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <title>Vocco : vocco.rb</title>
6
+ <meta name="Generator" content="Vim/7.2" />
7
+ <meta content="text/html; charset=utf8" http-equiv="content-type" />
8
+ <style type="text/css">
9
+ <!--
10
+ .rubyIdentifier { color: #c6b6fe; }
11
+ .rubyInstanceVariable { color: #c6b6fe; }
12
+ .rubyControl { color: #7597c6; }
13
+ .Identifier { color: #c6b6ee; }
14
+ .Type { color: #ffb964; }
15
+ .Constant { color: #cf6a4c; }
16
+ .Function { color: #fad07a; }
17
+ .rubySymbol { color: #7697d6; }
18
+ .Statement { color: #8197bf; }
19
+ .StringDelimiter { color: #556633; }
20
+ .String { color: #99ad6a; }
21
+ .rubyClass { color: #447799; }
22
+ body { color: #e8e8d3; background-color: #151515; font-family: monospace; }
23
+ .Comment { color: #888888; font-style: italic; }
24
+ .PreProc { color: #8fbfdc; }
25
+ -->
26
+ </style><style type="text/css">body {
27
+ font-family: "Palatino Linotype", "Book Antiqua", Palatino, FreeSerif, serif;
28
+ font-size: 15px; }
29
+
30
+ html, body {
31
+ height: 100%; }
32
+
33
+ body {
34
+ padding: 1em; }
35
+
36
+ .code {
37
+ font-family: Menlo, Monaco, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace;
38
+ font-size: 16px;
39
+ padding: 1em;
40
+ width: 50%; }
41
+
42
+ .nav {
43
+ width: 40%;
44
+ position: fixed;
45
+ top: 0;
46
+ left: 55%;
47
+ height: 100%;
48
+ font-size: 15px;
49
+ line-height: 22px;
50
+ color: #252519; }
51
+ .nav .wrapper {
52
+ color: black;
53
+ height: 100%; }
54
+ .nav .wrapper .area {
55
+ background-color: #cccccc;
56
+ padding: 1em 1em 1em 1em;
57
+ border-bottom: 1px dashed #bbbbbb;
58
+ border-top: 1px dashed #666666; }
59
+ .nav .wrapper .area .autohide {
60
+ opacity: 0;
61
+ height: 0px;
62
+ -webkit-transition: all 0.2s linear;
63
+ overflow: auto; }
64
+ .nav .wrapper .area:hover .autohide {
65
+ height: 150px;
66
+ opacity: 1; }
67
+ .nav .wrapper .notes {
68
+ max-height: 40%;
69
+ overflow: auto; }
70
+
71
+ table th {
72
+ text-align: right; }
73
+
74
+ </style>
75
+ </head>
76
+ <body><div class="code">
77
+ <br />
78
+ <br />
79
+ <span class="Comment">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Gem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Use</span><br />
80
+ <span class="PreProc">require</span>&nbsp;<span class="StringDelimiter">'</span><span class="String">hpricot</span><span class="StringDelimiter">'</span>&nbsp;&nbsp; <span class="Comment"># parse and modify html</span><br />
81
+ <span class="PreProc">require</span>&nbsp;<span class="StringDelimiter">'</span><span class="String">tilt</span><span class="StringDelimiter">'</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Comment"># generate sidebar html</span><br />
82
+ <span class="PreProc">require</span>&nbsp;<span class="StringDelimiter">'</span><span class="String">tempfile</span><span class="StringDelimiter">'</span>&nbsp;&nbsp;<span class="Comment"># temporary vimscript</span><br />
83
+ <br />
84
+ <br />
85
+ <span class="rubyClass">module</span>&nbsp;<span class="Type">Vocco</span><br />
86
+ <br />
87
+ &nbsp;&nbsp;<span class="Comment">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;File&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Responsibility</span><br />
88
+ &nbsp;&nbsp;<span class="PreProc">require</span>&nbsp;<span class="StringDelimiter">'</span><span class="String">vocco/generator</span><span class="StringDelimiter">'</span>&nbsp;<span class="Comment"># Generate docs</span><br />
89
+ &nbsp;&nbsp;<span class="PreProc">require</span>&nbsp;<span class="StringDelimiter">'</span><span class="String">vocco/cli</span><span class="StringDelimiter">'</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="Comment"># Command line interface</span><br />
90
+ <br />
91
+ &nbsp;&nbsp;<span class="rubyClass">class</span>&nbsp;&lt;&lt; <span class="Constant">self</span><br />
92
+ <br />
93
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Comment"># Vocco::run is the interface for using Vocco as a gem.</span><br />
94
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">run</span>(opts)<br />
95
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;validate(opts)<br />
96
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">Generator</span>.new(<br />
97
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">DEFAULTS</span>.merge(opts)<br />
98
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;).run<br />
99
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">end</span><br />
100
+ <br />
101
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">alias</span>&nbsp;<span class="rubySymbol">:run!</span>&nbsp;<span class="rubySymbol">:run</span><br />
102
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">alias</span>&nbsp;<span class="rubySymbol">:start</span>&nbsp;<span class="rubySymbol">:run</span><br />
103
+ <br />
104
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">validate</span>(opts)<br />
105
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bad_opts = opts.keys - <span class="Type">OPTION_NAMES</span><br />
106
+ <br />
107
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Statement">if</span>&nbsp;bad_opts.any?<br />
108
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Statement">raise</span>&nbsp;<span class="StringDelimiter">&quot;</span><span class="String">Invalid options: </span><span class="Identifier">#{</span>bad_opts<span class="Identifier">}</span><span class="StringDelimiter">&quot;</span><br />
109
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Statement">end</span><br />
110
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">end</span><br />
111
+ <br />
112
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Comment"># Tries to read a property from the gemspec with the same name</span><br />
113
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Comment"># as the working dir, in the working dir.</span><br />
114
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">def</span>&nbsp;<span class="Function">gemspec</span>(prop)<br />
115
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">begin</span><br />
116
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">require</span>&nbsp;<span class="StringDelimiter">'</span><span class="String">rubygems</span><span class="StringDelimiter">'</span><br />
117
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@gemspec</span>&nbsp;||= <span class="Type">Gem</span>::<span class="Type">Specification</span>.load(<br />
118
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">Dir</span>[<span class="StringDelimiter">'</span><span class="String">**/*.gemspec</span><span class="StringDelimiter">'</span>].first<br />
119
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)<br />
120
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyInstanceVariable">@gemspec</span>.send prop<br />
121
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">rescue</span><br />
122
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="Constant">nil</span><br />
123
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="rubyControl">end</span><br />
124
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="PreProc">end</span><br />
125
+ &nbsp;&nbsp;<span class="rubyClass">end</span><br />
126
+ <br />
127
+ &nbsp;&nbsp;<br />
128
+ &nbsp;&nbsp;<span class="Comment"># These are the available options. They can be given on</span><br />
129
+ &nbsp;&nbsp;<span class="Comment"># the command line, the linux way, or as a hash to</span><br />
130
+ &nbsp;&nbsp;<span class="Comment"># Vocco.run(...), the Rubygem way. The format is:</span><br />
131
+ &nbsp;&nbsp;<span class="Comment">#</span><br />
132
+ &nbsp;&nbsp;<span class="Comment"># [name,&nbsp;&nbsp;&nbsp;&nbsp;description,</span><br />
133
+ &nbsp;&nbsp;<span class="Comment">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; default_value</span><br />
134
+ &nbsp;&nbsp;<span class="Comment">#&nbsp;&nbsp; ]</span><br />
135
+ <br />
136
+ &nbsp;&nbsp;<span class="Type">OPTIONS</span>&nbsp;= [<br />
137
+ &nbsp;&nbsp;&nbsp;&nbsp;[<span class="rubySymbol">:files</span>,&nbsp;&nbsp;<span class="StringDelimiter">&quot;</span><span class="String">File match globs</span><span class="StringDelimiter">&quot;</span>,<br />
138
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="StringDelimiter">%w{</span><span class="String">**/*.rb README LICENSE</span><span class="StringDelimiter">}</span><br />
139
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;],<br />
140
+ <br />
141
+ &nbsp;&nbsp;&nbsp;&nbsp;[<span class="rubySymbol">:out</span>,&nbsp;&nbsp;&nbsp;&nbsp;<span class="StringDelimiter">&quot;</span><span class="String">Output directory</span><span class="StringDelimiter">&quot;</span>,<br />
142
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="StringDelimiter">'</span><span class="String">./docs</span><span class="StringDelimiter">'</span><br />
143
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;],<br />
144
+ <br />
145
+ &nbsp;&nbsp;&nbsp;&nbsp;[<span class="rubySymbol">:notes</span>,&nbsp;&nbsp;<span class="StringDelimiter">&quot;</span><span class="String">Note directories</span><span class="StringDelimiter">&quot;</span>,<br />
146
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[<span class="StringDelimiter">'</span><span class="String">./notes</span><span class="StringDelimiter">'</span>]<br />
147
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;],<br />
148
+ <br />
149
+ &nbsp;&nbsp;&nbsp;&nbsp;[<span class="rubySymbol">:name</span>,&nbsp;&nbsp; <span class="StringDelimiter">&quot;</span><span class="String">Project name</span><span class="StringDelimiter">&quot;</span>,<br />
150
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gemspec(<span class="rubySymbol">:name</span>) || <span class="Type">File</span>.basename(<span class="Type">Dir</span>.pwd)<br />
151
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;],<br />
152
+ <br />
153
+ &nbsp;&nbsp;&nbsp;&nbsp;[<span class="rubySymbol">:site</span>,&nbsp;&nbsp; <span class="StringDelimiter">&quot;</span><span class="String">Project url</span><span class="StringDelimiter">&quot;</span>,<br />
154
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gemspec(<span class="rubySymbol">:homepage</span>)<br />
155
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;],<br />
156
+ <br />
157
+ &nbsp;&nbsp;&nbsp;&nbsp;[<span class="rubySymbol">:vim</span>,&nbsp;&nbsp;&nbsp;&nbsp;<span class="StringDelimiter">&quot;</span><span class="String">Vim command</span><span class="StringDelimiter">&quot;</span>, <span class="StringDelimiter">%w{</span><span class="String">macvim gvim vim</span><span class="StringDelimiter">}</span><br />
158
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]<br />
159
+ &nbsp;&nbsp;]<br />
160
+ <br />
161
+ &nbsp;&nbsp;<span class="Type">OPTION_NAMES</span>&nbsp;&nbsp;= <span class="Type">OPTIONS</span>.map {|<span class="rubyIdentifier">opt</span>|&nbsp;opt.first }<br />
162
+ <br />
163
+ &nbsp;&nbsp;<span class="Type">DEFAULTS</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= {}<br />
164
+ &nbsp;&nbsp;<br />
165
+ &nbsp;&nbsp;<span class="Type">OPTIONS</span>.each <span class="rubyControl">do</span>&nbsp;|<span class="rubyIdentifier">opt</span>|<br />
166
+ &nbsp;&nbsp;&nbsp;&nbsp;<span class="Type">DEFAULTS</span>[opt[<span class="Constant">0</span>]] = opt[<span class="Constant">2</span>]<br />
167
+ &nbsp;&nbsp;<span class="rubyControl">end</span><br />
168
+ <br />
169
+ <span class="rubyClass">end</span><br />
170
+ <br />
171
+ <br />
172
+ </div><div class="nav"><div class="wrapper"><div class="area"><h3><strong><a href="http://github.com/jbe/vocco">Vocco</a></strong><span> : </span><span>vocco.rb</span></h3><p class="autohide">lib/vocco/<a href="./lib-vocco-generator.rb.html">generator.rb</a><br />lib/vocco/generator/<a href="./lib-vocco-generator-css.rb.html">css.rb</a><br />lib/vocco/generator/source_file/<a href="./lib-vocco-generator-source_file-html_template.rb.html">html_template.rb</a><br />lib/vocco/generator/<a href="./lib-vocco-generator-source_file.rb.html">source_file.rb</a><br />lib/vocco/<a href="./lib-vocco-cli.rb.html">cli.rb</a><br />lib/<a href="./lib-vocco.rb.html">vocco.rb</a><br /><a href="./README.html">README</a><br /></p></div><div class="area"><table><tr><th>Generated:</th><td>Mon Mar 14 01:26:25 +0100 2011</td></tr></table></div></div></div></body>
173
+ </html>