netlinx-compile 1.0.0
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 +7 -0
- data/README.txt +2 -0
- data/bin/netlinx-compile +4 -0
- data/doc/NetLinx.html +151 -0
- data/doc/NetLinx/Compile.html +148 -0
- data/doc/NetLinx/Compile/Extension.html +145 -0
- data/doc/NetLinx/Compile/Extension/AXS.html +154 -0
- data/doc/NetLinx/Compile/ExtensionDiscovery.html +324 -0
- data/doc/NetLinx/Compile/ExtensionHandler.html +396 -0
- data/doc/NetLinx/Compile/Script.html +293 -0
- data/doc/NetLinx/Compiler.html +295 -0
- data/doc/NetLinx/CompilerResult.html +501 -0
- data/doc/NetLinx/NoCompilerError.html +155 -0
- data/doc/NetLinx/SourceFile.html +430 -0
- data/doc/Test.html +147 -0
- data/doc/Test/NetLinx.html +147 -0
- data/doc/Test/NetLinx/Compilable.html +148 -0
- data/doc/Test/NetLinx/Compile.html +146 -0
- data/doc/Test/NetLinx/Compile/Discoverable.html +148 -0
- data/doc/Test/NetLinx/Compile/Invokable.html +149 -0
- data/doc/created.rid +12 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +103 -0
- data/doc/js/darkfish.js +155 -0
- data/doc/js/jquery.js +18 -0
- data/doc/js/navigation.js +142 -0
- data/doc/js/search.js +94 -0
- data/doc/js/search_index.js +1 -0
- data/doc/js/searcher.js +228 -0
- data/doc/rdoc.css +595 -0
- data/doc/table_of_contents.html +138 -0
- data/lib/netlinx-compile.rb +1 -0
- data/lib/netlinx/compile/extension/axs.rb +18 -0
- data/lib/netlinx/compile/extension_discovery.rb +62 -0
- data/lib/netlinx/compile/extension_handler.rb +86 -0
- data/lib/netlinx/compile/script.rb +115 -0
- data/lib/netlinx/compiler.rb +71 -0
- data/lib/netlinx/compiler_result.rb +72 -0
- data/lib/netlinx/source_file.rb +78 -0
- data/lib/test/netlinx/compilable.rb +48 -0
- data/lib/test/netlinx/compile/discoverable.rb +14 -0
- data/lib/test/netlinx/compile/invokable.rb +15 -0
- data/license.txt +13 -0
- metadata +156 -0
@@ -0,0 +1,396 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class NetLinx::Compile::ExtensionHandler - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../../index.html">Home</a>
|
28
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
<div id="file-metadata">
|
49
|
+
<nav id="file-list-section" class="section">
|
50
|
+
<h3 class="section-header">Defined In</h3>
|
51
|
+
<ul>
|
52
|
+
<li>lib/netlinx/compile/extension_handler.rb
|
53
|
+
</ul>
|
54
|
+
</nav>
|
55
|
+
|
56
|
+
|
57
|
+
</div>
|
58
|
+
|
59
|
+
<div id="class-metadata">
|
60
|
+
|
61
|
+
<nav id="parent-class-section" class="section">
|
62
|
+
<h3 class="section-header">Parent</h3>
|
63
|
+
|
64
|
+
<p class="link">Object
|
65
|
+
|
66
|
+
</nav>
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<nav id="method-list-section" class="section">
|
72
|
+
<h3 class="section-header">Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list">
|
75
|
+
|
76
|
+
<li ><a href="#method-c-new">::new</a>
|
77
|
+
|
78
|
+
<li ><a href="#method-i-3C-3C">#<<</a>
|
79
|
+
|
80
|
+
<li ><a href="#method-i-include-3F">#include?</a>
|
81
|
+
|
82
|
+
<li ><a href="#method-i-is_a_workspace-3F">#is_a_workspace?</a>
|
83
|
+
|
84
|
+
</ul>
|
85
|
+
</nav>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
<div id="project-metadata">
|
90
|
+
|
91
|
+
<nav id="classindex-section" class="section project-section">
|
92
|
+
<h3 class="section-header">Class and Module Index</h3>
|
93
|
+
|
94
|
+
<ul class="link-list">
|
95
|
+
|
96
|
+
<li><a href="../../NetLinx.html">NetLinx</a>
|
97
|
+
|
98
|
+
<li><a href="../../NetLinx/Compile.html">NetLinx::Compile</a>
|
99
|
+
|
100
|
+
<li><a href="../../NetLinx/Compile/Extension.html">NetLinx::Compile::Extension</a>
|
101
|
+
|
102
|
+
<li><a href="../../NetLinx/Compile/Extension/AXS.html">NetLinx::Compile::Extension::AXS</a>
|
103
|
+
|
104
|
+
<li><a href="../../NetLinx/Compile/ExtensionDiscovery.html">NetLinx::Compile::ExtensionDiscovery</a>
|
105
|
+
|
106
|
+
<li><a href="../../NetLinx/Compile/ExtensionHandler.html">NetLinx::Compile::ExtensionHandler</a>
|
107
|
+
|
108
|
+
<li><a href="../../NetLinx/Compile/Script.html">NetLinx::Compile::Script</a>
|
109
|
+
|
110
|
+
<li><a href="../../NetLinx/Compiler.html">NetLinx::Compiler</a>
|
111
|
+
|
112
|
+
<li><a href="../../NetLinx/CompilerResult.html">NetLinx::CompilerResult</a>
|
113
|
+
|
114
|
+
<li><a href="../../NetLinx/NoCompilerError.html">NetLinx::NoCompilerError</a>
|
115
|
+
|
116
|
+
<li><a href="../../NetLinx/SourceFile.html">NetLinx::SourceFile</a>
|
117
|
+
|
118
|
+
<li><a href="../../Test.html">Test</a>
|
119
|
+
|
120
|
+
<li><a href="../../Test/NetLinx.html">Test::NetLinx</a>
|
121
|
+
|
122
|
+
<li><a href="../../Test/NetLinx/Compilable.html">Test::NetLinx::Compilable</a>
|
123
|
+
|
124
|
+
<li><a href="../../Test/NetLinx/Compile.html">Test::NetLinx::Compile</a>
|
125
|
+
|
126
|
+
<li><a href="../../Test/NetLinx/Compile/Discoverable.html">Test::NetLinx::Compile::Discoverable</a>
|
127
|
+
|
128
|
+
<li><a href="../../Test/NetLinx/Compile/Invokable.html">Test::NetLinx::Compile::Invokable</a>
|
129
|
+
|
130
|
+
</ul>
|
131
|
+
</nav>
|
132
|
+
|
133
|
+
</div>
|
134
|
+
</nav>
|
135
|
+
|
136
|
+
<div id="documentation">
|
137
|
+
<h1 class="class">class NetLinx::Compile::ExtensionHandler</h1>
|
138
|
+
|
139
|
+
<div id="description" class="description">
|
140
|
+
|
141
|
+
<p>Tells netlinx-compile which class handles the compiling of a set of file
|
142
|
+
extensions.</p>
|
143
|
+
|
144
|
+
</div><!-- description -->
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
<!-- Attributes -->
|
158
|
+
<section id="attribute-method-details" class="method-section section">
|
159
|
+
<h3 class="section-header">Attributes</h3>
|
160
|
+
|
161
|
+
|
162
|
+
<div id="attribute-i-extensions" class="method-detail">
|
163
|
+
<div class="method-heading attribute-method-heading">
|
164
|
+
<span class="method-name">extensions</span><span
|
165
|
+
class="attribute-access-type">[RW]</span>
|
166
|
+
</div>
|
167
|
+
|
168
|
+
<div class="method-description">
|
169
|
+
|
170
|
+
<p>A list of file extensions that this <a
|
171
|
+
href="ExtensionHandler.html">ExtensionHandler</a> handles.</p>
|
172
|
+
|
173
|
+
</div>
|
174
|
+
</div>
|
175
|
+
|
176
|
+
<div id="attribute-i-handler_class" class="method-detail">
|
177
|
+
<div class="method-heading attribute-method-heading">
|
178
|
+
<span class="method-name">handler_class</span><span
|
179
|
+
class="attribute-access-type">[R]</span>
|
180
|
+
</div>
|
181
|
+
|
182
|
+
<div class="method-description">
|
183
|
+
|
184
|
+
<p>The class to invoke to handle compiling a file extension specified in this
|
185
|
+
<a href="ExtensionHandler.html">ExtensionHandler</a>.</p>
|
186
|
+
|
187
|
+
</div>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
<div id="attribute-i-usurps" class="method-detail">
|
191
|
+
<div class="method-heading attribute-method-heading">
|
192
|
+
<span class="method-name">usurps</span><span
|
193
|
+
class="attribute-access-type">[RW]</span>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
<div class="method-description">
|
197
|
+
|
198
|
+
<p>A list of file extensions that this <a
|
199
|
+
href="ExtensionHandler.html">ExtensionHandler</a> usurps. For example,
|
200
|
+
third-party workspace extensions would probably usurp the .apw workspace
|
201
|
+
extension.</p>
|
202
|
+
|
203
|
+
</div>
|
204
|
+
</div>
|
205
|
+
|
206
|
+
</section><!-- attribute-method-details -->
|
207
|
+
|
208
|
+
|
209
|
+
<!-- Methods -->
|
210
|
+
|
211
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
212
|
+
<h3 class="section-header">Public Class Methods</h3>
|
213
|
+
|
214
|
+
|
215
|
+
<div id="method-c-new" class="method-detail ">
|
216
|
+
|
217
|
+
<div class="method-heading">
|
218
|
+
<span class="method-name">new</span><span
|
219
|
+
class="method-args">(**kvargs)</span>
|
220
|
+
|
221
|
+
<span class="method-click-advice">click to toggle source</span>
|
222
|
+
|
223
|
+
</div>
|
224
|
+
|
225
|
+
|
226
|
+
<div class="method-description">
|
227
|
+
|
228
|
+
<p>Parameters:</p>
|
229
|
+
|
230
|
+
<pre class="ruby"><span class="ruby-identifier">extensions</span><span class="ruby-operator">:</span> <span class="ruby-constant">An</span> <span class="ruby-identifier">array</span> <span class="ruby-identifier">of</span> <span class="ruby-identifier">file</span> <span class="ruby-identifier">extensions</span> (<span class="ruby-identifier">without</span> <span class="ruby-identifier">the</span> <span class="ruby-identifier">leading</span> <span class="ruby-identifier">dot</span>)
|
231
|
+
<span class="ruby-identifier">that</span> <span class="ruby-identifier">this</span> <span class="ruby-constant">ExtensionHandler</span> <span class="ruby-identifier">supports</span>.
|
232
|
+
|
233
|
+
<span class="ruby-identifier">usurps</span><span class="ruby-operator">:</span> <span class="ruby-constant">Future</span>.
|
234
|
+
<span class="ruby-constant">Lets</span> <span class="ruby-identifier">this</span> <span class="ruby-constant">ExtensionHandler</span> <span class="ruby-identifier">take</span> <span class="ruby-identifier">priority</span> <span class="ruby-identifier">over</span> <span class="ruby-identifier">other</span>
|
235
|
+
<span class="ruby-identifier">ones</span>. <span class="ruby-constant">For</span> <span class="ruby-identifier">example</span>, <span class="ruby-identifier">most</span> <span class="ruby-identifier">third</span><span class="ruby-operator">-</span><span class="ruby-identifier">party</span> <span class="ruby-identifier">handlers</span> <span class="ruby-identifier">would</span>
|
236
|
+
<span class="ruby-identifier">probably</span> <span class="ruby-identifier">usurp</span> <span class="ruby-identifier">the</span> .<span class="ruby-identifier">apw</span> <span class="ruby-constant">NetLinx</span> <span class="ruby-constant">Studio</span> <span class="ruby-identifier">workspace</span>
|
237
|
+
<span class="ruby-identifier">extension</span>.
|
238
|
+
|
239
|
+
<span class="ruby-identifier">is_a_workspace</span><span class="ruby-operator">:</span> <span class="ruby-constant">Set</span> <span class="ruby-identifier">to</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">this</span> <span class="ruby-constant">ExtensionHandler</span> <span class="ruby-identifier">is</span> <span class="ruby-keyword">for</span>
|
240
|
+
<span class="ruby-identifier">compiling</span> <span class="ruby-identifier">a</span> <span class="ruby-identifier">workspace</span>. <span class="ruby-constant">False</span> <span class="ruby-identifier">by</span> <span class="ruby-identifier">default</span>. <span class="ruby-constant">This</span>
|
241
|
+
<span class="ruby-identifier">parameter</span> <span class="ruby-identifier">assists</span> <span class="ruby-identifier">with</span> <span class="ruby-identifier">smart</span> <span class="ruby-identifier">compiling</span>, <span class="ruby-identifier">as</span>
|
242
|
+
<span class="ruby-constant">ExtensionDiscovery</span> <span class="ruby-identifier">can</span> <span class="ruby-keyword">return</span> <span class="ruby-identifier">all</span> <span class="ruby-identifier">workspace_handlers</span>.
|
243
|
+
|
244
|
+
<span class="ruby-identifier">handler_class</span><span class="ruby-operator">:</span> <span class="ruby-constant">A</span> <span class="ruby-identifier">reference</span> <span class="ruby-identifier">to</span> <span class="ruby-identifier">the</span> <span class="ruby-keyword">class</span> <span class="ruby-identifier">that</span> <span class="ruby-identifier">should</span> <span class="ruby-identifier">be</span> <span class="ruby-identifier">instantiated</span>
|
245
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">this</span> <span class="ruby-identifier">handler</span> <span class="ruby-identifier">is</span> <span class="ruby-identifier">selected</span>. <span class="ruby-constant">For</span> <span class="ruby-identifier">example</span>,
|
246
|
+
<span class="ruby-constant">NetLinx</span><span class="ruby-operator">::</span><span class="ruby-constant">SourceFile</span> <span class="ruby-identifier">is</span> <span class="ruby-identifier">the</span> <span class="ruby-keyword">class</span> <span class="ruby-identifier">that</span> <span class="ruby-identifier">handles</span> <span class="ruby-identifier">files</span>
|
247
|
+
<span class="ruby-identifier">with</span> <span class="ruby-identifier">the</span> .<span class="ruby-identifier">axs</span> <span class="ruby-identifier">extension</span>.
|
248
|
+
</pre>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
<div class="method-source-code" id="new-source">
|
254
|
+
<pre><span class="ruby-comment"># File lib/netlinx/compile/extension_handler.rb, line 37</span>
|
255
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">**</span><span class="ruby-identifier">kvargs</span>)
|
256
|
+
<span class="ruby-ivar">@extensions</span> = <span class="ruby-identifier">kvargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:extensions</span>, []
|
257
|
+
<span class="ruby-ivar">@usurps</span> = <span class="ruby-identifier">kvargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:usurps</span>, []
|
258
|
+
<span class="ruby-ivar">@is_a_workspace</span> = <span class="ruby-identifier">kvargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:is_a_workspace</span>, <span class="ruby-keyword">false</span>
|
259
|
+
<span class="ruby-ivar">@handler_class</span> = <span class="ruby-identifier">kvargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:handler_class</span>, <span class="ruby-keyword">nil</span>
|
260
|
+
<span class="ruby-keyword">end</span></pre>
|
261
|
+
</div><!-- new-source -->
|
262
|
+
|
263
|
+
</div>
|
264
|
+
|
265
|
+
|
266
|
+
|
267
|
+
|
268
|
+
</div><!-- new-method -->
|
269
|
+
|
270
|
+
|
271
|
+
</section><!-- public-class-method-details -->
|
272
|
+
|
273
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section section">
|
274
|
+
<h3 class="section-header">Public Instance Methods</h3>
|
275
|
+
|
276
|
+
|
277
|
+
<div id="method-i-3C-3C" class="method-detail ">
|
278
|
+
|
279
|
+
<div class="method-heading">
|
280
|
+
<span class="method-name"><<</span><span
|
281
|
+
class="method-args">(file_extension)</span>
|
282
|
+
|
283
|
+
<span class="method-click-advice">click to toggle source</span>
|
284
|
+
|
285
|
+
</div>
|
286
|
+
|
287
|
+
|
288
|
+
<div class="method-description">
|
289
|
+
|
290
|
+
<p>Alias to add a file extension.</p>
|
291
|
+
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
<div class="method-source-code" id="3C-3C-source">
|
296
|
+
<pre><span class="ruby-comment"># File lib/netlinx/compile/extension_handler.rb, line 45</span>
|
297
|
+
<span class="ruby-keyword">def</span> <span class="ruby-operator"><<</span>(<span class="ruby-identifier">file_extension</span>)
|
298
|
+
<span class="ruby-ivar">@extensions</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parse_extension</span>(<span class="ruby-identifier">file_extension</span>)
|
299
|
+
<span class="ruby-keyword">end</span></pre>
|
300
|
+
</div><!-- 3C-3C-source -->
|
301
|
+
|
302
|
+
</div>
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
</div><!-- 3C-3C-method -->
|
308
|
+
|
309
|
+
|
310
|
+
<div id="method-i-include-3F" class="method-detail ">
|
311
|
+
|
312
|
+
<div class="method-heading">
|
313
|
+
<span class="method-name">include?</span><span
|
314
|
+
class="method-args">(file_extension)</span>
|
315
|
+
|
316
|
+
<span class="method-click-advice">click to toggle source</span>
|
317
|
+
|
318
|
+
</div>
|
319
|
+
|
320
|
+
|
321
|
+
<div class="method-description">
|
322
|
+
|
323
|
+
<p>Returns true if this <a href="ExtensionHandler.html">ExtensionHandler</a>
|
324
|
+
can handle the specified file extension.</p>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
<div class="method-source-code" id="include-3F-source">
|
330
|
+
<pre><span class="ruby-comment"># File lib/netlinx/compile/extension_handler.rb, line 64</span>
|
331
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">include?</span>(<span class="ruby-identifier">file_extension</span>)
|
332
|
+
<span class="ruby-ivar">@extensions</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">parse_extension</span>(<span class="ruby-identifier">file_extension</span>)
|
333
|
+
<span class="ruby-keyword">end</span></pre>
|
334
|
+
</div><!-- include-3F-source -->
|
335
|
+
|
336
|
+
</div>
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
</div><!-- include-3F-method -->
|
342
|
+
|
343
|
+
|
344
|
+
<div id="method-i-is_a_workspace-3F" class="method-detail ">
|
345
|
+
|
346
|
+
<div class="method-heading">
|
347
|
+
<span class="method-name">is_a_workspace?</span><span
|
348
|
+
class="method-args">()</span>
|
349
|
+
|
350
|
+
<span class="method-click-advice">click to toggle source</span>
|
351
|
+
|
352
|
+
</div>
|
353
|
+
|
354
|
+
|
355
|
+
<div class="method-description">
|
356
|
+
|
357
|
+
<p>Returns true if the <a href="ExtensionHandler.html">ExtensionHandler</a>
|
358
|
+
handles a workspace file (as opposed to a source code file).</p>
|
359
|
+
|
360
|
+
<p>Workspace files are significant because they contain information about a
|
361
|
+
project, connection settings for a master, and possibly multiple systems
|
362
|
+
that need to be compiled. Therefore, when smart-compiling, workspaces need
|
363
|
+
to be distinguished from source code files because discovering a workspace
|
364
|
+
should be considered a better match than discovering a source code file.</p>
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
|
369
|
+
<div class="method-source-code" id="is_a_workspace-3F-source">
|
370
|
+
<pre><span class="ruby-comment"># File lib/netlinx/compile/extension_handler.rb, line 58</span>
|
371
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">is_a_workspace?</span>
|
372
|
+
<span class="ruby-ivar">@is_a_workspace</span>
|
373
|
+
<span class="ruby-keyword">end</span></pre>
|
374
|
+
</div><!-- is_a_workspace-3F-source -->
|
375
|
+
|
376
|
+
</div>
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
|
381
|
+
</div><!-- is_a_workspace-3F-method -->
|
382
|
+
|
383
|
+
|
384
|
+
</section><!-- public-instance-method-details -->
|
385
|
+
|
386
|
+
</section><!-- 5Buntitled-5D -->
|
387
|
+
|
388
|
+
</div><!-- documentation -->
|
389
|
+
|
390
|
+
|
391
|
+
<footer id="validator-badges">
|
392
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
393
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.1.
|
394
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
395
|
+
</footer>
|
396
|
+
|
@@ -0,0 +1,293 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
|
6
|
+
|
7
|
+
<title>class NetLinx::Compile::Script - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<link type="text/css" media="screen" href="../../rdoc.css" rel="stylesheet">
|
10
|
+
|
11
|
+
<script type="text/javascript">
|
12
|
+
var rdoc_rel_prefix = "../../";
|
13
|
+
</script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
16
|
+
<script type="text/javascript" charset="utf-8" src="../../js/navigation.js"></script>
|
17
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search_index.js"></script>
|
18
|
+
<script type="text/javascript" charset="utf-8" src="../../js/search.js"></script>
|
19
|
+
<script type="text/javascript" charset="utf-8" src="../../js/searcher.js"></script>
|
20
|
+
<script type="text/javascript" charset="utf-8" src="../../js/darkfish.js"></script>
|
21
|
+
|
22
|
+
|
23
|
+
<body id="top" class="class">
|
24
|
+
<nav id="metadata">
|
25
|
+
<nav id="home-section" class="section">
|
26
|
+
<h3 class="section-header">
|
27
|
+
<a href="../../index.html">Home</a>
|
28
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
29
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
30
|
+
</h3>
|
31
|
+
</nav>
|
32
|
+
|
33
|
+
|
34
|
+
<nav id="search-section" class="section project-section" class="initially-hidden">
|
35
|
+
<form action="#" method="get" accept-charset="utf-8">
|
36
|
+
<h3 class="section-header">
|
37
|
+
<input type="text" name="search" placeholder="Search" id="search-field"
|
38
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
39
|
+
</h3>
|
40
|
+
</form>
|
41
|
+
|
42
|
+
<ul id="search-results" class="initially-hidden"></ul>
|
43
|
+
</nav>
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
<div id="file-metadata">
|
49
|
+
<nav id="file-list-section" class="section">
|
50
|
+
<h3 class="section-header">Defined In</h3>
|
51
|
+
<ul>
|
52
|
+
<li>lib/netlinx/compile/script.rb
|
53
|
+
</ul>
|
54
|
+
</nav>
|
55
|
+
|
56
|
+
|
57
|
+
</div>
|
58
|
+
|
59
|
+
<div id="class-metadata">
|
60
|
+
|
61
|
+
<nav id="parent-class-section" class="section">
|
62
|
+
<h3 class="section-header">Parent</h3>
|
63
|
+
|
64
|
+
<p class="link">Object
|
65
|
+
|
66
|
+
</nav>
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
<!-- Method Quickref -->
|
71
|
+
<nav id="method-list-section" class="section">
|
72
|
+
<h3 class="section-header">Methods</h3>
|
73
|
+
|
74
|
+
<ul class="link-list">
|
75
|
+
|
76
|
+
<li ><a href="#method-c-run">::run</a>
|
77
|
+
|
78
|
+
</ul>
|
79
|
+
</nav>
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<div id="project-metadata">
|
84
|
+
|
85
|
+
<nav id="classindex-section" class="section project-section">
|
86
|
+
<h3 class="section-header">Class and Module Index</h3>
|
87
|
+
|
88
|
+
<ul class="link-list">
|
89
|
+
|
90
|
+
<li><a href="../../NetLinx.html">NetLinx</a>
|
91
|
+
|
92
|
+
<li><a href="../../NetLinx/Compile.html">NetLinx::Compile</a>
|
93
|
+
|
94
|
+
<li><a href="../../NetLinx/Compile/Extension.html">NetLinx::Compile::Extension</a>
|
95
|
+
|
96
|
+
<li><a href="../../NetLinx/Compile/Extension/AXS.html">NetLinx::Compile::Extension::AXS</a>
|
97
|
+
|
98
|
+
<li><a href="../../NetLinx/Compile/ExtensionDiscovery.html">NetLinx::Compile::ExtensionDiscovery</a>
|
99
|
+
|
100
|
+
<li><a href="../../NetLinx/Compile/ExtensionHandler.html">NetLinx::Compile::ExtensionHandler</a>
|
101
|
+
|
102
|
+
<li><a href="../../NetLinx/Compile/Script.html">NetLinx::Compile::Script</a>
|
103
|
+
|
104
|
+
<li><a href="../../NetLinx/Compiler.html">NetLinx::Compiler</a>
|
105
|
+
|
106
|
+
<li><a href="../../NetLinx/CompilerResult.html">NetLinx::CompilerResult</a>
|
107
|
+
|
108
|
+
<li><a href="../../NetLinx/NoCompilerError.html">NetLinx::NoCompilerError</a>
|
109
|
+
|
110
|
+
<li><a href="../../NetLinx/SourceFile.html">NetLinx::SourceFile</a>
|
111
|
+
|
112
|
+
<li><a href="../../Test.html">Test</a>
|
113
|
+
|
114
|
+
<li><a href="../../Test/NetLinx.html">Test::NetLinx</a>
|
115
|
+
|
116
|
+
<li><a href="../../Test/NetLinx/Compilable.html">Test::NetLinx::Compilable</a>
|
117
|
+
|
118
|
+
<li><a href="../../Test/NetLinx/Compile.html">Test::NetLinx::Compile</a>
|
119
|
+
|
120
|
+
<li><a href="../../Test/NetLinx/Compile/Discoverable.html">Test::NetLinx::Compile::Discoverable</a>
|
121
|
+
|
122
|
+
<li><a href="../../Test/NetLinx/Compile/Invokable.html">Test::NetLinx::Compile::Invokable</a>
|
123
|
+
|
124
|
+
</ul>
|
125
|
+
</nav>
|
126
|
+
|
127
|
+
</div>
|
128
|
+
</nav>
|
129
|
+
|
130
|
+
<div id="documentation">
|
131
|
+
<h1 class="class">class NetLinx::Compile::Script</h1>
|
132
|
+
|
133
|
+
<div id="description" class="description">
|
134
|
+
|
135
|
+
<p>The container for the script that runs when netlinx-compile is executed.</p>
|
136
|
+
|
137
|
+
</div><!-- description -->
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
<!-- Methods -->
|
152
|
+
|
153
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section section">
|
154
|
+
<h3 class="section-header">Public Class Methods</h3>
|
155
|
+
|
156
|
+
|
157
|
+
<div id="method-c-run" class="method-detail ">
|
158
|
+
|
159
|
+
<div class="method-heading">
|
160
|
+
<span class="method-name">run</span><span
|
161
|
+
class="method-args">(**kvargs)</span>
|
162
|
+
|
163
|
+
<span class="method-click-advice">click to toggle source</span>
|
164
|
+
|
165
|
+
</div>
|
166
|
+
|
167
|
+
|
168
|
+
<div class="method-description">
|
169
|
+
|
170
|
+
<p>Run the script.</p>
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
<div class="method-source-code" id="run-source">
|
176
|
+
<pre><span class="ruby-comment"># File lib/netlinx/compile/script.rb, line 13</span>
|
177
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier">run</span>(<span class="ruby-operator">**</span><span class="ruby-identifier">kvargs</span>)
|
178
|
+
<span class="ruby-comment"># :argv is a convenience to override ARGV, like for testing.</span>
|
179
|
+
<span class="ruby-identifier">args</span> = <span class="ruby-identifier">kvargs</span>.<span class="ruby-identifier">fetch</span> <span class="ruby-value">:argv</span>, <span class="ruby-constant">ARGV</span>
|
180
|
+
|
181
|
+
<span class="ruby-comment"># Command line options.</span>
|
182
|
+
<span class="ruby-ivar">@options</span> = <span class="ruby-constant">OpenStruct</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">source</span><span class="ruby-operator">:</span> <span class="ruby-string">''</span>,
|
183
|
+
<span class="ruby-identifier">include_paths</span><span class="ruby-operator">:</span> [],
|
184
|
+
<span class="ruby-identifier">use_workspace</span><span class="ruby-operator">:</span> <span class="ruby-keyword">false</span>
|
185
|
+
|
186
|
+
<span class="ruby-constant">OptionParser</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">opts</span><span class="ruby-operator">|</span>
|
187
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">banner</span> = <span class="ruby-string">"Usage: netlinx-compile [options]"</span>
|
188
|
+
|
189
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span> <span class="ruby-string">'-h'</span>, <span class="ruby-string">'--help'</span>, <span class="ruby-string">'Display this help screen.'</span> <span class="ruby-keyword">do</span>
|
190
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">opts</span>
|
191
|
+
<span class="ruby-identifier">exit</span>
|
192
|
+
<span class="ruby-keyword">end</span>
|
193
|
+
|
194
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span> <span class="ruby-string">'-s'</span>, <span class="ruby-string">'--source FILE'</span>, <span class="ruby-string">'Source file to compile.'</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
195
|
+
<span class="ruby-ivar">@options</span>.<span class="ruby-identifier">source</span> = <span class="ruby-identifier">v</span>
|
196
|
+
<span class="ruby-keyword">end</span>
|
197
|
+
|
198
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span> <span class="ruby-string">'-i'</span>, <span class="ruby-string">'--include [Path1,Path2]'</span>, <span class="ruby-constant">Array</span>, <span class="ruby-string">'Additional include and module paths.'</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
199
|
+
<span class="ruby-ivar">@options</span>.<span class="ruby-identifier">include_paths</span> = <span class="ruby-identifier">v</span>
|
200
|
+
<span class="ruby-keyword">end</span>
|
201
|
+
|
202
|
+
<span class="ruby-identifier">opts</span>.<span class="ruby-identifier">on</span> <span class="ruby-string">'-w'</span>, <span class="ruby-string">'--workspace'</span>, <span class="ruby-string">'--smart'</span>,
|
203
|
+
<span class="ruby-string">'Search up directory tree for a workspace'</span>,
|
204
|
+
<span class="ruby-string">'containing the source file.'</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
205
|
+
<span class="ruby-ivar">@options</span>.<span class="ruby-identifier">use_workspace</span> = <span class="ruby-identifier">v</span>
|
206
|
+
<span class="ruby-keyword">end</span>
|
207
|
+
|
208
|
+
<span class="ruby-keyword">end</span>.<span class="ruby-identifier">parse!</span> <span class="ruby-identifier">args</span>
|
209
|
+
|
210
|
+
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">source</span>.<span class="ruby-identifier">empty?</span>
|
211
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-string">"No source file specified.\nRun \"netlinx-compile -h\" for help."</span>
|
212
|
+
<span class="ruby-identifier">exit</span>
|
213
|
+
<span class="ruby-keyword">end</span>
|
214
|
+
|
215
|
+
<span class="ruby-comment"># Find an ExtensionHandler for the given file.</span>
|
216
|
+
<span class="ruby-constant">ExtensionDiscovery</span>.<span class="ruby-identifier">discover</span>
|
217
|
+
<span class="ruby-identifier">source_file</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">source</span>
|
218
|
+
<span class="ruby-identifier">handler</span> = <span class="ruby-constant">NetLinx</span><span class="ruby-operator">::</span><span class="ruby-constant">Compile</span><span class="ruby-operator">::</span><span class="ruby-constant">ExtensionDiscovery</span>.<span class="ruby-identifier">get_handler</span> <span class="ruby-identifier">source_file</span>
|
219
|
+
|
220
|
+
<span class="ruby-comment"># If the handler is a workspace handler, go straight to compiling it.</span>
|
221
|
+
<span class="ruby-comment"># Otherwise, if the use_workspace flag is true, search up through the</span>
|
222
|
+
<span class="ruby-comment"># directory tree to try to find a workspace that includes the</span>
|
223
|
+
<span class="ruby-comment"># specified source file.</span>
|
224
|
+
<span class="ruby-keyword">if</span> (<span class="ruby-keyword">not</span> <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">is_a_workspace?</span>) <span class="ruby-operator">&&</span> <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">use_workspace</span>
|
225
|
+
<span class="ruby-identifier">workspace_extensions</span> = <span class="ruby-constant">NetLinx</span><span class="ruby-operator">::</span><span class="ruby-constant">Compile</span><span class="ruby-operator">::</span><span class="ruby-constant">ExtensionDiscovery</span>.<span class="ruby-identifier">workspace_extensions</span>
|
226
|
+
|
227
|
+
<span class="ruby-identifier">dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span> <span class="ruby-string">'.'</span>
|
228
|
+
<span class="ruby-keyword">while</span> <span class="ruby-identifier">dir</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-string">'..'</span>, <span class="ruby-identifier">dir</span>) <span class="ruby-keyword">do</span>
|
229
|
+
<span class="ruby-identifier">workspaces</span> = <span class="ruby-constant">Dir</span>[<span class="ruby-node">"#{dir}/*.{#{workspace_extensions.join ','}}"</span>]
|
230
|
+
|
231
|
+
<span class="ruby-keyword">unless</span> <span class="ruby-identifier">workspaces</span>.<span class="ruby-identifier">empty?</span>
|
232
|
+
<span class="ruby-comment"># TODO: Handle workspace file extension usurping logic here.</span>
|
233
|
+
|
234
|
+
<span class="ruby-identifier">new_source_file</span> = <span class="ruby-identifier">workspaces</span>.<span class="ruby-identifier">first</span>
|
235
|
+
<span class="ruby-identifier">new_handler</span> = <span class="ruby-constant">NetLinx</span><span class="ruby-operator">::</span><span class="ruby-constant">Compile</span><span class="ruby-operator">::</span><span class="ruby-constant">ExtensionDiscovery</span>.<span class="ruby-identifier">get_handler</span> <span class="ruby-identifier">new_source_file</span>
|
236
|
+
<span class="ruby-identifier">new_handler_class</span> = <span class="ruby-identifier">new_handler</span>.<span class="ruby-identifier">handler_class</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">file</span><span class="ruby-operator">:</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">new_source_file</span>)
|
237
|
+
|
238
|
+
<span class="ruby-comment"># If supported by the new_handler, make sure the source_file is</span>
|
239
|
+
<span class="ruby-comment"># included in the workspace before overwriting the old handler.</span>
|
240
|
+
<span class="ruby-identifier">overwrite_old_handler</span> = <span class="ruby-keyword">false</span>
|
241
|
+
|
242
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">new_handler_class</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:include?</span>
|
243
|
+
<span class="ruby-identifier">overwrite_old_handler</span> = <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">new_handler_class</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">source_file</span>
|
244
|
+
<span class="ruby-keyword">else</span>
|
245
|
+
<span class="ruby-comment"># Workspace doesn't expose an interface to see if it</span>
|
246
|
+
<span class="ruby-comment"># includes the source file, so assume it does.</span>
|
247
|
+
<span class="ruby-comment"># Otherwise the user could have compiled without the</span>
|
248
|
+
<span class="ruby-comment"># workspace flag.</span>
|
249
|
+
<span class="ruby-identifier">overwrite_old_handler</span> = <span class="ruby-keyword">true</span>
|
250
|
+
<span class="ruby-keyword">end</span>
|
251
|
+
|
252
|
+
<span class="ruby-keyword">if</span> <span class="ruby-identifier">overwrite_old_handler</span>
|
253
|
+
<span class="ruby-identifier">source_file</span> = <span class="ruby-identifier">new_source_file</span>
|
254
|
+
<span class="ruby-identifier">handler</span> = <span class="ruby-identifier">new_handler</span>
|
255
|
+
<span class="ruby-identifier">handler_class</span> = <span class="ruby-identifier">new_handler_class</span>
|
256
|
+
<span class="ruby-keyword">break</span>
|
257
|
+
<span class="ruby-keyword">end</span>
|
258
|
+
<span class="ruby-keyword">end</span>
|
259
|
+
|
260
|
+
<span class="ruby-identifier">dir</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span> <span class="ruby-string">'..'</span>, <span class="ruby-identifier">dir</span>
|
261
|
+
<span class="ruby-keyword">end</span>
|
262
|
+
<span class="ruby-keyword">end</span>
|
263
|
+
|
264
|
+
<span class="ruby-comment"># Instantiate the class that can handle compiling of the file.</span>
|
265
|
+
<span class="ruby-identifier">handler_class</span> = <span class="ruby-identifier">handler</span>.<span class="ruby-identifier">handler_class</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">file</span><span class="ruby-operator">:</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">source_file</span>)
|
266
|
+
|
267
|
+
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">handler_class</span>.<span class="ruby-identifier">compile</span>
|
268
|
+
|
269
|
+
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">map</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">r</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>.<span class="ruby-identifier">to_s</span>}
|
270
|
+
<span class="ruby-keyword">end</span></pre>
|
271
|
+
</div><!-- run-source -->
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
</div><!-- run-method -->
|
279
|
+
|
280
|
+
|
281
|
+
</section><!-- public-class-method-details -->
|
282
|
+
|
283
|
+
</section><!-- 5Buntitled-5D -->
|
284
|
+
|
285
|
+
</div><!-- documentation -->
|
286
|
+
|
287
|
+
|
288
|
+
<footer id="validator-badges">
|
289
|
+
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
|
290
|
+
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.1.
|
291
|
+
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
|
292
|
+
</footer>
|
293
|
+
|