tool-shed 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -1
- data/Gemfile.lock +82 -0
- data/README.md +7 -5
- data/bin/as-asset-detector +0 -0
- data/lib/shed/asdoc_package.rb +1 -1
- data/lib/shed/manifest.rb +12 -4
- data/lib/shed/opts/manifest_opts.rb +11 -4
- data/lib/shed/opts/tool_opts.rb +8 -5
- data/lib/shed/opts/unused_asset_opts.rb +1 -1
- data/lib/shed/opts/unused_class_opts.rb +16 -1
- data/lib/shed/opts/unused_style_opts.rb +1 -1
- data/lib/shed/search.rb +6 -5
- data/lib/shed/tool.rb +16 -3
- data/lib/shed/unused_asset.rb +37 -12
- data/lib/shed/unused_class.rb +4 -4
- data/lib/shed/version.rb +1 -1
- data/rakefile.rb +20 -84
- data/test/fixtures/unused-asset/src/org/helvector/ToolBox.mxml +4 -0
- data/test/test_helper.rb +13 -0
- data/test/unit/test_manifest.rb +23 -2
- data/test/unit/test_manifest_opts.rb +15 -0
- data/test/unit/test_search.rb +16 -4
- data/test/unit/test_unused_asset.rb +24 -14
- data/test/unit/test_unused_class_opts.rb +28 -1
- metadata +41 -69
- data/coverage/unit/index.html +0 -330
- data/coverage/unit/jquery-1.3.2.min.js +0 -19
- data/coverage/unit/jquery.tablesorter.min.js +0 -15
- data/coverage/unit/lib-hel-asdoc_package_rb.html +0 -447
- data/coverage/unit/lib-hel-manifest_rb.html +0 -555
- data/coverage/unit/lib-hel-opts-asdoc_package_opts_rb.html +0 -195
- data/coverage/unit/lib-hel-opts-manifest_opts_rb.html +0 -195
- data/coverage/unit/lib-hel-opts-tool_opts_rb.html +0 -531
- data/coverage/unit/lib-hel-opts-unused_class_opts_rb.html +0 -207
- data/coverage/unit/lib-hel-opts-unused_style_opts_rb.html +0 -201
- data/coverage/unit/lib-hel-project_tools_rb.html +0 -423
- data/coverage/unit/lib-hel-search_rb.html +0 -363
- data/coverage/unit/lib-hel-stripper_rb.html +0 -357
- data/coverage/unit/lib-hel-tool_rb.html +0 -423
- data/coverage/unit/lib-hel-unused_class_rb.html +0 -675
- data/coverage/unit/lib-hel-unused_style_rb.html +0 -747
- data/coverage/unit/lib-hel-version_rb.html +0 -135
- data/coverage/unit/lib-hel_tools_rb.html +0 -165
- data/coverage/unit/print.css +0 -12
- data/coverage/unit/rcov.js +0 -42
- data/coverage/unit/screen.css +0 -270
- data/coverage.data +0 -0
- data/rdoc/classes/ASDocPackage.html +0 -281
- data/rdoc/classes/ASDocPackageOpts.html +0 -204
- data/rdoc/classes/Manifest.html +0 -323
- data/rdoc/classes/ManifestOpts.html +0 -205
- data/rdoc/classes/ProjectTools.html +0 -302
- data/rdoc/classes/Search.html +0 -203
- data/rdoc/classes/Stripper.html +0 -223
- data/rdoc/classes/Tool.html +0 -313
- data/rdoc/classes/ToolOpts.html +0 -297
- data/rdoc/classes/UnusedClass.html +0 -258
- data/rdoc/classes/UnusedClassOpts.html +0 -206
- data/rdoc/classes/UnusedStyle.html +0 -277
- data/rdoc/classes/UnusedStyleOpts.html +0 -205
- data/rdoc/created.rid +0 -1
- data/rdoc/files/LICENSE.html +0 -129
- data/rdoc/files/README_md.html +0 -138
- data/rdoc/files/lib/hel/asdoc_package_rb.html +0 -107
- data/rdoc/files/lib/hel/manifest_rb.html +0 -107
- data/rdoc/files/lib/hel/opts/asdoc_package_opts_rb.html +0 -107
- data/rdoc/files/lib/hel/opts/manifest_opts_rb.html +0 -107
- data/rdoc/files/lib/hel/opts/tool_opts_rb.html +0 -114
- data/rdoc/files/lib/hel/opts/unused_class_opts_rb.html +0 -107
- data/rdoc/files/lib/hel/opts/unused_style_opts_rb.html +0 -107
- data/rdoc/files/lib/hel/project_tools_rb.html +0 -107
- data/rdoc/files/lib/hel/search_rb.html +0 -114
- data/rdoc/files/lib/hel/stripper_rb.html +0 -107
- data/rdoc/files/lib/hel/tool_rb.html +0 -107
- data/rdoc/files/lib/hel/unused_class_rb.html +0 -107
- data/rdoc/files/lib/hel/unused_style_rb.html +0 -107
- data/rdoc/files/lib/hel/version_rb.html +0 -107
- data/rdoc/files/lib/hel_tools_rb.html +0 -127
- data/rdoc/fr_class_index.html +0 -39
- data/rdoc/fr_file_index.html +0 -43
- data/rdoc/fr_method_index.html +0 -75
- data/rdoc/index.html +0 -24
- data/rdoc/rdoc-style.css +0 -208
- data/tool-shed-0.0.3.gem +0 -0
- data/tool-shed.gemspec +0 -41
@@ -1,302 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: ProjectTools</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">ProjectTools</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/hel/project_tools_rb.html">
|
59
|
-
lib/hel/project_tools.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
<div id="description">
|
82
|
-
<p>
|
83
|
-
A collection of utility methods to help working with ActionScript source.
|
84
|
-
</p>
|
85
|
-
|
86
|
-
</div>
|
87
|
-
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
<div id="method-list">
|
92
|
-
<h3 class="section-bar">Methods</h3>
|
93
|
-
|
94
|
-
<div class="name-list">
|
95
|
-
<a href="#M000028">common_src_dirs</a>
|
96
|
-
<a href="#M000033">flex_file_regx</a>
|
97
|
-
<a href="#M000032">import</a>
|
98
|
-
<a href="#M000031">package</a>
|
99
|
-
<a href="#M000030">remove_relative_prefix</a>
|
100
|
-
<a href="#M000029">truncate_to_src</a>
|
101
|
-
</div>
|
102
|
-
</div>
|
103
|
-
|
104
|
-
</div>
|
105
|
-
|
106
|
-
|
107
|
-
<!-- if includes -->
|
108
|
-
|
109
|
-
<div id="section">
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
<!-- if method_list -->
|
119
|
-
<div id="methods">
|
120
|
-
<h3 class="section-bar">Public Class methods</h3>
|
121
|
-
|
122
|
-
<div id="method-M000028" class="method-detail">
|
123
|
-
<a name="M000028"></a>
|
124
|
-
|
125
|
-
<div class="method-heading">
|
126
|
-
<a href="#M000028" class="method-signature">
|
127
|
-
<span class="method-name">common_src_dirs</span><span class="method-args">()</span>
|
128
|
-
</a>
|
129
|
-
</div>
|
130
|
-
|
131
|
-
<div class="method-description">
|
132
|
-
<p>
|
133
|
-
Returns an array of directory names that are commonly used as the root
|
134
|
-
directory for source files.
|
135
|
-
</p>
|
136
|
-
<p><a class="source-toggle" href="#"
|
137
|
-
onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
|
138
|
-
<div class="method-source-code" id="M000028-source">
|
139
|
-
<pre>
|
140
|
-
<span class="ruby-comment cmt"># File lib/hel/project_tools.rb, line 12</span>
|
141
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">common_src_dirs</span>
|
142
|
-
[<span class="ruby-value str">'src'</span>,<span class="ruby-value str">'source'</span>,<span class="ruby-value str">'test'</span>,<span class="ruby-value str">'lib'</span>]
|
143
|
-
<span class="ruby-keyword kw">end</span>
|
144
|
-
</pre>
|
145
|
-
</div>
|
146
|
-
</div>
|
147
|
-
</div>
|
148
|
-
|
149
|
-
<div id="method-M000033" class="method-detail">
|
150
|
-
<a name="M000033"></a>
|
151
|
-
|
152
|
-
<div class="method-heading">
|
153
|
-
<a href="#M000033" class="method-signature">
|
154
|
-
<span class="method-name">flex_file_regx</span><span class="method-args">()</span>
|
155
|
-
</a>
|
156
|
-
</div>
|
157
|
-
|
158
|
-
<div class="method-description">
|
159
|
-
<p>
|
160
|
-
Regular expression to match files we expect to find in a ActionScript/Flex
|
161
|
-
project.
|
162
|
-
</p>
|
163
|
-
<p><a class="source-toggle" href="#"
|
164
|
-
onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
|
165
|
-
<div class="method-source-code" id="M000033-source">
|
166
|
-
<pre>
|
167
|
-
<span class="ruby-comment cmt"># File lib/hel/project_tools.rb, line 56</span>
|
168
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">flex_file_regx</span>
|
169
|
-
<span class="ruby-regexp re">/\.(as|mxml|asdoc)$/</span>
|
170
|
-
<span class="ruby-keyword kw">end</span>
|
171
|
-
</pre>
|
172
|
-
</div>
|
173
|
-
</div>
|
174
|
-
</div>
|
175
|
-
|
176
|
-
<div id="method-M000032" class="method-detail">
|
177
|
-
<a name="M000032"></a>
|
178
|
-
|
179
|
-
<div class="method-heading">
|
180
|
-
<a href="#M000032" class="method-signature">
|
181
|
-
<span class="method-name">import</span><span class="method-args">(path)</span>
|
182
|
-
</a>
|
183
|
-
</div>
|
184
|
-
|
185
|
-
<div class="method-description">
|
186
|
-
<p>
|
187
|
-
Takes a file path and converts it to a <a
|
188
|
-
href="ProjectTools.html#M000032">import</a> path using conventionally named
|
189
|
-
source folders as the root marker.
|
190
|
-
</p>
|
191
|
-
<p><a class="source-toggle" href="#"
|
192
|
-
onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
|
193
|
-
<div class="method-source-code" id="M000032-source">
|
194
|
-
<pre>
|
195
|
-
<span class="ruby-comment cmt"># File lib/hel/project_tools.rb, line 48</span>
|
196
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">import</span>(<span class="ruby-identifier">path</span>)
|
197
|
-
<span class="ruby-identifier">truncate_to_src</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'/'</span>,<span class="ruby-value str">'.'</span>).<span class="ruby-identifier">sub</span>(<span class="ruby-identifier">flex_file_regx</span>,<span class="ruby-value str">''</span>)
|
198
|
-
<span class="ruby-keyword kw">end</span>
|
199
|
-
</pre>
|
200
|
-
</div>
|
201
|
-
</div>
|
202
|
-
</div>
|
203
|
-
|
204
|
-
<div id="method-M000031" class="method-detail">
|
205
|
-
<a name="M000031"></a>
|
206
|
-
|
207
|
-
<div class="method-heading">
|
208
|
-
<a href="#M000031" class="method-signature">
|
209
|
-
<span class="method-name">package</span><span class="method-args">(path)</span>
|
210
|
-
</a>
|
211
|
-
</div>
|
212
|
-
|
213
|
-
<div class="method-description">
|
214
|
-
<p>
|
215
|
-
Takes a file path and converts it to a <a
|
216
|
-
href="ProjectTools.html#M000031">package</a> path using conventionally
|
217
|
-
named source folders as the root marker.
|
218
|
-
</p>
|
219
|
-
<p><a class="source-toggle" href="#"
|
220
|
-
onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
|
221
|
-
<div class="method-source-code" id="M000031-source">
|
222
|
-
<pre>
|
223
|
-
<span class="ruby-comment cmt"># File lib/hel/project_tools.rb, line 38</span>
|
224
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">package</span>(<span class="ruby-identifier">path</span>)
|
225
|
-
<span class="ruby-identifier">path</span> = <span class="ruby-identifier">remove_relative_prefix</span>(<span class="ruby-identifier">path</span>)
|
226
|
-
<span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">dirname</span>(<span class="ruby-identifier">path</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">flex_file_regx</span>
|
227
|
-
<span class="ruby-identifier">truncate_to_src</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">'/'</span>,<span class="ruby-value str">'.'</span>)
|
228
|
-
<span class="ruby-keyword kw">end</span>
|
229
|
-
</pre>
|
230
|
-
</div>
|
231
|
-
</div>
|
232
|
-
</div>
|
233
|
-
|
234
|
-
<div id="method-M000030" class="method-detail">
|
235
|
-
<a name="M000030"></a>
|
236
|
-
|
237
|
-
<div class="method-heading">
|
238
|
-
<a href="#M000030" class="method-signature">
|
239
|
-
<span class="method-name">remove_relative_prefix</span><span class="method-args">(path)</span>
|
240
|
-
</a>
|
241
|
-
</div>
|
242
|
-
|
243
|
-
<div class="method-description">
|
244
|
-
<p>
|
245
|
-
Removes any relative prefixes found in the provided path.
|
246
|
-
</p>
|
247
|
-
<p><a class="source-toggle" href="#"
|
248
|
-
onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
|
249
|
-
<div class="method-source-code" id="M000030-source">
|
250
|
-
<pre>
|
251
|
-
<span class="ruby-comment cmt"># File lib/hel/project_tools.rb, line 30</span>
|
252
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">remove_relative_prefix</span>(<span class="ruby-identifier">path</span>)
|
253
|
-
<span class="ruby-identifier">path</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/^\W+\b/</span>, <span class="ruby-value str">''</span>)
|
254
|
-
<span class="ruby-keyword kw">end</span>
|
255
|
-
</pre>
|
256
|
-
</div>
|
257
|
-
</div>
|
258
|
-
</div>
|
259
|
-
|
260
|
-
<div id="method-M000029" class="method-detail">
|
261
|
-
<a name="M000029"></a>
|
262
|
-
|
263
|
-
<div class="method-heading">
|
264
|
-
<a href="#M000029" class="method-signature">
|
265
|
-
<span class="method-name">truncate_to_src</span><span class="method-args">(path)</span>
|
266
|
-
</a>
|
267
|
-
</div>
|
268
|
-
|
269
|
-
<div class="method-description">
|
270
|
-
<p>
|
271
|
-
Takes a file path and truncates it to the last matching conventionally
|
272
|
-
named source directory.
|
273
|
-
</p>
|
274
|
-
<p><a class="source-toggle" href="#"
|
275
|
-
onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
|
276
|
-
<div class="method-source-code" id="M000029-source">
|
277
|
-
<pre>
|
278
|
-
<span class="ruby-comment cmt"># File lib/hel/project_tools.rb, line 20</span>
|
279
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">truncate_to_src</span>(<span class="ruby-identifier">path</span>)
|
280
|
-
<span class="ruby-identifier">common_src_dirs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">remove</span><span class="ruby-operator">|</span>
|
281
|
-
<span class="ruby-identifier">path</span> = <span class="ruby-identifier">path</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-node">/^.*\b#{remove}\b(\/|$)/</span>, <span class="ruby-value str">''</span>);
|
282
|
-
<span class="ruby-keyword kw">end</span>
|
283
|
-
<span class="ruby-identifier">path</span>
|
284
|
-
<span class="ruby-keyword kw">end</span>
|
285
|
-
</pre>
|
286
|
-
</div>
|
287
|
-
</div>
|
288
|
-
</div>
|
289
|
-
|
290
|
-
|
291
|
-
</div>
|
292
|
-
|
293
|
-
|
294
|
-
</div>
|
295
|
-
|
296
|
-
|
297
|
-
<div id="validator-badges">
|
298
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
299
|
-
</div>
|
300
|
-
|
301
|
-
</body>
|
302
|
-
</html>
|
data/rdoc/classes/Search.html
DELETED
@@ -1,203 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Module: Search</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Module</strong></td>
|
53
|
-
<td class="class-name-in-header">Search</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/hel/search_rb.html">
|
59
|
-
lib/hel/search.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
</table>
|
66
|
-
</div>
|
67
|
-
<!-- banner header -->
|
68
|
-
|
69
|
-
<div id="bodyContent">
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<div id="contextContent">
|
74
|
-
|
75
|
-
<div id="description">
|
76
|
-
<p>
|
77
|
-
Collection of methods for searching directories.
|
78
|
-
</p>
|
79
|
-
|
80
|
-
</div>
|
81
|
-
|
82
|
-
|
83
|
-
</div>
|
84
|
-
|
85
|
-
<div id="method-list">
|
86
|
-
<h3 class="section-bar">Methods</h3>
|
87
|
-
|
88
|
-
<div class="name-list">
|
89
|
-
<a href="#M000045">find_all</a>
|
90
|
-
<a href="#M000046">for_empties</a>
|
91
|
-
</div>
|
92
|
-
</div>
|
93
|
-
|
94
|
-
</div>
|
95
|
-
|
96
|
-
|
97
|
-
<!-- if includes -->
|
98
|
-
|
99
|
-
<div id="section">
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
<!-- if method_list -->
|
109
|
-
<div id="methods">
|
110
|
-
<h3 class="section-bar">Public Class methods</h3>
|
111
|
-
|
112
|
-
<div id="method-M000045" class="method-detail">
|
113
|
-
<a name="M000045"></a>
|
114
|
-
|
115
|
-
<div class="method-heading">
|
116
|
-
<a href="#M000045" class="method-signature">
|
117
|
-
<span class="method-name">find_all</span><span class="method-args">(files_of_type,dir,excluding=[]) {|path| ...}</span>
|
118
|
-
</a>
|
119
|
-
</div>
|
120
|
-
|
121
|
-
<div class="method-description">
|
122
|
-
<p>
|
123
|
-
Searches a directory and it‘s child directories for all the files
|
124
|
-
whose names match the specified regular expression.
|
125
|
-
</p>
|
126
|
-
<p><a class="source-toggle" href="#"
|
127
|
-
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
128
|
-
<div class="method-source-code" id="M000045-source">
|
129
|
-
<pre>
|
130
|
-
<span class="ruby-comment cmt"># File lib/hel/search.rb, line 14</span>
|
131
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">find_all</span>(<span class="ruby-identifier">files_of_type</span>,<span class="ruby-identifier">dir</span>,<span class="ruby-identifier">excluding</span>=[])
|
132
|
-
|
133
|
-
<span class="ruby-constant">Find</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">dir</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">path</span><span class="ruby-operator">|</span>
|
134
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">FileTest</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">path</span>)
|
135
|
-
|
136
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">excluding</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">path</span>))
|
137
|
-
<span class="ruby-constant">Find</span>.<span class="ruby-identifier">prune</span>
|
138
|
-
<span class="ruby-keyword kw">else</span>
|
139
|
-
<span class="ruby-keyword kw">next</span>
|
140
|
-
<span class="ruby-keyword kw">end</span>
|
141
|
-
|
142
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">extname</span>(<span class="ruby-identifier">path</span>) <span class="ruby-operator">=~</span> <span class="ruby-identifier">files_of_type</span>
|
143
|
-
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">path</span>
|
144
|
-
<span class="ruby-keyword kw">end</span>
|
145
|
-
<span class="ruby-keyword kw">end</span>
|
146
|
-
<span class="ruby-keyword kw">end</span>
|
147
|
-
</pre>
|
148
|
-
</div>
|
149
|
-
</div>
|
150
|
-
</div>
|
151
|
-
|
152
|
-
<div id="method-M000046" class="method-detail">
|
153
|
-
<a name="M000046"></a>
|
154
|
-
|
155
|
-
<div class="method-heading">
|
156
|
-
<a href="#M000046" class="method-signature">
|
157
|
-
<span class="method-name">for_empties</span><span class="method-args">(path,excluding=[]) {|p if Dir.entries(p).join =~ /^\.\.\.(\.(svn|git))?$/| ...}</span>
|
158
|
-
</a>
|
159
|
-
</div>
|
160
|
-
|
161
|
-
<div class="method-description">
|
162
|
-
<p>
|
163
|
-
Scans the path and its children for empty directories.
|
164
|
-
</p>
|
165
|
-
<p><a class="source-toggle" href="#"
|
166
|
-
onclick="toggleCode('M000046-source');return false;">[Source]</a></p>
|
167
|
-
<div class="method-source-code" id="M000046-source">
|
168
|
-
<pre>
|
169
|
-
<span class="ruby-comment cmt"># File lib/hel/search.rb, line 34</span>
|
170
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">for_empties</span>(<span class="ruby-identifier">path</span>,<span class="ruby-identifier">excluding</span>=[])
|
171
|
-
|
172
|
-
<span class="ruby-constant">Find</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">path</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
173
|
-
|
174
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">FileTest</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">p</span>)
|
175
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">excluding</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">p</span>))
|
176
|
-
<span class="ruby-constant">Find</span>.<span class="ruby-identifier">prune</span>
|
177
|
-
<span class="ruby-keyword kw">else</span>
|
178
|
-
<span class="ruby-comment cmt"># Any dir that only contains ., .., and .svn or .git are empty.</span>
|
179
|
-
<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">p</span> <span class="ruby-keyword kw">if</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">entries</span>(<span class="ruby-identifier">p</span>).<span class="ruby-identifier">join</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^\.\.\.(\.(svn|git))?$/</span>
|
180
|
-
<span class="ruby-keyword kw">end</span>
|
181
|
-
<span class="ruby-keyword kw">end</span>
|
182
|
-
|
183
|
-
<span class="ruby-keyword kw">end</span>
|
184
|
-
|
185
|
-
<span class="ruby-keyword kw">end</span>
|
186
|
-
</pre>
|
187
|
-
</div>
|
188
|
-
</div>
|
189
|
-
</div>
|
190
|
-
|
191
|
-
|
192
|
-
</div>
|
193
|
-
|
194
|
-
|
195
|
-
</div>
|
196
|
-
|
197
|
-
|
198
|
-
<div id="validator-badges">
|
199
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
200
|
-
</div>
|
201
|
-
|
202
|
-
</body>
|
203
|
-
</html>
|