ratch 0.3.0 → 0.4.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.
- data/{log/history → CHANGES} +0 -0
- data/{log/todo → TODO} +0 -0
- data/bin/manifest +451 -0
- data/bin/ratch +3 -3
- data/demo/task/config.yaml +4 -0
- data/lib/ratch/{batch/argvutils.rb → dsl/argv.rb} +9 -4
- data/lib/ratch/dsl/batch.rb +226 -0
- data/lib/ratch/{batch → dsl}/build.rb +83 -4
- data/lib/ratch/{batch/consoleutils.rb → dsl/console.rb} +13 -5
- data/lib/ratch/{batch/emailutils.rb → dsl/email.rb} +21 -25
- data/lib/ratch/{batch/fileutils.rb → dsl/file.rb} +56 -56
- data/lib/ratch/dsl/meta.rb +132 -0
- data/lib/ratch/{batch → dsl}/options.rb +7 -5
- data/lib/ratch/dsl/setup.rb +124 -0
- data/lib/ratch/{support/signiture.rb → dsl/sign.rb} +9 -18
- data/lib/ratch/dsl/stage.rb +147 -0
- data/lib/ratch/dsl/task.rb +139 -0
- data/lib/ratch/{uploadutils.rb → dsl/upload.rb} +7 -5
- data/lib/ratch/{batch/task.rb → dsl/zip.rb} +30 -14
- data/lib/ratch/dsl.rb +52 -0
- data/lib/ratch/extra/email.rb +5 -0
- data/lib/ratch/extra/stage.rb +5 -0
- data/lib/ratch/extra/zip.rb +5 -0
- data/lib/ratch/manifest.rb +540 -0
- data/lib/ratch/{project → metadata}/information.rb +1 -0
- data/lib/ratch/{project → metadata}/package.rb +28 -2
- data/lib/ratch/{project → metadata}/project.rb +8 -16
- data/lib/ratch/{project → metadata}/release.rb +6 -6
- data/lib/ratch/support/errors.rb +4 -0
- data/lib/ratch/support/filename.rb +18 -0
- data/lib/ratch/toolset/ruby/compile +49 -0
- data/lib/ratch/toolset/ruby/pack/gem +26 -18
- data/lib/ratch/toolset/ruby/pack/tgz +25 -64
- data/lib/ratch/toolset/ruby/pack/zip +46 -0
- data/lib/ratch/toolset/ruby/publish +23 -24
- data/lib/ratch/toolset/ruby/release +8 -0
- data/lib/ratch/toolset/ruby/stamp +33 -0
- data/lib/ratch/toolset/sandbox +11 -0
- data/meta/MANIFEST +101 -23
- data/meta/ROLLRC +1 -1
- data/meta/config.yaml +10 -0
- data/meta/icli.yaml +2 -2
- data/meta/project.yaml +9 -10
- data/meta/xProjectInfo +41 -0
- data/task/release +1 -4
- metadata +82 -156
- data/demo/task/rdoc +0 -88
- data/demo/task/rdoc-old +0 -182
- data/doc/images/clipboard.jpg +0 -0
- data/doc/images/clipboard2.png +0 -0
- data/doc/images/milles-tn.jpg +0 -0
- data/doc/images/mints.png +0 -0
- data/doc/images/ratch2.png +0 -0
- data/doc/images/ruby-sm.png +0 -0
- data/doc/images/silver.gif +0 -0
- data/doc/images/toolbox.jpg +0 -0
- data/doc/index.html +0 -181
- data/doc/notes/original.rb +0 -308
- data/doc/rdoc/classes/Array.html +0 -194
- data/doc/rdoc/classes/Dir.html +0 -317
- data/doc/rdoc/classes/Hash.html +0 -217
- data/doc/rdoc/classes/Ratch/ArgvUtils/Ext.html +0 -285
- data/doc/rdoc/classes/Ratch/ArgvUtils.html +0 -173
- data/doc/rdoc/classes/Ratch/BatchFile.html +0 -207
- data/doc/rdoc/classes/Ratch/BatchManager.html +0 -250
- data/doc/rdoc/classes/Ratch/BatchScript.html +0 -127
- data/doc/rdoc/classes/Ratch/Batchable.html +0 -373
- data/doc/rdoc/classes/Ratch/Build.html +0 -321
- data/doc/rdoc/classes/Ratch/BuildManager.html +0 -319
- data/doc/rdoc/classes/Ratch/Buildable.html +0 -202
- data/doc/rdoc/classes/Ratch/ConfigUtils.html +0 -281
- data/doc/rdoc/classes/Ratch/ConsoleUtils.html +0 -189
- data/doc/rdoc/classes/Ratch/EmailUtils.html +0 -209
- data/doc/rdoc/classes/Ratch/FileUtils.html +0 -674
- data/doc/rdoc/classes/Ratch/GeneralOptions.html +0 -430
- data/doc/rdoc/classes/Ratch/Task.html +0 -201
- data/doc/rdoc/classes/Ratch/TaskManager.html +0 -330
- data/doc/rdoc/classes/Ratch/Taskable.html +0 -231
- data/doc/rdoc/classes/Ratch/UploadUtils.html +0 -566
- data/doc/rdoc/classes/Ratch.html +0 -201
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/COPYING.html +0 -1003
- data/doc/rdoc/files/README.html +0 -143
- data/doc/rdoc/files/lib/ratch/argvutils_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/batch_rb.html +0 -155
- data/doc/rdoc/files/lib/ratch/batchable_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/batchfile_rb.html +0 -148
- data/doc/rdoc/files/lib/ratch/buildable_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/consoleutils_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/emailutils_rb.html +0 -139
- data/doc/rdoc/files/lib/ratch/facets/multiglob_rb.html +0 -137
- data/doc/rdoc/files/lib/ratch/fileutils_rb.html +0 -139
- data/doc/rdoc/files/lib/ratch/options_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/taskable_rb.html +0 -131
- data/doc/rdoc/files/lib/ratch/uploadutils_rb.html +0 -150
- data/doc/rdoc/fr_class_index.html +0 -48
- data/doc/rdoc/fr_file_index.html +0 -41
- data/doc/rdoc/fr_method_index.html +0 -133
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
- data/doc/scrap/flexihead-flip.jpg +0 -0
- data/doc/scrap/flexihead.jpg +0 -0
- data/doc/scrap/head1.jpg +0 -0
- data/doc/scrap/ratch.jpg +0 -0
- data/doc/scrap/ratch1.png +0 -0
- data/doc/scrap/ratch2.jpg +0 -0
- data/doc/scrap/ratch3.png +0 -0
- data/doc/scrap/red-ratch.jpg +0 -0
- data/doc/scrap/redratchet.jpg +0 -0
- data/doc/scrap/ruby-kit/ruby.png +0 -0
- data/doc/scrap/scrap.red +0 -256
- data/doc/sitemap.yaml +0 -10
- data/doc/siteparts/index.red +0 -100
- data/doc/siteparts/layout.rhtml +0 -56
- data/doc/siteparts/tutorial.red +0 -578
- data/doc/style.css +0 -112
- data/doc/tutorial.html +0 -722
- data/lib/ratch/batch.rb +0 -488
- data/lib/ratch/support/setuputils.rb +0 -124
- data/lib/ratch/support/stage.rb +0 -292
- data/lib/ratch/toolset/ruby/rdoc +0 -88
- data/task/rdoc +0 -6
- data/work/old/batchfile.rb +0 -95
- data/work/project-old.rb +0 -67
- data/work/scrap/install +0 -89
- data/work/scrap/install.0 +0 -49
- data/work/scrap/install.1 +0 -63
- data/work/scrap/ludo +0 -25
- data/work/scrap/oldtaskable.rb +0 -573
- data/work/scrap/ratch.man +0 -39
- data/work/scrap/taskable-simple.rb +0 -42
- data/work/scrap/taskable.rb +0 -120
data/doc/rdoc/classes/Array.html
DELETED
@@ -1,194 +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: Array</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">Array</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/ratch/consoleutils_rb.html">
|
59
|
-
lib/ratch/consoleutils.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
|
-
|
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="#M000007">not_empty?</a>
|
90
|
-
<a href="#M000008">to_console</a>
|
91
|
-
<a href="#M000009">to_params</a>
|
92
|
-
</div>
|
93
|
-
</div>
|
94
|
-
|
95
|
-
</div>
|
96
|
-
|
97
|
-
|
98
|
-
<!-- if includes -->
|
99
|
-
|
100
|
-
<div id="section">
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
<!-- if method_list -->
|
110
|
-
<div id="methods">
|
111
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
112
|
-
|
113
|
-
<div id="method-M000007" class="method-detail">
|
114
|
-
<a name="M000007"></a>
|
115
|
-
|
116
|
-
<div class="method-heading">
|
117
|
-
<a href="#M000007" class="method-signature">
|
118
|
-
<span class="method-name">not_empty?</span><span class="method-args">()</span>
|
119
|
-
</a>
|
120
|
-
</div>
|
121
|
-
|
122
|
-
<div class="method-description">
|
123
|
-
<p>
|
124
|
-
Not empty?
|
125
|
-
</p>
|
126
|
-
<p><a class="source-toggle" href="#"
|
127
|
-
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
128
|
-
<div class="method-source-code" id="M000007-source">
|
129
|
-
<pre>
|
130
|
-
<span class="ruby-comment cmt"># File lib/ratch/consoleutils.rb, line 67</span>
|
131
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">not_empty?</span>
|
132
|
-
<span class="ruby-operator">!</span><span class="ruby-identifier">empty?</span>
|
133
|
-
<span class="ruby-keyword kw">end</span>
|
134
|
-
</pre>
|
135
|
-
</div>
|
136
|
-
</div>
|
137
|
-
</div>
|
138
|
-
|
139
|
-
<div id="method-M000008" class="method-detail">
|
140
|
-
<a name="M000008"></a>
|
141
|
-
|
142
|
-
<div class="method-heading">
|
143
|
-
<a href="#M000008" class="method-signature">
|
144
|
-
<span class="method-name">to_console</span><span class="method-args">()</span>
|
145
|
-
</a>
|
146
|
-
</div>
|
147
|
-
|
148
|
-
<div class="method-description">
|
149
|
-
<p>
|
150
|
-
Convert an array into command line parameters. The array is accepted in the
|
151
|
-
format of Ruby method arguments —ie. [arg1, arg2, …, hash]
|
152
|
-
</p>
|
153
|
-
<p><a class="source-toggle" href="#"
|
154
|
-
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
155
|
-
<div class="method-source-code" id="M000008-source">
|
156
|
-
<pre>
|
157
|
-
<span class="ruby-comment cmt"># File lib/ratch/consoleutils.rb, line 75</span>
|
158
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_console</span>
|
159
|
-
<span class="ruby-identifier">flags</span> = (<span class="ruby-constant">Hash</span><span class="ruby-operator">===</span><span class="ruby-identifier">last</span> <span class="ruby-value">? </span><span class="ruby-identifier">pop</span> <span class="ruby-operator">:</span> {})
|
160
|
-
<span class="ruby-identifier">flags</span> = <span class="ruby-identifier">flags</span>.<span class="ruby-identifier">to_console</span>
|
161
|
-
<span class="ruby-identifier">flags</span> <span class="ruby-operator">+</span> <span class="ruby-value str">' '</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">join</span>(<span class="ruby-value str">" "</span>)
|
162
|
-
<span class="ruby-keyword kw">end</span>
|
163
|
-
</pre>
|
164
|
-
</div>
|
165
|
-
</div>
|
166
|
-
</div>
|
167
|
-
|
168
|
-
<div id="method-M000009" class="method-detail">
|
169
|
-
<a name="M000009"></a>
|
170
|
-
|
171
|
-
<div class="method-heading">
|
172
|
-
<span class="method-name">to_params</span><span class="method-args">()</span>
|
173
|
-
</div>
|
174
|
-
|
175
|
-
<div class="method-description">
|
176
|
-
<p>
|
177
|
-
Alias for <a href="Array.html#M000008">to_console</a>
|
178
|
-
</p>
|
179
|
-
</div>
|
180
|
-
</div>
|
181
|
-
|
182
|
-
|
183
|
-
</div>
|
184
|
-
|
185
|
-
|
186
|
-
</div>
|
187
|
-
|
188
|
-
|
189
|
-
<div id="validator-badges">
|
190
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
191
|
-
</div>
|
192
|
-
|
193
|
-
</body>
|
194
|
-
</html>
|
data/doc/rdoc/classes/Dir.html
DELETED
@@ -1,317 +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: Dir</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">Dir</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../files/lib/ratch/facets/multiglob_rb.html">
|
59
|
-
lib/ratch/facets/multiglob.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
|
-
|
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="#M000001">multiglob</a>
|
90
|
-
<a href="#M000002">multiglob_r</a>
|
91
|
-
<a href="#M000003">multiglob_with_default</a>
|
92
|
-
</div>
|
93
|
-
</div>
|
94
|
-
|
95
|
-
</div>
|
96
|
-
|
97
|
-
|
98
|
-
<!-- if includes -->
|
99
|
-
|
100
|
-
<div id="section">
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
<!-- if method_list -->
|
110
|
-
<div id="methods">
|
111
|
-
<h3 class="section-bar">Public Class methods</h3>
|
112
|
-
|
113
|
-
<div id="method-M000001" class="method-detail">
|
114
|
-
<a name="M000001"></a>
|
115
|
-
|
116
|
-
<div class="method-heading">
|
117
|
-
<a href="#M000001" class="method-signature">
|
118
|
-
<span class="method-name">multiglob</span><span class="method-args">( *patterns )</span>
|
119
|
-
</a>
|
120
|
-
</div>
|
121
|
-
|
122
|
-
<div class="method-description">
|
123
|
-
<p>
|
124
|
-
Like <tt>glob</tt> but can take multiple patterns.
|
125
|
-
</p>
|
126
|
-
<pre>
|
127
|
-
Dir.multiglob( '*.rb', '*.py' )
|
128
|
-
</pre>
|
129
|
-
<p>
|
130
|
-
Rather then constants for options <a href="Dir.html#M000001">multiglob</a>
|
131
|
-
accepts a trailing options hash of symbol keys.
|
132
|
-
</p>
|
133
|
-
<pre>
|
134
|
-
:noescape File::FNM_NOESCAPE
|
135
|
-
:casefold File::FNM_CASEFOLD
|
136
|
-
:pathname File::FNM_PATHNAME
|
137
|
-
:dotmatch File::FNM_DOTMATCH
|
138
|
-
:strict File::FNM_PATHNAME && File::FNM_DOTMATCH
|
139
|
-
</pre>
|
140
|
-
<p>
|
141
|
-
It also has an option for recurse.
|
142
|
-
</p>
|
143
|
-
<pre>
|
144
|
-
:recurse Recurively include contents of directories.
|
145
|
-
</pre>
|
146
|
-
<p>
|
147
|
-
For example
|
148
|
-
</p>
|
149
|
-
<pre>
|
150
|
-
Dir.multiglob( '*', :recurse => true )
|
151
|
-
</pre>
|
152
|
-
<p>
|
153
|
-
would have the same result as
|
154
|
-
</p>
|
155
|
-
<pre>
|
156
|
-
Dir.multiglob('**/*')
|
157
|
-
</pre>
|
158
|
-
<p>
|
159
|
-
Multiglob also accepts ’+’ and ’-’ prefixes. Any
|
160
|
-
entry that begins with a ’-’ is treated as an exclusion glob
|
161
|
-
and will be removed from the final result. For example, to collect all
|
162
|
-
files in the current directory, less ruby scripts:
|
163
|
-
</p>
|
164
|
-
<pre>
|
165
|
-
Dir.multiglob( '*', '-*.rb' )
|
166
|
-
</pre>
|
167
|
-
<p>
|
168
|
-
This is very useful in collecting files as specificed by a configuration
|
169
|
-
parameter.
|
170
|
-
</p>
|
171
|
-
<p><a class="source-toggle" href="#"
|
172
|
-
onclick="toggleCode('M000001-source');return false;">[Source]</a></p>
|
173
|
-
<div class="method-source-code" id="M000001-source">
|
174
|
-
<pre>
|
175
|
-
<span class="ruby-comment cmt"># File lib/ratch/facets/multiglob.rb, line 65</span>
|
176
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">multiglob</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">patterns</span> )
|
177
|
-
<span class="ruby-identifier">options</span> = (<span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">last</span> <span class="ruby-value">? </span><span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">pop</span> <span class="ruby-operator">:</span> {})
|
178
|
-
|
179
|
-
<span class="ruby-identifier">bitflags</span> = <span class="ruby-value">0</span>
|
180
|
-
<span class="ruby-identifier">bitflags</span> <span class="ruby-operator">|=</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">FNM_NOESCAPE</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:noescape</span>]
|
181
|
-
<span class="ruby-identifier">bitflags</span> <span class="ruby-operator">|=</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">FNM_CASEFOLD</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:casefold</span>]
|
182
|
-
<span class="ruby-identifier">bitflags</span> <span class="ruby-operator">|=</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">FNM_PATHNAME</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:pathname</span>] <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:strict</span>]
|
183
|
-
<span class="ruby-identifier">bitflags</span> <span class="ruby-operator">|=</span> <span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">FNM_DOTMATCH</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:dotmatch</span>] <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:strict</span>]
|
184
|
-
|
185
|
-
<span class="ruby-identifier">patterns</span> = [<span class="ruby-identifier">patterns</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">compact</span>
|
186
|
-
|
187
|
-
<span class="ruby-identifier">patterns_include</span> = <span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">select</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/^[-]/</span> }
|
188
|
-
<span class="ruby-identifier">patterns_exclude</span> = <span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">select</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[-]/</span> }
|
189
|
-
|
190
|
-
<span class="ruby-identifier">patterns_include</span>.<span class="ruby-identifier">collect!</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[+]/</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">f</span> }
|
191
|
-
<span class="ruby-identifier">patterns_exclude</span>.<span class="ruby-identifier">collect!</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">f</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[-]/</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">f</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-1</span>] <span class="ruby-operator">:</span> <span class="ruby-identifier">f</span> }
|
192
|
-
|
193
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:recurse</span>]
|
194
|
-
<span class="ruby-identifier">patterns_include</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">patterns_include</span>.<span class="ruby-identifier">collect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">f</span>, <span class="ruby-value str">'**'</span>, <span class="ruby-value str">'*'</span>) }
|
195
|
-
<span class="ruby-identifier">patterns_exclude</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">patterns_exclude</span>.<span class="ruby-identifier">collect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">f</span>, <span class="ruby-value str">'**'</span>, <span class="ruby-value str">'*'</span>) }
|
196
|
-
<span class="ruby-keyword kw">end</span>
|
197
|
-
|
198
|
-
<span class="ruby-identifier">files</span> = []
|
199
|
-
<span class="ruby-identifier">files</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">patterns_include</span>.<span class="ruby-identifier">collect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">pattern</span><span class="ruby-operator">|</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">bitflags</span>) }.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span>
|
200
|
-
<span class="ruby-identifier">files</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">patterns_exclude</span>.<span class="ruby-identifier">collect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">pattern</span><span class="ruby-operator">|</span> <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">glob</span>(<span class="ruby-identifier">pattern</span>, <span class="ruby-identifier">bitflags</span>) }.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">uniq</span>
|
201
|
-
|
202
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">files</span>
|
203
|
-
<span class="ruby-keyword kw">end</span>
|
204
|
-
</pre>
|
205
|
-
</div>
|
206
|
-
</div>
|
207
|
-
</div>
|
208
|
-
|
209
|
-
<div id="method-M000002" class="method-detail">
|
210
|
-
<a name="M000002"></a>
|
211
|
-
|
212
|
-
<div class="method-heading">
|
213
|
-
<a href="#M000002" class="method-signature">
|
214
|
-
<span class="method-name">multiglob_r</span><span class="method-args">( *patterns )</span>
|
215
|
-
</a>
|
216
|
-
</div>
|
217
|
-
|
218
|
-
<div class="method-description">
|
219
|
-
<p>
|
220
|
-
The same as <tt><a href="Dir.html#M000001">multiglob</a></tt>, but
|
221
|
-
recusively includes directories.
|
222
|
-
</p>
|
223
|
-
<pre>
|
224
|
-
Dir.multiglob_r( 'folder' )
|
225
|
-
</pre>
|
226
|
-
<p>
|
227
|
-
is equivalent to
|
228
|
-
</p>
|
229
|
-
<pre>
|
230
|
-
Dir.multiglob( 'folder', :recurse=>true )
|
231
|
-
</pre>
|
232
|
-
<p>
|
233
|
-
The effect of which is
|
234
|
-
</p>
|
235
|
-
<pre>
|
236
|
-
Dir.multiglob( 'folder', 'folder/**/*' )
|
237
|
-
</pre>
|
238
|
-
<p><a class="source-toggle" href="#"
|
239
|
-
onclick="toggleCode('M000002-source');return false;">[Source]</a></p>
|
240
|
-
<div class="method-source-code" id="M000002-source">
|
241
|
-
<pre>
|
242
|
-
<span class="ruby-comment cmt"># File lib/ratch/facets/multiglob.rb, line 106</span>
|
243
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">multiglob_r</span>( <span class="ruby-operator">*</span><span class="ruby-identifier">patterns</span> )
|
244
|
-
<span class="ruby-identifier">options</span> = (<span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">last</span> <span class="ruby-value">? </span><span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">pop</span> <span class="ruby-operator">:</span> {})
|
245
|
-
<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:recurse</span>] = <span class="ruby-keyword kw">true</span>
|
246
|
-
<span class="ruby-identifier">patterns</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">options</span>
|
247
|
-
<span class="ruby-identifier">multiglob</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">patterns</span>)
|
248
|
-
<span class="ruby-keyword kw">end</span>
|
249
|
-
</pre>
|
250
|
-
</div>
|
251
|
-
</div>
|
252
|
-
</div>
|
253
|
-
|
254
|
-
<div id="method-M000003" class="method-detail">
|
255
|
-
<a name="M000003"></a>
|
256
|
-
|
257
|
-
<div class="method-heading">
|
258
|
-
<a href="#M000003" class="method-signature">
|
259
|
-
<span class="method-name">multiglob_with_default</span><span class="method-args">(default, *patterns)</span>
|
260
|
-
</a>
|
261
|
-
</div>
|
262
|
-
|
263
|
-
<div class="method-description">
|
264
|
-
<p>
|
265
|
-
This is just like <a href="Dir.html#M000001">multiglob</a> but handles a
|
266
|
-
base pattern such that if the <tt>patterns</tt> list starts with a
|
267
|
-
’+’ or ’-’ entry, then the base will be included in
|
268
|
-
the result, otherwise it will be omitted.
|
269
|
-
</p>
|
270
|
-
<pre>
|
271
|
-
Dir.multiglob_with_default('*.yaml', '-*.rb') #=> [ 'foo.yaml' ]
|
272
|
-
Dir.multiglob_with_default('*.yaml', '+*.rb') #=> [ 'foo.yaml', 'foo.rb' ]
|
273
|
-
Dir.multiglob_with_default('*.yaml', '*.rb') #=> [ 'foo.rb' ]
|
274
|
-
</pre>
|
275
|
-
<p>
|
276
|
-
This is useful when a configuration option needs to supply a file list that
|
277
|
-
may include files, exclude files or append files to a default list.
|
278
|
-
</p>
|
279
|
-
<p>
|
280
|
-
TODO Deprecate this and replace with :default option on regular <a
|
281
|
-
href="Dir.html#M000001">multiglob</a>.
|
282
|
-
</p>
|
283
|
-
<p><a class="source-toggle" href="#"
|
284
|
-
onclick="toggleCode('M000003-source');return false;">[Source]</a></p>
|
285
|
-
<div class="method-source-code" id="M000003-source">
|
286
|
-
<pre>
|
287
|
-
<span class="ruby-comment cmt"># File lib/ratch/facets/multiglob.rb, line 126</span>
|
288
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">multiglob_with_default</span>(<span class="ruby-identifier">default</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">patterns</span>)
|
289
|
-
<span class="ruby-identifier">default</span> = [<span class="ruby-identifier">default</span>].<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">compact</span>
|
290
|
-
<span class="ruby-identifier">patterns</span> = <span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">flatten</span>.<span class="ruby-identifier">compact</span>
|
291
|
-
|
292
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">empty?</span>
|
293
|
-
<span class="ruby-identifier">patterns</span> = <span class="ruby-identifier">default</span>
|
294
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">patterns</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[+-]/</span>
|
295
|
-
<span class="ruby-identifier">patterns</span> = <span class="ruby-identifier">default</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">patterns</span>
|
296
|
-
<span class="ruby-keyword kw">end</span>
|
297
|
-
|
298
|
-
<span class="ruby-identifier">multiglob</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">patterns</span>)
|
299
|
-
<span class="ruby-keyword kw">end</span>
|
300
|
-
</pre>
|
301
|
-
</div>
|
302
|
-
</div>
|
303
|
-
</div>
|
304
|
-
|
305
|
-
|
306
|
-
</div>
|
307
|
-
|
308
|
-
|
309
|
-
</div>
|
310
|
-
|
311
|
-
|
312
|
-
<div id="validator-badges">
|
313
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
314
|
-
</div>
|
315
|
-
|
316
|
-
</body>
|
317
|
-
</html>
|