longleaf 0.2.0.pre.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +84 -0
- data/.gitignore +4 -2
- data/.rubocop.yml +42 -2
- data/.rubocop_todo.yml +390 -311
- data/.yardopts +1 -0
- data/Gemfile +16 -1
- data/README.md +67 -13
- data/Rakefile +6 -0
- data/bin/setup +16 -1
- data/docs/aboutlongleaf.md +28 -0
- data/docs/extra.css +32 -0
- data/docs/img/change-file.png +0 -0
- data/docs/img/ll-example-preserved.png +0 -0
- data/docs/index.md +19 -0
- data/docs/install.md +66 -0
- data/docs/ll-example/config-example-relative.yml +33 -0
- data/docs/ll-example/files-dir/LLexample-PDF.pdf +0 -0
- data/docs/ll-example/files-dir/LLexample-TOCHANGE.txt +15 -0
- data/docs/ll-example/files-dir/LLexample-tokeep.txt +10 -0
- data/docs/ll-example/metadata-dir/.gitkeep +0 -0
- data/docs/ll-example/replica-files/.gitkeep +0 -0
- data/docs/ll-example/replica-metadata/.gitkeep +0 -0
- data/docs/quickstart.md +270 -0
- data/docs/rdocs/Longleaf.html +135 -0
- data/docs/rdocs/Longleaf/AppFields.html +178 -0
- data/docs/rdocs/Longleaf/ApplicationConfigDeserializer.html +631 -0
- data/docs/rdocs/Longleaf/ApplicationConfigManager.html +610 -0
- data/docs/rdocs/Longleaf/ApplicationConfigValidator.html +238 -0
- data/docs/rdocs/Longleaf/CLI.html +909 -0
- data/docs/rdocs/Longleaf/ChecksumMismatchError.html +151 -0
- data/docs/rdocs/Longleaf/ConfigBuilder.html +1339 -0
- data/docs/rdocs/Longleaf/ConfigurationError.html +143 -0
- data/docs/rdocs/Longleaf/ConfigurationValidator.html +227 -0
- data/docs/rdocs/Longleaf/DeregisterCommand.html +420 -0
- data/docs/rdocs/Longleaf/DeregisterEvent.html +453 -0
- data/docs/rdocs/Longleaf/DeregistrationError.html +151 -0
- data/docs/rdocs/Longleaf/DigestHelper.html +419 -0
- data/docs/rdocs/Longleaf/EventError.html +147 -0
- data/docs/rdocs/Longleaf/EventNames.html +163 -0
- data/docs/rdocs/Longleaf/EventStatusTracking.html +656 -0
- data/docs/rdocs/Longleaf/FileCheckService.html +540 -0
- data/docs/rdocs/Longleaf/FileHelpers.html +520 -0
- data/docs/rdocs/Longleaf/FileRecord.html +716 -0
- data/docs/rdocs/Longleaf/FileSelector.html +901 -0
- data/docs/rdocs/Longleaf/FixityCheckService.html +691 -0
- data/docs/rdocs/Longleaf/IndexManager.html +1155 -0
- data/docs/rdocs/Longleaf/InvalidDigestAlgorithmError.html +143 -0
- data/docs/rdocs/Longleaf/InvalidStoragePathError.html +143 -0
- data/docs/rdocs/Longleaf/Logging.html +405 -0
- data/docs/rdocs/Longleaf/Logging/RedirectingLogger.html +1213 -0
- data/docs/rdocs/Longleaf/LongleafError.html +139 -0
- data/docs/rdocs/Longleaf/MDFields.html +193 -0
- data/docs/rdocs/Longleaf/MetadataBuilder.html +787 -0
- data/docs/rdocs/Longleaf/MetadataDeserializer.html +537 -0
- data/docs/rdocs/Longleaf/MetadataError.html +143 -0
- data/docs/rdocs/Longleaf/MetadataPersistenceManager.html +539 -0
- data/docs/rdocs/Longleaf/MetadataRecord.html +1411 -0
- data/docs/rdocs/Longleaf/MetadataSerializer.html +786 -0
- data/docs/rdocs/Longleaf/PreservationServiceError.html +147 -0
- data/docs/rdocs/Longleaf/PreserveCommand.html +410 -0
- data/docs/rdocs/Longleaf/PreserveEvent.html +491 -0
- data/docs/rdocs/Longleaf/RegisterCommand.html +428 -0
- data/docs/rdocs/Longleaf/RegisterEvent.html +628 -0
- data/docs/rdocs/Longleaf/RegisteredFileSelector.html +446 -0
- data/docs/rdocs/Longleaf/RegistrationError.html +151 -0
- data/docs/rdocs/Longleaf/ReindexCommand.html +576 -0
- data/docs/rdocs/Longleaf/RsyncReplicationService.html +1180 -0
- data/docs/rdocs/Longleaf/SequelIndexDriver.html +1978 -0
- data/docs/rdocs/Longleaf/ServiceCandidateFilesystemIterator.html +572 -0
- data/docs/rdocs/Longleaf/ServiceCandidateIndexIterator.html +532 -0
- data/docs/rdocs/Longleaf/ServiceCandidateLocator.html +333 -0
- data/docs/rdocs/Longleaf/ServiceClassCache.html +725 -0
- data/docs/rdocs/Longleaf/ServiceDateHelper.html +425 -0
- data/docs/rdocs/Longleaf/ServiceDefinition.html +683 -0
- data/docs/rdocs/Longleaf/ServiceDefinitionManager.html +371 -0
- data/docs/rdocs/Longleaf/ServiceDefinitionValidator.html +269 -0
- data/docs/rdocs/Longleaf/ServiceFields.html +173 -0
- data/docs/rdocs/Longleaf/ServiceManager.html +1229 -0
- data/docs/rdocs/Longleaf/ServiceMappingManager.html +410 -0
- data/docs/rdocs/Longleaf/ServiceMappingValidator.html +347 -0
- data/docs/rdocs/Longleaf/ServiceRecord.html +821 -0
- data/docs/rdocs/Longleaf/StorageLocation.html +985 -0
- data/docs/rdocs/Longleaf/StorageLocationManager.html +729 -0
- data/docs/rdocs/Longleaf/StorageLocationUnavailableError.html +143 -0
- data/docs/rdocs/Longleaf/StorageLocationValidator.html +373 -0
- data/docs/rdocs/Longleaf/StoragePathValidator.html +253 -0
- data/docs/rdocs/Longleaf/SystemConfigBuilder.html +441 -0
- data/docs/rdocs/Longleaf/SystemConfigFields.html +163 -0
- data/docs/rdocs/Longleaf/ValidateConfigCommand.html +451 -0
- data/docs/rdocs/Longleaf/ValidateMetadataCommand.html +408 -0
- data/docs/rdocs/_index.html +660 -0
- data/docs/rdocs/class_list.html +51 -0
- data/docs/rdocs/css/common.css +1 -0
- data/docs/rdocs/css/full_list.css +58 -0
- data/docs/rdocs/css/style.css +496 -0
- data/docs/rdocs/file.README.html +165 -0
- data/docs/rdocs/file_list.html +56 -0
- data/docs/rdocs/frames.html +17 -0
- data/docs/rdocs/index.html +165 -0
- data/docs/rdocs/js/app.js +303 -0
- data/docs/rdocs/js/full_list.js +216 -0
- data/docs/rdocs/js/jquery.js +4 -0
- data/docs/rdocs/method_list.html +2051 -0
- data/docs/rdocs/top-level-namespace.html +110 -0
- data/lib/longleaf/candidates/file_selector.rb +47 -15
- data/lib/longleaf/candidates/registered_file_selector.rb +67 -0
- data/lib/longleaf/candidates/service_candidate_filesystem_iterator.rb +29 -35
- data/lib/longleaf/candidates/service_candidate_index_iterator.rb +84 -0
- data/lib/longleaf/candidates/service_candidate_locator.rb +9 -4
- data/lib/longleaf/cli.rb +162 -80
- data/lib/longleaf/commands/deregister_command.rb +12 -11
- data/lib/longleaf/commands/preserve_command.rb +13 -8
- data/lib/longleaf/commands/register_command.rb +9 -6
- data/lib/longleaf/commands/reindex_command.rb +92 -0
- data/lib/longleaf/commands/validate_config_command.rb +27 -6
- data/lib/longleaf/commands/validate_metadata_command.rb +11 -9
- data/lib/longleaf/errors.rb +12 -12
- data/lib/longleaf/events/deregister_event.rb +13 -15
- data/lib/longleaf/events/event_status_tracking.rb +7 -7
- data/lib/longleaf/events/preserve_event.rb +24 -14
- data/lib/longleaf/events/register_event.rb +21 -35
- data/lib/longleaf/helpers/digest_helper.rb +4 -4
- data/lib/longleaf/helpers/service_date_helper.rb +5 -6
- data/lib/longleaf/indexing/index_manager.rb +101 -0
- data/lib/longleaf/indexing/sequel_index_driver.rb +324 -0
- data/lib/longleaf/logging.rb +4 -4
- data/lib/longleaf/logging/redirecting_logger.rb +20 -20
- data/lib/longleaf/models/app_fields.rb +2 -1
- data/lib/longleaf/models/file_record.rb +10 -6
- data/lib/longleaf/models/md_fields.rb +1 -1
- data/lib/longleaf/models/metadata_record.rb +22 -12
- data/lib/longleaf/models/service_definition.rb +3 -3
- data/lib/longleaf/models/service_fields.rb +1 -1
- data/lib/longleaf/models/service_record.rb +6 -5
- data/lib/longleaf/models/storage_location.rb +26 -7
- data/lib/longleaf/models/system_config_fields.rb +9 -0
- data/lib/longleaf/preservation_services/file_check_service.rb +58 -0
- data/lib/longleaf/preservation_services/fixity_check_service.rb +16 -14
- data/lib/longleaf/preservation_services/rsync_replication_service.rb +32 -31
- data/lib/longleaf/services/application_config_deserializer.rb +55 -18
- data/lib/longleaf/services/application_config_manager.rb +16 -4
- data/lib/longleaf/services/application_config_validator.rb +1 -2
- data/lib/longleaf/services/configuration_validator.rb +6 -4
- data/lib/longleaf/services/metadata_deserializer.rb +40 -38
- data/lib/longleaf/services/metadata_persistence_manager.rb +46 -0
- data/lib/longleaf/services/metadata_serializer.rb +23 -22
- data/lib/longleaf/services/service_class_cache.rb +15 -15
- data/lib/longleaf/services/service_definition_manager.rb +5 -6
- data/lib/longleaf/services/service_definition_validator.rb +5 -6
- data/lib/longleaf/services/service_manager.rb +37 -17
- data/lib/longleaf/services/service_mapping_manager.rb +9 -9
- data/lib/longleaf/services/service_mapping_validator.rb +9 -10
- data/lib/longleaf/services/storage_location_manager.rb +22 -8
- data/lib/longleaf/services/storage_location_validator.rb +11 -8
- data/lib/longleaf/services/storage_path_validator.rb +1 -1
- data/lib/longleaf/specs/config_builder.rb +30 -17
- data/lib/longleaf/specs/custom_matchers.rb +1 -1
- data/lib/longleaf/specs/file_helpers.rb +15 -14
- data/lib/longleaf/specs/metadata_builder.rb +91 -0
- data/lib/longleaf/specs/system_config_builder.rb +27 -0
- data/lib/longleaf/version.rb +1 -1
- data/longleaf.gemspec +17 -7
- data/mkdocs.yml +20 -0
- metadata +233 -22
@@ -0,0 +1,901 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Class: Longleaf::FileSelector
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.19
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "Longleaf::FileSelector";
|
19
|
+
relpath = '../';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="../_index.html">Index (F)</a> »
|
40
|
+
<span class='title'><span class='object_link'><a href="../Longleaf.html" title="Longleaf (module)">Longleaf</a></span></span>
|
41
|
+
»
|
42
|
+
<span class="title">FileSelector</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="../class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Class: Longleaf::FileSelector
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
<dl>
|
70
|
+
<dt>Inherits:</dt>
|
71
|
+
<dd>
|
72
|
+
<span class="inheritName">Object</span>
|
73
|
+
|
74
|
+
<ul class="fullTree">
|
75
|
+
<li>Object</li>
|
76
|
+
|
77
|
+
<li class="next">Longleaf::FileSelector</li>
|
78
|
+
|
79
|
+
</ul>
|
80
|
+
<a href="#" class="inheritanceTree">show all</a>
|
81
|
+
|
82
|
+
</dd>
|
83
|
+
</dl>
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
<dl>
|
91
|
+
<dt>Includes:</dt>
|
92
|
+
<dd><span class='object_link'><a href="Logging.html" title="Longleaf::Logging (module)">Logging</a></span></dd>
|
93
|
+
</dl>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
<dl>
|
101
|
+
<dt>Defined in:</dt>
|
102
|
+
<dd>lib/longleaf/candidates/file_selector.rb</dd>
|
103
|
+
</dl>
|
104
|
+
|
105
|
+
</div>
|
106
|
+
|
107
|
+
<h2>Overview</h2><div class="docstring">
|
108
|
+
<div class="discussion">
|
109
|
+
|
110
|
+
<p>Selects and allows for iteration over files which match a provided set of selection criteria</p>
|
111
|
+
|
112
|
+
|
113
|
+
</div>
|
114
|
+
</div>
|
115
|
+
<div class="tags">
|
116
|
+
|
117
|
+
|
118
|
+
</div><div id="subclasses">
|
119
|
+
<h2>Direct Known Subclasses</h2>
|
120
|
+
<p class="children"><span class='object_link'><a href="RegisteredFileSelector.html" title="Longleaf::RegisteredFileSelector (class)">RegisteredFileSelector</a></span></p>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
<h2>
|
125
|
+
Constant Summary
|
126
|
+
<small><a href="#" class="constants_summary_toggle">collapse</a></small>
|
127
|
+
</h2>
|
128
|
+
|
129
|
+
<dl class="constants">
|
130
|
+
|
131
|
+
<dt id="SPECIFICITY_PATH-constant" class="">SPECIFICITY_PATH =
|
132
|
+
|
133
|
+
</dt>
|
134
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>path</span><span class='tstring_end'>'</span></span></pre></dd>
|
135
|
+
|
136
|
+
<dt id="SPECIFICITY_STORAGE_LOCATION-constant" class="">SPECIFICITY_STORAGE_LOCATION =
|
137
|
+
|
138
|
+
</dt>
|
139
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>storage_location</span><span class='tstring_end'>'</span></span></pre></dd>
|
140
|
+
|
141
|
+
</dl>
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
148
|
+
<ul class="summary">
|
149
|
+
|
150
|
+
<li class="public ">
|
151
|
+
<span class="summary_signature">
|
152
|
+
|
153
|
+
<a href="#specificity-instance_method" title="#specificity (instance method)">#<strong>specificity</strong> ⇒ Object </a>
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
</span>
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
<span class="note title readonly">readonly</span>
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
<span class="summary_desc"><div class='inline'>
|
173
|
+
<p>Returns the value of attribute specificity.</p>
|
174
|
+
</div></span>
|
175
|
+
|
176
|
+
</li>
|
177
|
+
|
178
|
+
|
179
|
+
</ul>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
<h2>
|
186
|
+
Instance Method Summary
|
187
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
188
|
+
</h2>
|
189
|
+
|
190
|
+
<ul class="summary">
|
191
|
+
|
192
|
+
<li class="public ">
|
193
|
+
<span class="summary_signature">
|
194
|
+
|
195
|
+
<a href="#each-instance_method" title="#each (instance method)">#<strong>each</strong> ⇒ Object </a>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
</span>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
<span class="summary_desc"><div class='inline'>
|
210
|
+
<p>Iterate through the file paths for this selector and execute the provided block with each.</p>
|
211
|
+
</div></span>
|
212
|
+
|
213
|
+
</li>
|
214
|
+
|
215
|
+
|
216
|
+
<li class="public ">
|
217
|
+
<span class="summary_signature">
|
218
|
+
|
219
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(file_paths: nil, storage_locations: nil, app_config:) ⇒ FileSelector </a>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
</span>
|
224
|
+
|
225
|
+
|
226
|
+
<span class="note title constructor">constructor</span>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<span class="summary_desc"><div class='inline'>
|
236
|
+
<p>May only provide either file_paths or storage_locations.</p>
|
237
|
+
</div></span>
|
238
|
+
|
239
|
+
</li>
|
240
|
+
|
241
|
+
|
242
|
+
<li class="public ">
|
243
|
+
<span class="summary_signature">
|
244
|
+
|
245
|
+
<a href="#next_path-instance_method" title="#next_path (instance method)">#<strong>next_path</strong> ⇒ String </a>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
</span>
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
<span class="summary_desc"><div class='inline'>
|
260
|
+
<p>Get the next file path for this selector.</p>
|
261
|
+
</div></span>
|
262
|
+
|
263
|
+
</li>
|
264
|
+
|
265
|
+
|
266
|
+
<li class="private ">
|
267
|
+
<span class="summary_signature">
|
268
|
+
|
269
|
+
<a href="#nil_or_empty%3F-instance_method" title="#nil_or_empty? (instance method)">#<strong>nil_or_empty?</strong>(value) ⇒ Boolean </a>
|
270
|
+
|
271
|
+
|
272
|
+
|
273
|
+
</span>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
<span class="note title private">private</span>
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
284
|
+
|
285
|
+
</li>
|
286
|
+
|
287
|
+
|
288
|
+
<li class="public ">
|
289
|
+
<span class="summary_signature">
|
290
|
+
|
291
|
+
<a href="#storage_locations-instance_method" title="#storage_locations (instance method)">#<strong>storage_locations</strong> ⇒ Object </a>
|
292
|
+
|
293
|
+
|
294
|
+
|
295
|
+
</span>
|
296
|
+
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
<span class="summary_desc"><div class='inline'>
|
306
|
+
<p>return [Array] a list of all storage locations being targeted by this selector.</p>
|
307
|
+
</div></span>
|
308
|
+
|
309
|
+
</li>
|
310
|
+
|
311
|
+
|
312
|
+
<li class="public ">
|
313
|
+
<span class="summary_signature">
|
314
|
+
|
315
|
+
<a href="#target_paths-instance_method" title="#target_paths (instance method)">#<strong>target_paths</strong> ⇒ Array </a>
|
316
|
+
|
317
|
+
|
318
|
+
|
319
|
+
</span>
|
320
|
+
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
<span class="summary_desc"><div class='inline'>
|
330
|
+
<p>A list of top level paths from which files will be selected.</p>
|
331
|
+
</div></span>
|
332
|
+
|
333
|
+
</li>
|
334
|
+
|
335
|
+
|
336
|
+
</ul>
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
|
342
|
+
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
|
347
|
+
|
348
|
+
<h3 class="inherited">Methods included from <span class='object_link'><a href="Logging.html" title="Longleaf::Logging (module)">Logging</a></span></h3>
|
349
|
+
<p class="inherited"><span class='object_link'><a href="Logging.html#initialize_logger-instance_method" title="Longleaf::Logging#initialize_logger (method)">#initialize_logger</a></span>, <span class='object_link'><a href="Logging.html#initialize_logger-class_method" title="Longleaf::Logging.initialize_logger (method)">initialize_logger</a></span>, <span class='object_link'><a href="Logging.html#logger-instance_method" title="Longleaf::Logging#logger (method)">#logger</a></span>, <span class='object_link'><a href="Logging.html#logger-class_method" title="Longleaf::Logging.logger (method)">logger</a></span></p>
|
350
|
+
<div id="constructor_details" class="method_details_list">
|
351
|
+
<h2>Constructor Details</h2>
|
352
|
+
|
353
|
+
<div class="method_details first">
|
354
|
+
<h3 class="signature first" id="initialize-instance_method">
|
355
|
+
|
356
|
+
#<strong>initialize</strong>(file_paths: nil, storage_locations: nil, app_config:) ⇒ <tt><span class='object_link'><a href="" title="Longleaf::FileSelector (class)">FileSelector</a></span></tt>
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
|
362
|
+
</h3><div class="docstring">
|
363
|
+
<div class="discussion">
|
364
|
+
|
365
|
+
<p>May only provide either file_paths or storage_locations</p>
|
366
|
+
|
367
|
+
|
368
|
+
</div>
|
369
|
+
</div>
|
370
|
+
<div class="tags">
|
371
|
+
|
372
|
+
|
373
|
+
</div><table class="source_code">
|
374
|
+
<tr>
|
375
|
+
<td>
|
376
|
+
<pre class="lines">
|
377
|
+
|
378
|
+
|
379
|
+
13
|
380
|
+
14
|
381
|
+
15
|
382
|
+
16
|
383
|
+
17
|
384
|
+
18
|
385
|
+
19
|
386
|
+
20
|
387
|
+
21
|
388
|
+
22
|
389
|
+
23
|
390
|
+
24
|
391
|
+
25
|
392
|
+
26
|
393
|
+
27
|
394
|
+
28
|
395
|
+
29
|
396
|
+
30
|
397
|
+
31
|
398
|
+
32
|
399
|
+
33
|
400
|
+
34
|
401
|
+
35
|
402
|
+
36
|
403
|
+
37
|
404
|
+
38
|
405
|
+
39
|
406
|
+
40
|
407
|
+
41
|
408
|
+
42
|
409
|
+
43
|
410
|
+
44
|
411
|
+
45
|
412
|
+
46
|
413
|
+
47
|
414
|
+
48
|
415
|
+
49
|
416
|
+
50
|
417
|
+
51</pre>
|
418
|
+
</td>
|
419
|
+
<td>
|
420
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/candidates/file_selector.rb', line 13</span>
|
421
|
+
|
422
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='label'>file_paths:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>storage_locations:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>app_config:</span><span class='rparen'>)</span>
|
423
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_nil_or_empty?'>nil_or_empty?</span><span class='lparen'>(</span><span class='id identifier rubyid_file_paths'>file_paths</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_nil_or_empty?'>nil_or_empty?</span><span class='lparen'>(</span><span class='id identifier rubyid_storage_locations'>storage_locations</span><span class='rparen'>)</span>
|
424
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Must provide either file paths or storage locations</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
425
|
+
<span class='kw'>end</span>
|
426
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_nil_or_empty?'>nil_or_empty?</span><span class='lparen'>(</span><span class='id identifier rubyid_file_paths'>file_paths</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_nil_or_empty?'>nil_or_empty?</span><span class='lparen'>(</span><span class='id identifier rubyid_storage_locations'>storage_locations</span><span class='rparen'>)</span>
|
427
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Cannot provide both file paths and storage locations</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
428
|
+
<span class='kw'>end</span>
|
429
|
+
<span class='ivar'>@app_config</span> <span class='op'>=</span> <span class='id identifier rubyid_app_config'>app_config</span>
|
430
|
+
<span class='comment'># The top level paths targeted by this selector
|
431
|
+
</span> <span class='ivar'>@target_paths</span> <span class='op'>=</span> <span class='id identifier rubyid_file_paths'>file_paths</span><span class='op'>&.</span><span class='id identifier rubyid_map'>map</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_path'>path</span><span class='op'>|</span>
|
432
|
+
<span class='comment'># Resolve relative paths against pwd
|
433
|
+
</span> <span class='id identifier rubyid_pathname'>pathname</span> <span class='op'>=</span> <span class='const'>Pathname</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
434
|
+
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_pathname'>pathname</span><span class='period'>.</span><span class='id identifier rubyid_absolute?'>absolute?</span>
|
435
|
+
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_pwd'>pwd</span><span class='comma'>,</span> <span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
436
|
+
<span class='kw'>end</span>
|
437
|
+
<span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_expand_path'>expand_path</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
438
|
+
|
439
|
+
<span class='comment'># adding trailing /'s to directories
|
440
|
+
</span> <span class='kw'>if</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_end_with?'>end_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
441
|
+
<span class='id identifier rubyid_path'>path</span> <span class='op'>+</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>/</span><span class='tstring_end'>'</span></span>
|
442
|
+
<span class='kw'>else</span>
|
443
|
+
<span class='id identifier rubyid_path'>path</span>
|
444
|
+
<span class='kw'>end</span>
|
445
|
+
<span class='kw'>end</span>
|
446
|
+
<span class='comment'># The set of storage locations to select file paths from
|
447
|
+
</span> <span class='ivar'>@storage_locations</span> <span class='op'>=</span> <span class='id identifier rubyid_storage_locations'>storage_locations</span>
|
448
|
+
<span class='comment'># Validate that the selected storage locations are known
|
449
|
+
</span> <span class='kw'>if</span> <span class='ivar'>@storage_locations</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
450
|
+
<span class='ivar'>@specificity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#SPECIFICITY_PATH-constant" title="Longleaf::FileSelector::SPECIFICITY_PATH (constant)">SPECIFICITY_PATH</a></span></span>
|
451
|
+
<span class='kw'>else</span>
|
452
|
+
<span class='ivar'>@specificity</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#SPECIFICITY_STORAGE_LOCATION-constant" title="Longleaf::FileSelector::SPECIFICITY_STORAGE_LOCATION (constant)">SPECIFICITY_STORAGE_LOCATION</a></span></span>
|
453
|
+
<span class='id identifier rubyid_locations'>locations</span> <span class='op'>=</span> <span class='ivar'>@app_config</span><span class='period'>.</span><span class='id identifier rubyid_location_manager'>location_manager</span><span class='period'>.</span><span class='id identifier rubyid_locations'>locations</span>
|
454
|
+
<span class='ivar'>@storage_locations</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_loc_name'>loc_name</span><span class='op'>|</span>
|
455
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_locations'>locations</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='id identifier rubyid_loc_name'>loc_name</span><span class='rparen'>)</span>
|
456
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="StorageLocationUnavailableError.html" title="Longleaf::StorageLocationUnavailableError (class)">StorageLocationUnavailableError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Cannot select unknown storage location </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_loc_name'>loc_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
457
|
+
<span class='kw'>end</span>
|
458
|
+
<span class='kw'>end</span>
|
459
|
+
<span class='kw'>end</span>
|
460
|
+
<span class='kw'>end</span></pre>
|
461
|
+
</td>
|
462
|
+
</tr>
|
463
|
+
</table>
|
464
|
+
</div>
|
465
|
+
|
466
|
+
</div>
|
467
|
+
|
468
|
+
<div id="instance_attr_details" class="attr_details">
|
469
|
+
<h2>Instance Attribute Details</h2>
|
470
|
+
|
471
|
+
|
472
|
+
<span id=""></span>
|
473
|
+
<div class="method_details first">
|
474
|
+
<h3 class="signature first" id="specificity-instance_method">
|
475
|
+
|
476
|
+
#<strong>specificity</strong> ⇒ <tt>Object</tt> <span class="extras">(readonly)</span>
|
477
|
+
|
478
|
+
|
479
|
+
|
480
|
+
|
481
|
+
|
482
|
+
</h3><div class="docstring">
|
483
|
+
<div class="discussion">
|
484
|
+
|
485
|
+
<p>Returns the value of attribute specificity</p>
|
486
|
+
|
487
|
+
|
488
|
+
</div>
|
489
|
+
</div>
|
490
|
+
<div class="tags">
|
491
|
+
|
492
|
+
|
493
|
+
</div><table class="source_code">
|
494
|
+
<tr>
|
495
|
+
<td>
|
496
|
+
<pre class="lines">
|
497
|
+
|
498
|
+
|
499
|
+
10
|
500
|
+
11
|
501
|
+
12</pre>
|
502
|
+
</td>
|
503
|
+
<td>
|
504
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/candidates/file_selector.rb', line 10</span>
|
505
|
+
|
506
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_specificity'>specificity</span>
|
507
|
+
<span class='ivar'>@specificity</span>
|
508
|
+
<span class='kw'>end</span></pre>
|
509
|
+
</td>
|
510
|
+
</tr>
|
511
|
+
</table>
|
512
|
+
</div>
|
513
|
+
|
514
|
+
</div>
|
515
|
+
|
516
|
+
|
517
|
+
<div id="instance_method_details" class="method_details_list">
|
518
|
+
<h2>Instance Method Details</h2>
|
519
|
+
|
520
|
+
|
521
|
+
<div class="method_details first">
|
522
|
+
<h3 class="signature first" id="each-instance_method">
|
523
|
+
|
524
|
+
#<strong>each</strong> ⇒ <tt>Object</tt>
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
|
530
|
+
</h3><div class="docstring">
|
531
|
+
<div class="discussion">
|
532
|
+
|
533
|
+
<p>Iterate through the file paths for this selector and execute the provided block with each. A block is required.</p>
|
534
|
+
|
535
|
+
|
536
|
+
</div>
|
537
|
+
</div>
|
538
|
+
<div class="tags">
|
539
|
+
|
540
|
+
|
541
|
+
</div><table class="source_code">
|
542
|
+
<tr>
|
543
|
+
<td>
|
544
|
+
<pre class="lines">
|
545
|
+
|
546
|
+
|
547
|
+
106
|
548
|
+
107
|
549
|
+
108
|
550
|
+
109
|
551
|
+
110
|
552
|
+
111
|
553
|
+
112
|
554
|
+
113</pre>
|
555
|
+
</td>
|
556
|
+
<td>
|
557
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/candidates/file_selector.rb', line 106</span>
|
558
|
+
|
559
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span>
|
560
|
+
<span class='id identifier rubyid_file_path'>file_path</span> <span class='op'>=</span> <span class='id identifier rubyid_next_path'>next_path</span>
|
561
|
+
<span class='kw'>until</span> <span class='id identifier rubyid_file_path'>file_path</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
562
|
+
<span class='kw'>yield</span> <span class='id identifier rubyid_file_path'>file_path</span>
|
563
|
+
|
564
|
+
<span class='id identifier rubyid_file_path'>file_path</span> <span class='op'>=</span> <span class='id identifier rubyid_next_path'>next_path</span>
|
565
|
+
<span class='kw'>end</span>
|
566
|
+
<span class='kw'>end</span></pre>
|
567
|
+
</td>
|
568
|
+
</tr>
|
569
|
+
</table>
|
570
|
+
</div>
|
571
|
+
|
572
|
+
<div class="method_details ">
|
573
|
+
<h3 class="signature " id="next_path-instance_method">
|
574
|
+
|
575
|
+
#<strong>next_path</strong> ⇒ <tt>String</tt>
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
</h3><div class="docstring">
|
582
|
+
<div class="discussion">
|
583
|
+
|
584
|
+
<p>Get the next file path for this selector. or nil if no more files selected</p>
|
585
|
+
|
586
|
+
|
587
|
+
</div>
|
588
|
+
</div>
|
589
|
+
<div class="tags">
|
590
|
+
|
591
|
+
<p class="tag_title">Returns:</p>
|
592
|
+
<ul class="return">
|
593
|
+
|
594
|
+
<li>
|
595
|
+
|
596
|
+
|
597
|
+
<span class='type'>(<tt>String</tt>)</span>
|
598
|
+
|
599
|
+
|
600
|
+
|
601
|
+
—
|
602
|
+
<div class='inline'>
|
603
|
+
<p>an absolute path to the next file targeted by this selector,</p>
|
604
|
+
</div>
|
605
|
+
|
606
|
+
</li>
|
607
|
+
|
608
|
+
</ul>
|
609
|
+
|
610
|
+
</div><table class="source_code">
|
611
|
+
<tr>
|
612
|
+
<td>
|
613
|
+
<pre class="lines">
|
614
|
+
|
615
|
+
|
616
|
+
69
|
617
|
+
70
|
618
|
+
71
|
619
|
+
72
|
620
|
+
73
|
621
|
+
74
|
622
|
+
75
|
623
|
+
76
|
624
|
+
77
|
625
|
+
78
|
626
|
+
79
|
627
|
+
80
|
628
|
+
81
|
629
|
+
82
|
630
|
+
83
|
631
|
+
84
|
632
|
+
85
|
633
|
+
86
|
634
|
+
87
|
635
|
+
88
|
636
|
+
89
|
637
|
+
90
|
638
|
+
91
|
639
|
+
92
|
640
|
+
93
|
641
|
+
94
|
642
|
+
95
|
643
|
+
96
|
644
|
+
97
|
645
|
+
98
|
646
|
+
99
|
647
|
+
100
|
648
|
+
101
|
649
|
+
102</pre>
|
650
|
+
</td>
|
651
|
+
<td>
|
652
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/candidates/file_selector.rb', line 69</span>
|
653
|
+
|
654
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_next_path'>next_path</span>
|
655
|
+
<span class='kw'>if</span> <span class='ivar'>@paths</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
656
|
+
<span class='comment'># Start the paths listing out from the targetted set of paths for this selector
|
657
|
+
</span> <span class='comment'># In reverse order since using a LIFO structure
|
658
|
+
</span> <span class='ivar'>@paths</span> <span class='op'>=</span> <span class='id identifier rubyid_target_paths'>target_paths</span><span class='period'>.</span><span class='id identifier rubyid_reverse'>reverse</span>
|
659
|
+
<span class='kw'>end</span>
|
660
|
+
|
661
|
+
<span class='comment'># No more paths to return
|
662
|
+
</span> <span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='ivar'>@paths</span><span class='op'>&.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
663
|
+
|
664
|
+
<span class='comment'># Get the most recently added path for depth first traversal of selected paths
|
665
|
+
</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='ivar'>@paths</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span>
|
666
|
+
<span class='kw'>until</span> <span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='kw'>do</span>
|
667
|
+
<span class='ivar'>@app_config</span><span class='period'>.</span><span class='id identifier rubyid_location_manager'>location_manager</span><span class='period'>.</span><span class='id identifier rubyid_verify_path_in_location'>verify_path_in_location</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
668
|
+
|
669
|
+
<span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
670
|
+
<span class='kw'>if</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_directory?'>directory?</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
671
|
+
<span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Expanding directory </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
672
|
+
<span class='comment'># For a directory, add all children to file_paths
|
673
|
+
</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_entries'>entries</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span><span class='period'>.</span><span class='id identifier rubyid_reverse_each'>reverse_each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_child'>child</span><span class='op'>|</span>
|
674
|
+
<span class='ivar'>@paths</span> <span class='op'><<</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='comma'>,</span> <span class='id identifier rubyid_child'>child</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_child'>child</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>.</span><span class='tstring_end'>'</span></span> <span class='kw'>or</span> <span class='id identifier rubyid_child'>child</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>..</span><span class='tstring_end'>'</span></span>
|
675
|
+
<span class='kw'>end</span>
|
676
|
+
<span class='kw'>else</span>
|
677
|
+
<span class='id identifier rubyid_logger'>logger</span><span class='period'>.</span><span class='id identifier rubyid_debug'>debug</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Returning file </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
678
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_path'>path</span>
|
679
|
+
<span class='kw'>end</span>
|
680
|
+
<span class='kw'>else</span>
|
681
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="InvalidStoragePathError.html" title="Longleaf::InvalidStoragePathError (class)">InvalidStoragePathError</a></span></span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>File </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_path'>path</span><span class='embexpr_end'>}</span><span class='tstring_content'> does not exist.</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
682
|
+
<span class='kw'>end</span>
|
683
|
+
|
684
|
+
<span class='comment'># Returned path was not a suitable file, try the next path
|
685
|
+
</span> <span class='id identifier rubyid_path'>path</span> <span class='op'>=</span> <span class='ivar'>@paths</span><span class='period'>.</span><span class='id identifier rubyid_pop'>pop</span>
|
686
|
+
<span class='kw'>end</span>
|
687
|
+
<span class='kw'>end</span></pre>
|
688
|
+
</td>
|
689
|
+
</tr>
|
690
|
+
</table>
|
691
|
+
</div>
|
692
|
+
|
693
|
+
<div class="method_details ">
|
694
|
+
<h3 class="signature " id="nil_or_empty?-instance_method">
|
695
|
+
|
696
|
+
#<strong>nil_or_empty?</strong>(value) ⇒ <tt>Boolean</tt> <span class="extras">(private)</span>
|
697
|
+
|
698
|
+
|
699
|
+
|
700
|
+
|
701
|
+
|
702
|
+
</h3><div class="docstring">
|
703
|
+
<div class="discussion">
|
704
|
+
|
705
|
+
|
706
|
+
</div>
|
707
|
+
</div>
|
708
|
+
<div class="tags">
|
709
|
+
|
710
|
+
<p class="tag_title">Returns:</p>
|
711
|
+
<ul class="return">
|
712
|
+
|
713
|
+
<li>
|
714
|
+
|
715
|
+
|
716
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
717
|
+
|
718
|
+
|
719
|
+
|
720
|
+
</li>
|
721
|
+
|
722
|
+
</ul>
|
723
|
+
|
724
|
+
</div><table class="source_code">
|
725
|
+
<tr>
|
726
|
+
<td>
|
727
|
+
<pre class="lines">
|
728
|
+
|
729
|
+
|
730
|
+
135
|
731
|
+
136
|
732
|
+
137</pre>
|
733
|
+
</td>
|
734
|
+
<td>
|
735
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/candidates/file_selector.rb', line 135</span>
|
736
|
+
|
737
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_nil_or_empty?'>nil_or_empty?</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
738
|
+
<span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
739
|
+
<span class='kw'>end</span></pre>
|
740
|
+
</td>
|
741
|
+
</tr>
|
742
|
+
</table>
|
743
|
+
</div>
|
744
|
+
|
745
|
+
<div class="method_details ">
|
746
|
+
<h3 class="signature " id="storage_locations-instance_method">
|
747
|
+
|
748
|
+
#<strong>storage_locations</strong> ⇒ <tt>Object</tt>
|
749
|
+
|
750
|
+
|
751
|
+
|
752
|
+
|
753
|
+
|
754
|
+
</h3><div class="docstring">
|
755
|
+
<div class="discussion">
|
756
|
+
|
757
|
+
<p>return [Array] a list of all storage locations being targeted by this selector</p>
|
758
|
+
|
759
|
+
|
760
|
+
</div>
|
761
|
+
</div>
|
762
|
+
<div class="tags">
|
763
|
+
|
764
|
+
|
765
|
+
</div><table class="source_code">
|
766
|
+
<tr>
|
767
|
+
<td>
|
768
|
+
<pre class="lines">
|
769
|
+
|
770
|
+
|
771
|
+
116
|
772
|
+
117
|
773
|
+
118
|
774
|
+
119
|
775
|
+
120
|
776
|
+
121
|
777
|
+
122
|
778
|
+
123
|
779
|
+
124
|
780
|
+
125
|
781
|
+
126
|
782
|
+
127
|
783
|
+
128
|
784
|
+
129
|
785
|
+
130
|
786
|
+
131
|
787
|
+
132</pre>
|
788
|
+
</td>
|
789
|
+
<td>
|
790
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/candidates/file_selector.rb', line 116</span>
|
791
|
+
|
792
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_storage_locations'>storage_locations</span>
|
793
|
+
<span class='comment'># Determine what storage_locations are represented by the given file paths
|
794
|
+
</span> <span class='kw'>if</span> <span class='ivar'>@storage_locations</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='op'>!</span><span class='ivar'>@target_paths</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
795
|
+
<span class='id identifier rubyid_loc_set'>loc_set</span> <span class='op'>=</span> <span class='const'>Set</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
796
|
+
<span class='ivar'>@target_paths</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_path'>path</span><span class='op'>|</span>
|
797
|
+
<span class='id identifier rubyid_loc'>loc</span> <span class='op'>=</span> <span class='ivar'>@app_config</span><span class='period'>.</span><span class='id identifier rubyid_location_manager'>location_manager</span><span class='period'>.</span><span class='id identifier rubyid_get_location_by_path'>get_location_by_path</span><span class='lparen'>(</span><span class='id identifier rubyid_path'>path</span><span class='rparen'>)</span>
|
798
|
+
<span class='id identifier rubyid_loc_set'>loc_set</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='id identifier rubyid_loc'>loc</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_loc'>loc</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
799
|
+
<span class='kw'>end</span>
|
800
|
+
<span class='ivar'>@storage_locations</span> <span class='op'>=</span> <span class='id identifier rubyid_loc_set'>loc_set</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span>
|
801
|
+
<span class='kw'>end</span>
|
802
|
+
|
803
|
+
<span class='kw'>if</span> <span class='ivar'>@storage_locations</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
804
|
+
<span class='ivar'>@storage_locations</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
805
|
+
<span class='kw'>end</span>
|
806
|
+
|
807
|
+
<span class='ivar'>@storage_locations</span>
|
808
|
+
<span class='kw'>end</span></pre>
|
809
|
+
</td>
|
810
|
+
</tr>
|
811
|
+
</table>
|
812
|
+
</div>
|
813
|
+
|
814
|
+
<div class="method_details ">
|
815
|
+
<h3 class="signature " id="target_paths-instance_method">
|
816
|
+
|
817
|
+
#<strong>target_paths</strong> ⇒ <tt>Array</tt>
|
818
|
+
|
819
|
+
|
820
|
+
|
821
|
+
|
822
|
+
|
823
|
+
</h3><div class="docstring">
|
824
|
+
<div class="discussion">
|
825
|
+
|
826
|
+
<p>Returns a list of top level paths from which files will be selected</p>
|
827
|
+
|
828
|
+
|
829
|
+
</div>
|
830
|
+
</div>
|
831
|
+
<div class="tags">
|
832
|
+
|
833
|
+
<p class="tag_title">Returns:</p>
|
834
|
+
<ul class="return">
|
835
|
+
|
836
|
+
<li>
|
837
|
+
|
838
|
+
|
839
|
+
<span class='type'>(<tt>Array</tt>)</span>
|
840
|
+
|
841
|
+
|
842
|
+
|
843
|
+
—
|
844
|
+
<div class='inline'>
|
845
|
+
<p>a list of top level paths from which files will be selected</p>
|
846
|
+
</div>
|
847
|
+
|
848
|
+
</li>
|
849
|
+
|
850
|
+
</ul>
|
851
|
+
|
852
|
+
</div><table class="source_code">
|
853
|
+
<tr>
|
854
|
+
<td>
|
855
|
+
<pre class="lines">
|
856
|
+
|
857
|
+
|
858
|
+
54
|
859
|
+
55
|
860
|
+
56
|
861
|
+
57
|
862
|
+
58
|
863
|
+
59
|
864
|
+
60
|
865
|
+
61
|
866
|
+
62
|
867
|
+
63
|
868
|
+
64</pre>
|
869
|
+
</td>
|
870
|
+
<td>
|
871
|
+
<pre class="code"><span class="info file"># File 'lib/longleaf/candidates/file_selector.rb', line 54</span>
|
872
|
+
|
873
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_target_paths'>target_paths</span>
|
874
|
+
<span class='comment'># If starting from locations, initialize by expanding locations out to their actual paths
|
875
|
+
</span> <span class='kw'>if</span> <span class='ivar'>@target_paths</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='op'>!</span><span class='ivar'>@storage_locations</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
876
|
+
<span class='ivar'>@target_paths</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
877
|
+
<span class='ivar'>@storage_locations</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_loc_name'>loc_name</span><span class='op'>|</span>
|
878
|
+
<span class='ivar'>@target_paths</span> <span class='op'><<</span> <span class='ivar'>@app_config</span><span class='period'>.</span><span class='id identifier rubyid_location_manager'>location_manager</span><span class='period'>.</span><span class='id identifier rubyid_locations'>locations</span><span class='lbracket'>[</span><span class='id identifier rubyid_loc_name'>loc_name</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span>
|
879
|
+
<span class='kw'>end</span>
|
880
|
+
<span class='kw'>end</span>
|
881
|
+
|
882
|
+
<span class='ivar'>@target_paths</span>
|
883
|
+
<span class='kw'>end</span></pre>
|
884
|
+
</td>
|
885
|
+
</tr>
|
886
|
+
</table>
|
887
|
+
</div>
|
888
|
+
|
889
|
+
</div>
|
890
|
+
|
891
|
+
</div>
|
892
|
+
|
893
|
+
<div id="footer">
|
894
|
+
Generated on Tue May 28 15:48:01 2019 by
|
895
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
896
|
+
0.9.19 (ruby-2.6.3).
|
897
|
+
</div>
|
898
|
+
|
899
|
+
</div>
|
900
|
+
</body>
|
901
|
+
</html>
|