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,101 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>class Artifactory::Cleaner::Error - 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">StandardError
|
63
|
+
|
64
|
+
</div>
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
</div>
|
70
|
+
</nav>
|
71
|
+
|
72
|
+
<main role="main" aria-labelledby="class-Artifactory::Cleaner::Error">
|
73
|
+
<h1 id="class-Artifactory::Cleaner::Error" class="class">
|
74
|
+
class Artifactory::Cleaner::Error
|
75
|
+
</h1>
|
76
|
+
|
77
|
+
<section class="description">
|
78
|
+
|
79
|
+
</section>
|
80
|
+
|
81
|
+
|
82
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
</section>
|
93
|
+
</main>
|
94
|
+
|
95
|
+
|
96
|
+
<footer id="validator-badges" role="contentinfo">
|
97
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
98
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.1.
|
99
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
100
|
+
</footer>
|
101
|
+
|
@@ -0,0 +1,190 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module Artifactory::Cleaner::SpecHelpers - 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="module">
|
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
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<!-- Method Quickref -->
|
62
|
+
<div id="method-list-section" class="nav-section">
|
63
|
+
<h3>Methods</h3>
|
64
|
+
|
65
|
+
<ul class="link-list" role="directory">
|
66
|
+
|
67
|
+
<li ><a href="#method-i-generate_artifact">#generate_artifact</a>
|
68
|
+
|
69
|
+
<li ><a href="#method-i-generate_rule">#generate_rule</a>
|
70
|
+
|
71
|
+
</ul>
|
72
|
+
</div>
|
73
|
+
|
74
|
+
</div>
|
75
|
+
</nav>
|
76
|
+
|
77
|
+
<main role="main" aria-labelledby="module-Artifactory::Cleaner::SpecHelpers">
|
78
|
+
<h1 id="module-Artifactory::Cleaner::SpecHelpers" class="module">
|
79
|
+
module Artifactory::Cleaner::SpecHelpers
|
80
|
+
</h1>
|
81
|
+
|
82
|
+
<section class="description">
|
83
|
+
|
84
|
+
</section>
|
85
|
+
|
86
|
+
|
87
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
98
|
+
<header>
|
99
|
+
<h3>Public Instance Methods</h3>
|
100
|
+
</header>
|
101
|
+
|
102
|
+
|
103
|
+
<div id="method-i-generate_artifact" class="method-detail ">
|
104
|
+
|
105
|
+
<div class="method-heading">
|
106
|
+
<span class="method-name">generate_artifact</span><span
|
107
|
+
class="method-args">()</span>
|
108
|
+
|
109
|
+
<span class="method-click-advice">click to toggle source</span>
|
110
|
+
|
111
|
+
</div>
|
112
|
+
|
113
|
+
|
114
|
+
<div class="method-description">
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
<div class="method-source-code" id="generate_artifact-source">
|
122
|
+
<pre><span class="ruby-comment"># File spec/spec_helper.rb, line 14</span>
|
123
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">generate_artifact</span>
|
124
|
+
<span class="ruby-identifier">artifact</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">DiscoveredArtifact</span>.<span class="ruby-identifier">new</span>
|
125
|
+
<span class="ruby-identifier">artifact</span>.<span class="ruby-identifier">uri</span> = <span class="ruby-string">'http://yum.example.com/artifacts/test.rpm'</span>
|
126
|
+
<span class="ruby-identifier">artifact</span>.<span class="ruby-identifier">size</span> = (<span class="ruby-identifier">rand</span> <span class="ruby-operator">*</span> <span class="ruby-value">1024</span> <span class="ruby-operator">*</span> <span class="ruby-value">1024</span> <span class="ruby-operator">*</span> <span class="ruby-value">1024</span>).<span class="ruby-identifier">floor</span>
|
127
|
+
<span class="ruby-identifier">artifact</span>.<span class="ruby-identifier">last_downloaded</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">rand</span> <span class="ruby-operator">*</span> <span class="ruby-value">3600</span><span class="ruby-operator">*</span><span class="ruby-value">24</span><span class="ruby-operator">*</span><span class="ruby-value">365</span>
|
128
|
+
<span class="ruby-identifier">artifact</span>.<span class="ruby-identifier">last_modified</span> = <span class="ruby-identifier">artifact</span>.<span class="ruby-identifier">last_downloaded</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">rand</span> <span class="ruby-operator">*</span> <span class="ruby-value">3600</span><span class="ruby-operator">*</span><span class="ruby-value">24</span><span class="ruby-operator">*</span><span class="ruby-value">30</span>
|
129
|
+
<span class="ruby-identifier">artifact</span>
|
130
|
+
<span class="ruby-keyword">end</span></pre>
|
131
|
+
</div>
|
132
|
+
|
133
|
+
</div>
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
<div id="method-i-generate_rule" class="method-detail ">
|
142
|
+
|
143
|
+
<div class="method-heading">
|
144
|
+
<span class="method-name">generate_rule</span><span
|
145
|
+
class="method-args">()</span>
|
146
|
+
|
147
|
+
<span class="method-click-advice">click to toggle source</span>
|
148
|
+
|
149
|
+
</div>
|
150
|
+
|
151
|
+
|
152
|
+
<div class="method-description">
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
<div class="method-source-code" id="generate_rule-source">
|
160
|
+
<pre><span class="ruby-comment"># File spec/spec_helper.rb, line 5</span>
|
161
|
+
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">generate_rule</span>
|
162
|
+
<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>.<span class="ruby-identifier">new</span>(
|
163
|
+
<span class="ruby-value">action:</span> <span class="ruby-value">:include</span>,
|
164
|
+
<span class="ruby-value">priority:</span> (<span class="ruby-identifier">rand</span> <span class="ruby-operator">*</span> <span class="ruby-value">200</span>).<span class="ruby-identifier">to_i</span> <span class="ruby-operator">-</span> <span class="ruby-value">100</span>,
|
165
|
+
<span class="ruby-value">property:</span> <span class="ruby-value">:url</span>,
|
166
|
+
<span class="ruby-value">regex:</span> <span class="ruby-regexp">/.*/</span>
|
167
|
+
)
|
168
|
+
<span class="ruby-keyword">end</span></pre>
|
169
|
+
</div>
|
170
|
+
|
171
|
+
</div>
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
</div>
|
177
|
+
|
178
|
+
|
179
|
+
</section>
|
180
|
+
|
181
|
+
</section>
|
182
|
+
</main>
|
183
|
+
|
184
|
+
|
185
|
+
<footer id="validator-badges" role="contentinfo">
|
186
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
187
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.1.
|
188
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
189
|
+
</footer>
|
190
|
+
|
@@ -0,0 +1,157 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
|
3
|
+
<html>
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
|
7
|
+
<title>module Artifactory::Cleaner::Util - 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="module">
|
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
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<!-- Method Quickref -->
|
62
|
+
<div id="method-list-section" class="nav-section">
|
63
|
+
<h3>Methods</h3>
|
64
|
+
|
65
|
+
<ul class="link-list" role="directory">
|
66
|
+
|
67
|
+
<li ><a href="#method-c-filesize">::filesize</a>
|
68
|
+
|
69
|
+
</ul>
|
70
|
+
</div>
|
71
|
+
|
72
|
+
</div>
|
73
|
+
</nav>
|
74
|
+
|
75
|
+
<main role="main" aria-labelledby="module-Artifactory::Cleaner::Util">
|
76
|
+
<h1 id="module-Artifactory::Cleaner::Util" class="module">
|
77
|
+
module Artifactory::Cleaner::Util
|
78
|
+
</h1>
|
79
|
+
|
80
|
+
<section class="description">
|
81
|
+
|
82
|
+
</section>
|
83
|
+
|
84
|
+
|
85
|
+
<section id="5Buntitled-5D" class="documentation-section">
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
96
|
+
<header>
|
97
|
+
<h3>Public Class Methods</h3>
|
98
|
+
</header>
|
99
|
+
|
100
|
+
|
101
|
+
<div id="method-c-filesize" class="method-detail ">
|
102
|
+
|
103
|
+
<div class="method-heading">
|
104
|
+
<span class="method-name">filesize</span><span
|
105
|
+
class="method-args">(size)</span>
|
106
|
+
|
107
|
+
<span class="method-click-advice">click to toggle source</span>
|
108
|
+
|
109
|
+
</div>
|
110
|
+
|
111
|
+
|
112
|
+
<div class="method-description">
|
113
|
+
|
114
|
+
<p>Given a size in bytes, return a “human readable” size with a unit suffix
|
115
|
+
(MiB, GiB)</p>
|
116
|
+
|
117
|
+
<p>Taken from <a
|
118
|
+
href="https://stackoverflow.com/a/47486815/75801">stackoverflow.com/a/47486815/75801</a>
|
119
|
+
Used instead of a gem due to simplicity and speed</p>
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
<div class="method-source-code" id="filesize-source">
|
125
|
+
<pre><span class="ruby-comment"># File lib/artifactory/cleaner/util.rb, line 9</span>
|
126
|
+
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">filesize</span>(<span class="ruby-identifier">size</span>)
|
127
|
+
<span class="ruby-identifier">units</span> = [<span class="ruby-string">'B'</span>, <span class="ruby-string">'KiB'</span>, <span class="ruby-string">'MiB'</span>, <span class="ruby-string">'GiB'</span>, <span class="ruby-string">'TiB'</span>, <span class="ruby-string">'Pib'</span>, <span class="ruby-string">'EiB'</span>]
|
128
|
+
|
129
|
+
<span class="ruby-keyword">return</span> <span class="ruby-string">'0.0 B'</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
130
|
+
<span class="ruby-identifier">exp</span> = (<span class="ruby-constant">Math</span>.<span class="ruby-identifier">log</span>(<span class="ruby-identifier">size</span>) <span class="ruby-operator">/</span> <span class="ruby-constant">Math</span>.<span class="ruby-identifier">log</span>(<span class="ruby-value">1024</span>)).<span class="ruby-identifier">to_i</span>
|
131
|
+
<span class="ruby-identifier">exp</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword">if</span> (<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">1024</span> <span class="ruby-operator">**</span> <span class="ruby-identifier">exp</span> <span class="ruby-operator">>=</span> <span class="ruby-value">1024</span> <span class="ruby-operator">-</span> <span class="ruby-value">0.05</span>)
|
132
|
+
<span class="ruby-identifier">exp</span> = <span class="ruby-value">6</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">exp</span> <span class="ruby-operator">></span> <span class="ruby-value">6</span>
|
133
|
+
|
134
|
+
<span class="ruby-string">'%.1f %s'</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">size</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">1024</span> <span class="ruby-operator">**</span> <span class="ruby-identifier">exp</span>, <span class="ruby-identifier">units</span>[<span class="ruby-identifier">exp</span>]]
|
135
|
+
<span class="ruby-keyword">end</span></pre>
|
136
|
+
</div>
|
137
|
+
|
138
|
+
</div>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
</div>
|
144
|
+
|
145
|
+
|
146
|
+
</section>
|
147
|
+
|
148
|
+
</section>
|
149
|
+
</main>
|
150
|
+
|
151
|
+
|
152
|
+
<footer id="validator-badges" role="contentinfo">
|
153
|
+
<p><a href="https://validator.w3.org/check/referer">Validate</a>
|
154
|
+
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.0.1.
|
155
|
+
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
156
|
+
</footer>
|
157
|
+
|