artifactory-cleaner 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.idea/.gitignore +2 -0
- data/.idea/checkstyle-idea.xml +16 -0
- data/.idea/dictionaries/jgitlin.xml +7 -0
- data/.idea/misc.xml +6 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.rspec +3 -0
- data/.rspec_status +39 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +12 -0
- data/README.md +73 -0
- data/Rakefile +20 -0
- data/artifactory-cleaner.gemspec +43 -0
- data/artifactory-cleaner.iml +9 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doc/rdoc/Artifactory.html +94 -0
- data/doc/rdoc/Artifactory/Cleaner.html +108 -0
- data/doc/rdoc/Artifactory/Cleaner/ArtifactBucket.html +504 -0
- data/doc/rdoc/Artifactory/Cleaner/ArtifactBucketCollection.html +570 -0
- data/doc/rdoc/Artifactory/Cleaner/ArtifactFilter.html +712 -0
- data/doc/rdoc/Artifactory/Cleaner/ArtifactFilterRule.html +519 -0
- data/doc/rdoc/Artifactory/Cleaner/CLI.html +625 -0
- data/doc/rdoc/Artifactory/Cleaner/Controller.html +1014 -0
- data/doc/rdoc/Artifactory/Cleaner/DiscoveredArtifact.html +400 -0
- data/doc/rdoc/Artifactory/Cleaner/DiscoveryWorker.html +466 -0
- data/doc/rdoc/Artifactory/Cleaner/Error.html +101 -0
- data/doc/rdoc/Artifactory/Cleaner/SpecHelpers.html +190 -0
- data/doc/rdoc/Artifactory/Cleaner/Util.html +157 -0
- data/doc/rdoc/CODE_OF_CONDUCT_md.html +228 -0
- data/doc/rdoc/Float.html +94 -0
- data/doc/rdoc/Gemfile.html +144 -0
- data/doc/rdoc/Gemfile_lock.html +217 -0
- data/doc/rdoc/Object.html +112 -0
- data/doc/rdoc/README_md.html +241 -0
- data/doc/rdoc/Rakefile.html +151 -0
- data/doc/rdoc/artifactory-cleaner_gemspec.html +173 -0
- data/doc/rdoc/artifactory-cleaner_iml.html +139 -0
- data/doc/rdoc/bin/setup.html +134 -0
- data/doc/rdoc/created.rid +219 -0
- data/doc/rdoc/css/fonts.css +167 -0
- data/doc/rdoc/css/rdoc.css +590 -0
- data/doc/rdoc/filterlist_yaml.html +149 -0
- data/doc/rdoc/filters/clean-amzn_yaml.html +133 -0
- data/doc/rdoc/filters/snapshots_yaml.html +137 -0
- data/doc/rdoc/filters/test-filter_yaml.html +137 -0
- data/doc/rdoc/filters/yum-test_yaml.html +141 -0
- data/doc/rdoc/fonts/Lato-Light.ttf +0 -0
- data/doc/rdoc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/rdoc/fonts/Lato-Regular.ttf +0 -0
- data/doc/rdoc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/rdoc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/rdoc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/rdoc/images/add.png +0 -0
- data/doc/rdoc/images/arrow_up.png +0 -0
- data/doc/rdoc/images/brick.png +0 -0
- data/doc/rdoc/images/brick_link.png +0 -0
- data/doc/rdoc/images/bug.png +0 -0
- data/doc/rdoc/images/bullet_black.png +0 -0
- data/doc/rdoc/images/bullet_toggle_minus.png +0 -0
- data/doc/rdoc/images/bullet_toggle_plus.png +0 -0
- data/doc/rdoc/images/date.png +0 -0
- data/doc/rdoc/images/delete.png +0 -0
- data/doc/rdoc/images/find.png +0 -0
- data/doc/rdoc/images/loadingAnimation.gif +0 -0
- data/doc/rdoc/images/macFFBgHack.png +0 -0
- data/doc/rdoc/images/package.png +0 -0
- data/doc/rdoc/images/page_green.png +0 -0
- data/doc/rdoc/images/page_white_text.png +0 -0
- data/doc/rdoc/images/page_white_width.png +0 -0
- data/doc/rdoc/images/plugin.png +0 -0
- data/doc/rdoc/images/ruby.png +0 -0
- data/doc/rdoc/images/tag_blue.png +0 -0
- data/doc/rdoc/images/tag_green.png +0 -0
- data/doc/rdoc/images/transparent.png +0 -0
- data/doc/rdoc/images/wrench.png +0 -0
- data/doc/rdoc/images/wrench_orange.png +0 -0
- data/doc/rdoc/images/zoom.png +0 -0
- data/doc/rdoc/index.html +166 -0
- data/doc/rdoc/js/darkfish.js +161 -0
- data/doc/rdoc/js/jquery.js +4 -0
- data/doc/rdoc/js/navigation.js +141 -0
- data/doc/rdoc/js/navigation.js.gz +0 -0
- data/doc/rdoc/js/search.js +109 -0
- data/doc/rdoc/js/search_index.js +1 -0
- data/doc/rdoc/js/search_index.js.gz +0 -0
- data/doc/rdoc/js/searcher.js +229 -0
- data/doc/rdoc/js/searcher.js.gz +0 -0
- data/doc/rdoc/results/archive-test-4_log.html +762 -0
- data/doc/rdoc/results/buckets-2020-01-31_txt.html +233 -0
- data/doc/rdoc/results/clean-test-2_log.html +598 -0
- data/doc/rdoc/results/clean-test-3_log.html +128 -0
- data/doc/rdoc/results/clean-test-5_log.html +2721 -0
- data/doc/rdoc/results/clean-test-6_log.html +135 -0
- data/doc/rdoc/results/clean-test-7_log.html +137 -0
- data/doc/rdoc/results/clean-test-8-real_log.html +131 -0
- data/doc/rdoc/results/clean-test-9_log.html +131 -0
- data/doc/rdoc/results/clean-test1_log.html +1759 -0
- data/doc/rdoc/results/yum-test_2020-01-31_log.html +2854 -0
- data/doc/rdoc/results/yum-test_dry-run_log.html +1074 -0
- data/doc/rdoc/table_of_contents.html +581 -0
- data/exe/artifactory-cleaner +12 -0
- data/lib/artifactory/cleaner.rb +17 -0
- data/lib/artifactory/cleaner/artifact_bucket.rb +102 -0
- data/lib/artifactory/cleaner/artifact_bucket_collection.rb +118 -0
- data/lib/artifactory/cleaner/artifact_filter.rb +146 -0
- data/lib/artifactory/cleaner/artifact_filter_rule.rb +81 -0
- data/lib/artifactory/cleaner/cli.rb +415 -0
- data/lib/artifactory/cleaner/controller.rb +466 -0
- data/lib/artifactory/cleaner/discovered_artifact.rb +71 -0
- data/lib/artifactory/cleaner/discovery_worker.rb +126 -0
- data/lib/artifactory/cleaner/util.rb +21 -0
- data/lib/artifactory/cleaner/version.rb +7 -0
- metadata +252 -0
@@ -0,0 +1,712 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Artifactory::Cleaner::ArtifactFilter - RDoc Documentation</title>
|
8
|
+
|
9
|
+
<script type="text/javascript">
|
10
|
+
var rdoc_rel_prefix = "../../";
|
11
|
+
var index_rel_prefix = "../../";
|
12
|
+
</script>
|
13
|
+
|
14
|
+
<script src="../../js/jquery.js"></script>
|
15
|
+
<script src="../../js/darkfish.js"></script>
|
16
|
+
|
17
|
+
<link href="../../css/fonts.css" rel="stylesheet">
|
18
|
+
<link href="../../css/rdoc.css" rel="stylesheet">
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
<body id="top" role="document" class="class">
|
23
|
+
<nav role="navigation">
|
24
|
+
<div id="project-navigation">
|
25
|
+
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
26
|
+
<h2>
|
27
|
+
<a href="../../index.html" rel="home">Home</a>
|
28
|
+
</h2>
|
29
|
+
|
30
|
+
<div id="table-of-contents-navigation">
|
31
|
+
<a href="../../table_of_contents.html#pages">Pages</a>
|
32
|
+
<a href="../../table_of_contents.html#classes">Classes</a>
|
33
|
+
<a href="../../table_of_contents.html#methods">Methods</a>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div id="search-section" role="search" class="project-section initially-hidden">
|
38
|
+
<form action="#" method="get" accept-charset="utf-8">
|
39
|
+
<div id="search-field-wrapper">
|
40
|
+
<input id="search-field" role="combobox" aria-label="Search"
|
41
|
+
aria-autocomplete="list" aria-controls="search-results"
|
42
|
+
type="text" name="search" placeholder="Search" spellcheck="false"
|
43
|
+
title="Type to search, Up and Down to navigate, Enter to load">
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<ul id="search-results" aria-label="Search Results"
|
47
|
+
aria-busy="false" aria-expanded="false"
|
48
|
+
aria-atomic="false" class="initially-hidden"></ul>
|
49
|
+
</form>
|
50
|
+
</div>
|
51
|
+
|
52
|
+
</div>
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
<div id="class-metadata">
|
57
|
+
|
58
|
+
<div id="parent-class-section" class="nav-section">
|
59
|
+
<h3>Parent</h3>
|
60
|
+
|
61
|
+
|
62
|
+
<p class="link"><a href="../../Object.html">Object</a>
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<div id="includes-section" class="nav-section">
|
67
|
+
<h3>Included Modules</h3>
|
68
|
+
|
69
|
+
<ul class="link-list">
|
70
|
+
|
71
|
+
|
72
|
+
<li><span class="include">Enumerable</span>
|
73
|
+
|
74
|
+
|
75
|
+
</ul>
|
76
|
+
</div>
|
77
|
+
|
78
|
+
<div id="extends-section" class="nav-section">
|
79
|
+
<h3>Extended With Modules</h3>
|
80
|
+
|
81
|
+
<ul class="link-list">
|
82
|
+
|
83
|
+
|
84
|
+
<li><span class="extend">Forwardable</span>
|
85
|
+
|
86
|
+
|
87
|
+
</ul>
|
88
|
+
</div>
|
89
|
+
|
90
|
+
<!-- Method Quickref -->
|
91
|
+
<div id="method-list-section" class="nav-section">
|
92
|
+
<h3>Methods</h3>
|
93
|
+
|
94
|
+
<ul class="link-list" role="directory">
|
95
|
+
|
96
|
+
<li ><a href="#method-c-new">::new</a>
|
97
|
+
|
98
|
+
<li ><a href="#method-i-3C-3C">#<<</a>
|
99
|
+
|
100
|
+
<li ><a href="#method-i-5B-5D">#[]</a>
|
101
|
+
|
102
|
+
<li ><a href="#method-i-5B-5D-3D">#[]=</a>
|
103
|
+
|
104
|
+
<li ><a href="#method-i-action_for">#action_for</a>
|
105
|
+
|
106
|
+
<li ><a href="#method-i-bsearch">#bsearch</a>
|
107
|
+
|
108
|
+
<li ><a href="#method-i-each">#each</a>
|
109
|
+
|
110
|
+
<li ><a href="#method-i-filter">#filter</a>
|
111
|
+
|
112
|
+
<li ><a href="#method-i-first">#first</a>
|
113
|
+
|
114
|
+
<li ><a href="#method-i-last">#last</a>
|
115
|
+
|
116
|
+
<li ><a href="#method-i-push">#push</a>
|
117
|
+
|
118
|
+
<li ><a href="#method-i-slice">#slice</a>
|
119
|
+
|
120
|
+
<li ><a href="#method-i-sort-21">#sort!</a>
|
121
|
+
|
122
|
+
<li ><a href="#method-i-unshift">#unshift</a>
|
123
|
+
|
124
|
+
</ul>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
</div>
|
128
|
+
</nav>
|
129
|
+
|
130
|
+
<main role="main" aria-labelledby="class-Artifactory::Cleaner::ArtifactFilter">
|
131
|
+
<h1 id="class-Artifactory::Cleaner::ArtifactFilter" class="class">
|
132
|
+
class Artifactory::Cleaner::ArtifactFilter
|
133
|
+
</h1>
|
134
|
+
|
135
|
+
<section class="description">
|
136
|
+
|
137
|
+
<p>Filter a list of artifacts based on a series of include/exclude rules</p>
|
138
|
+
|
139
|
+
<p><a href="ArtifactFilter.html">Artifactory::Cleaner::ArtifactFilter</a> is
|
140
|
+
used to filter a list of artifacts based on rules. It is both a whitelist
|
141
|
+
and a blacklist: it maintains a list of rules in sorted priority order, and
|
142
|
+
the first rule which matches a given artifact determines the action for
|
143
|
+
that artifact (include or exclude)</p>
|
144
|
+
|
145
|
+
<p>Rules are stored in ascending priority order with lower numbers being
|
146
|
+
greater priority. (Think “Priority 1” or process queue scheduling via
|
147
|
+
`nice` value under Linux.</p>
|
148
|
+
|
149
|
+
</section>
|
150
|
+
|
151
|
+
|
152
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
<section class="attribute-method-details" class="method-section">
|
161
|
+
<header>
|
162
|
+
<h3>Attributes</h3>
|
163
|
+
</header>
|
164
|
+
|
165
|
+
|
166
|
+
<div id="attribute-i-default_action" class="method-detail">
|
167
|
+
<div class="method-heading attribute-method-heading">
|
168
|
+
<span class="method-name">default_action</span><span
|
169
|
+
class="attribute-access-type">[RW]</span>
|
170
|
+
</div>
|
171
|
+
|
172
|
+
<div class="method-description">
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
</div>
|
177
|
+
</div>
|
178
|
+
|
179
|
+
</section>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
184
|
+
<header>
|
185
|
+
<h3>Public Class Methods</h3>
|
186
|
+
</header>
|
187
|
+
|
188
|
+
|
189
|
+
<div id="method-c-new" class="method-detail ">
|
190
|
+
|
191
|
+
<div class="method-heading">
|
192
|
+
<span class="method-name">new</span><span
|
193
|
+
class="method-args">()</span>
|
194
|
+
|
195
|
+
<span class="method-click-advice">click to toggle source</span>
|
196
|
+
|
197
|
+
</div>
|
198
|
+
|
199
|
+
|
200
|
+
<div class="method-description">
|
201
|
+
|
202
|
+
<p><a href="ArtifactFilter.html">ArtifactFilter</a> constructor</p>
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<div class="method-source-code" id="new-source">
|
208
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 18</span>
|
209
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>()
|
210
|
+
<span class="ruby-ivar">@rules</span> = []
|
211
|
+
<span class="ruby-ivar">@sorted</span> = <span class="ruby-keyword">false</span>
|
212
|
+
<span class="ruby-ivar">@default_action</span> = <span class="ruby-value">:include</span>
|
213
|
+
<span class="ruby-keyword">end</span></pre>
|
214
|
+
</div>
|
215
|
+
|
216
|
+
</div>
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
</div>
|
222
|
+
|
223
|
+
|
224
|
+
</section>
|
225
|
+
|
226
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
227
|
+
<header>
|
228
|
+
<h3>Public Instance Methods</h3>
|
229
|
+
</header>
|
230
|
+
|
231
|
+
|
232
|
+
<div id="method-i-3C-3C" class="method-detail method-alias">
|
233
|
+
|
234
|
+
<div class="method-heading">
|
235
|
+
<span class="method-name"><<</span><span
|
236
|
+
class="method-args">(rule)</span>
|
237
|
+
|
238
|
+
</div>
|
239
|
+
|
240
|
+
|
241
|
+
<div class="method-description">
|
242
|
+
|
243
|
+
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
|
248
|
+
</div>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
<div class="aliases">
|
254
|
+
Alias for: <a href="ArtifactFilter.html#method-i-push">push</a>
|
255
|
+
</div>
|
256
|
+
|
257
|
+
</div>
|
258
|
+
|
259
|
+
|
260
|
+
<div id="method-i-5B-5D" class="method-detail ">
|
261
|
+
|
262
|
+
<div class="method-heading">
|
263
|
+
<span class="method-name">[]</span><span
|
264
|
+
class="method-args">(*args)</span>
|
265
|
+
|
266
|
+
<span class="method-click-advice">click to toggle source</span>
|
267
|
+
|
268
|
+
</div>
|
269
|
+
|
270
|
+
|
271
|
+
<div class="method-description">
|
272
|
+
|
273
|
+
<p>Access a rule by index</p>
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
|
278
|
+
<div class="method-source-code" id="5B-5D-source">
|
279
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 30</span>
|
280
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">[]</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
281
|
+
<span class="ruby-identifier">sort_if_needed</span>
|
282
|
+
<span class="ruby-ivar">@rules</span>[<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>]
|
283
|
+
<span class="ruby-keyword">end</span></pre>
|
284
|
+
</div>
|
285
|
+
|
286
|
+
</div>
|
287
|
+
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
</div>
|
292
|
+
|
293
|
+
|
294
|
+
<div id="method-i-5B-5D-3D" class="method-detail ">
|
295
|
+
|
296
|
+
<div class="method-heading">
|
297
|
+
<span class="method-name">[]=</span><span
|
298
|
+
class="method-args">(key, rule)</span>
|
299
|
+
|
300
|
+
<span class="method-click-advice">click to toggle source</span>
|
301
|
+
|
302
|
+
</div>
|
303
|
+
|
304
|
+
|
305
|
+
<div class="method-description">
|
306
|
+
|
307
|
+
<p>Update a given rule</p>
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
<div class="method-source-code" id="5B-5D-3D-source">
|
313
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 37</span>
|
314
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">[]=</span>(<span class="ruby-identifier">key</span>, <span class="ruby-identifier">rule</span>)
|
315
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"expected Artifactory::Cleaner::ArtifactFilterRule, got #{rule.class.name}"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Artifactory</span><span class="ruby-operator">::</span><span class="ruby-constant">Cleaner</span><span class="ruby-operator">::</span><span class="ruby-constant">ArtifactFilterRule</span>
|
316
|
+
<span class="ruby-ivar">@rules</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">rule</span>
|
317
|
+
<span class="ruby-ivar">@sorted</span> = <span class="ruby-keyword">false</span>
|
318
|
+
<span class="ruby-keyword">end</span></pre>
|
319
|
+
</div>
|
320
|
+
|
321
|
+
</div>
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
</div>
|
327
|
+
|
328
|
+
|
329
|
+
<div id="method-i-action_for" class="method-detail ">
|
330
|
+
|
331
|
+
<div class="method-heading">
|
332
|
+
<span class="method-name">action_for</span><span
|
333
|
+
class="method-args">(artifact)</span>
|
334
|
+
|
335
|
+
<span class="method-click-advice">click to toggle source</span>
|
336
|
+
|
337
|
+
</div>
|
338
|
+
|
339
|
+
|
340
|
+
<div class="method-description">
|
341
|
+
|
342
|
+
<p>Filter a given Artifactory::Resource::Artifact and return the action which
|
343
|
+
should be taken</p>
|
344
|
+
|
345
|
+
<p>Returns a symbol from the rule which matches this artifact, or the default
|
346
|
+
action (:include) if no rules matched</p>
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
<div class="method-source-code" id="action_for-source">
|
352
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 114</span>
|
353
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">action_for</span>(<span class="ruby-identifier">artifact</span>)
|
354
|
+
<span class="ruby-identifier">sort_if_needed</span>
|
355
|
+
<span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">rule</span><span class="ruby-operator">|</span>
|
356
|
+
<span class="ruby-identifier">action</span> = <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">action_for</span> <span class="ruby-identifier">artifact</span>
|
357
|
+
<span class="ruby-keyword">return</span> <span class="ruby-identifier">action</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">action</span>
|
358
|
+
<span class="ruby-keyword">end</span>
|
359
|
+
<span class="ruby-ivar">@default_action</span>
|
360
|
+
<span class="ruby-keyword">end</span></pre>
|
361
|
+
</div>
|
362
|
+
|
363
|
+
</div>
|
364
|
+
|
365
|
+
|
366
|
+
|
367
|
+
|
368
|
+
</div>
|
369
|
+
|
370
|
+
|
371
|
+
<div id="method-i-bsearch" class="method-detail ">
|
372
|
+
|
373
|
+
<div class="method-heading">
|
374
|
+
<span class="method-name">bsearch</span><span
|
375
|
+
class="method-args">(*args, &block)</span>
|
376
|
+
|
377
|
+
<span class="method-click-advice">click to toggle source</span>
|
378
|
+
|
379
|
+
</div>
|
380
|
+
|
381
|
+
|
382
|
+
<div class="method-description">
|
383
|
+
|
384
|
+
<p>Search for a rule</p>
|
385
|
+
|
386
|
+
|
387
|
+
|
388
|
+
|
389
|
+
<div class="method-source-code" id="bsearch-source">
|
390
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 52</span>
|
391
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">bsearch</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
392
|
+
<span class="ruby-identifier">sort_if_needed</span>
|
393
|
+
<span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">bsearch</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
394
|
+
<span class="ruby-keyword">end</span></pre>
|
395
|
+
</div>
|
396
|
+
|
397
|
+
</div>
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
</div>
|
403
|
+
|
404
|
+
|
405
|
+
<div id="method-i-each" class="method-detail ">
|
406
|
+
|
407
|
+
<div class="method-heading">
|
408
|
+
<span class="method-name">each</span><span
|
409
|
+
class="method-args">(&block)</span>
|
410
|
+
|
411
|
+
<span class="method-click-advice">click to toggle source</span>
|
412
|
+
|
413
|
+
</div>
|
414
|
+
|
415
|
+
|
416
|
+
<div class="method-description">
|
417
|
+
|
418
|
+
<p>Iterate over all rules (See Enumerable#each)</p>
|
419
|
+
|
420
|
+
|
421
|
+
|
422
|
+
|
423
|
+
<div class="method-source-code" id="each-source">
|
424
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 73</span>
|
425
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">each</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
426
|
+
<span class="ruby-identifier">sort_if_needed</span>
|
427
|
+
<span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">each</span>(<span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
428
|
+
<span class="ruby-keyword">end</span></pre>
|
429
|
+
</div>
|
430
|
+
|
431
|
+
</div>
|
432
|
+
|
433
|
+
|
434
|
+
|
435
|
+
|
436
|
+
</div>
|
437
|
+
|
438
|
+
|
439
|
+
<div id="method-i-filter" class="method-detail ">
|
440
|
+
|
441
|
+
<div class="method-heading">
|
442
|
+
<span class="method-name">filter</span><span
|
443
|
+
class="method-args">(artifacts, action = :include)</span>
|
444
|
+
|
445
|
+
<span class="method-click-advice">click to toggle source</span>
|
446
|
+
|
447
|
+
</div>
|
448
|
+
|
449
|
+
|
450
|
+
<div class="method-description">
|
451
|
+
|
452
|
+
<p>Filter a collection of Artifactory::Resource::Artifact instances, returning
|
453
|
+
the ones for which the action matches</p>
|
454
|
+
|
455
|
+
<p>Takes an Enumerable filled with Artifactory::Resource::Artifact instances
|
456
|
+
and returns a filtered enumerable for which all artifacts matched the
|
457
|
+
desired action after applying the filter rules to each item. `action`
|
458
|
+
defaults to :include but can be changed if desired</p>
|
459
|
+
|
460
|
+
<p>Unlike Array#filter +this method does not take a block+</p>
|
461
|
+
|
462
|
+
|
463
|
+
|
464
|
+
|
465
|
+
<div class="method-source-code" id="filter-source">
|
466
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 132</span>
|
467
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">filter</span>(<span class="ruby-identifier">artifacts</span>, <span class="ruby-identifier">action</span> = <span class="ruby-value">:include</span>)
|
468
|
+
<span class="ruby-identifier">artifacts</span>.<span class="ruby-identifier">filter</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">artifact</span><span class="ruby-operator">|</span> <span class="ruby-identifier">action_for</span>(<span class="ruby-identifier">artifact</span>) <span class="ruby-operator">==</span> <span class="ruby-identifier">action</span>}
|
469
|
+
<span class="ruby-keyword">end</span></pre>
|
470
|
+
</div>
|
471
|
+
|
472
|
+
</div>
|
473
|
+
|
474
|
+
|
475
|
+
|
476
|
+
|
477
|
+
</div>
|
478
|
+
|
479
|
+
|
480
|
+
<div id="method-i-first" class="method-detail ">
|
481
|
+
|
482
|
+
<div class="method-heading">
|
483
|
+
<span class="method-name">first</span><span
|
484
|
+
class="method-args">()</span>
|
485
|
+
|
486
|
+
<span class="method-click-advice">click to toggle source</span>
|
487
|
+
|
488
|
+
</div>
|
489
|
+
|
490
|
+
|
491
|
+
<div class="method-description">
|
492
|
+
|
493
|
+
<p>Get the first (numerically first priority) rule</p>
|
494
|
+
|
495
|
+
|
496
|
+
|
497
|
+
|
498
|
+
<div class="method-source-code" id="first-source">
|
499
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 59</span>
|
500
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">first</span>
|
501
|
+
<span class="ruby-identifier">sort_if_needed</span>
|
502
|
+
<span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">first</span>
|
503
|
+
<span class="ruby-keyword">end</span></pre>
|
504
|
+
</div>
|
505
|
+
|
506
|
+
</div>
|
507
|
+
|
508
|
+
|
509
|
+
|
510
|
+
|
511
|
+
</div>
|
512
|
+
|
513
|
+
|
514
|
+
<div id="method-i-last" class="method-detail ">
|
515
|
+
|
516
|
+
<div class="method-heading">
|
517
|
+
<span class="method-name">last</span><span
|
518
|
+
class="method-args">()</span>
|
519
|
+
|
520
|
+
<span class="method-click-advice">click to toggle source</span>
|
521
|
+
|
522
|
+
</div>
|
523
|
+
|
524
|
+
|
525
|
+
<div class="method-description">
|
526
|
+
|
527
|
+
<p>Get the last (numerically last priority) rule</p>
|
528
|
+
|
529
|
+
|
530
|
+
|
531
|
+
|
532
|
+
<div class="method-source-code" id="last-source">
|
533
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 66</span>
|
534
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">last</span>
|
535
|
+
<span class="ruby-identifier">sort_if_needed</span>
|
536
|
+
<span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">last</span>
|
537
|
+
<span class="ruby-keyword">end</span></pre>
|
538
|
+
</div>
|
539
|
+
|
540
|
+
</div>
|
541
|
+
|
542
|
+
|
543
|
+
|
544
|
+
|
545
|
+
</div>
|
546
|
+
|
547
|
+
|
548
|
+
<div id="method-i-push" class="method-detail ">
|
549
|
+
|
550
|
+
<div class="method-heading">
|
551
|
+
<span class="method-name">push</span><span
|
552
|
+
class="method-args">(rule)</span>
|
553
|
+
|
554
|
+
<span class="method-click-advice">click to toggle source</span>
|
555
|
+
|
556
|
+
</div>
|
557
|
+
|
558
|
+
|
559
|
+
<div class="method-description">
|
560
|
+
|
561
|
+
<p>Add rules to this filter</p>
|
562
|
+
|
563
|
+
<p>Like Array#push this method adds a rule to the end of the array, however
|
564
|
+
the array will be sorted in priority order before usage so addition at the
|
565
|
+
end or the beginning is somewhat meaningless</p>
|
566
|
+
|
567
|
+
|
568
|
+
|
569
|
+
|
570
|
+
<div class="method-source-code" id="push-source">
|
571
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 83</span>
|
572
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">push</span>(<span class="ruby-identifier">rule</span>)
|
573
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"expected Artifactory::Cleaner::ArtifactFilterRule, got #{rule.class.name}"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Artifactory</span><span class="ruby-operator">::</span><span class="ruby-constant">Cleaner</span><span class="ruby-operator">::</span><span class="ruby-constant">ArtifactFilterRule</span>
|
574
|
+
<span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">rule</span>
|
575
|
+
<span class="ruby-ivar">@sorted</span> = <span class="ruby-keyword">false</span>
|
576
|
+
<span class="ruby-keyword">self</span>
|
577
|
+
<span class="ruby-keyword">end</span></pre>
|
578
|
+
</div>
|
579
|
+
|
580
|
+
</div>
|
581
|
+
|
582
|
+
|
583
|
+
<div class="aliases">
|
584
|
+
Also aliased as: <a href="ArtifactFilter.html#method-i-3C-3C"><<</a>
|
585
|
+
</div>
|
586
|
+
|
587
|
+
|
588
|
+
|
589
|
+
</div>
|
590
|
+
|
591
|
+
|
592
|
+
<div id="method-i-slice" class="method-detail ">
|
593
|
+
|
594
|
+
<div class="method-heading">
|
595
|
+
<span class="method-name">slice</span><span
|
596
|
+
class="method-args">(*args, &block)</span>
|
597
|
+
|
598
|
+
<span class="method-click-advice">click to toggle source</span>
|
599
|
+
|
600
|
+
</div>
|
601
|
+
|
602
|
+
|
603
|
+
<div class="method-description">
|
604
|
+
|
605
|
+
<p>Slice the filter rules, see Array#slice</p>
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
<div class="method-source-code" id="slice-source">
|
611
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 45</span>
|
612
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">slice</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
613
|
+
<span class="ruby-identifier">sort_if_needed</span>
|
614
|
+
<span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">slice</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span>)
|
615
|
+
<span class="ruby-keyword">end</span></pre>
|
616
|
+
</div>
|
617
|
+
|
618
|
+
</div>
|
619
|
+
|
620
|
+
|
621
|
+
|
622
|
+
|
623
|
+
</div>
|
624
|
+
|
625
|
+
|
626
|
+
<div id="method-i-sort-21" class="method-detail ">
|
627
|
+
|
628
|
+
<div class="method-heading">
|
629
|
+
<span class="method-name">sort!</span><span
|
630
|
+
class="method-args">()</span>
|
631
|
+
|
632
|
+
<span class="method-click-advice">click to toggle source</span>
|
633
|
+
|
634
|
+
</div>
|
635
|
+
|
636
|
+
|
637
|
+
<div class="method-description">
|
638
|
+
|
639
|
+
<p>Ensure the filterset is sorted properly. Should not need to be called
|
640
|
+
manually</p>
|
641
|
+
|
642
|
+
|
643
|
+
|
644
|
+
|
645
|
+
<div class="method-source-code" id="sort-21-source">
|
646
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 105</span>
|
647
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">sort!</span>
|
648
|
+
<span class="ruby-identifier">sort_if_needed</span>
|
649
|
+
<span class="ruby-keyword">self</span>
|
650
|
+
<span class="ruby-keyword">end</span></pre>
|
651
|
+
</div>
|
652
|
+
|
653
|
+
</div>
|
654
|
+
|
655
|
+
|
656
|
+
|
657
|
+
|
658
|
+
</div>
|
659
|
+
|
660
|
+
|
661
|
+
<div id="method-i-unshift" class="method-detail ">
|
662
|
+
|
663
|
+
<div class="method-heading">
|
664
|
+
<span class="method-name">unshift</span><span
|
665
|
+
class="method-args">(rule)</span>
|
666
|
+
|
667
|
+
<span class="method-click-advice">click to toggle source</span>
|
668
|
+
|
669
|
+
</div>
|
670
|
+
|
671
|
+
|
672
|
+
<div class="method-description">
|
673
|
+
|
674
|
+
<p>Add a rule to this filter</p>
|
675
|
+
|
676
|
+
<p>Like Array#unshift this method adds a rule to the beginning of the array,
|
677
|
+
however the array will be sorted in priority order before usage so addition
|
678
|
+
at the end or the beginning is somewhat meaningless</p>
|
679
|
+
|
680
|
+
|
681
|
+
|
682
|
+
|
683
|
+
<div class="method-source-code" id="unshift-source">
|
684
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/artifact_filter.rb, line 96</span>
|
685
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">unshift</span>(<span class="ruby-identifier">rule</span>)
|
686
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">"expected Artifactory::Cleaner::ArtifactFilterRule, got #{rule.class.name}"</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">rule</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Artifactory</span><span class="ruby-operator">::</span><span class="ruby-constant">Cleaner</span><span class="ruby-operator">::</span><span class="ruby-constant">ArtifactFilterRule</span>
|
687
|
+
<span class="ruby-ivar">@rules</span>.<span class="ruby-identifier">unshift</span> <span class="ruby-identifier">rule</span>
|
688
|
+
<span class="ruby-ivar">@sorted</span> = <span class="ruby-keyword">false</span>
|
689
|
+
<span class="ruby-keyword">self</span>
|
690
|
+
<span class="ruby-keyword">end</span></pre>
|
691
|
+
</div>
|
692
|
+
|
693
|
+
</div>
|
694
|
+
|
695
|
+
|
696
|
+
|
697
|
+
|
698
|
+
</div>
|
699
|
+
|
700
|
+
|
701
|
+
</section>
|
702
|
+
|
703
|
+
</section>
|
704
|
+
</main>
|
705
|
+
|
706
|
+
|
707
|
+
<footer id="validator-badges" role="contentinfo">
|
708
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
709
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.1.
|
710
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
711
|
+
</footer>
|
712
|
+
|