artifactory-ruby 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/artifactory/client.rb +40 -20
- data/lib/artifactory/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3382f6c152f0409dc4d73404f92fa97fbf18ca5d
|
4
|
+
data.tar.gz: 0255ee37ab9d9d5acd917c53e0ae16b1957af7d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5de3ff8707ce655fa809074259c316b5f8e5069d64cb8740c1536e40579630a548d29ddce83c5423c0e5c06913fe38b173f46953d722f91a6dbdeb88afe9add
|
7
|
+
data.tar.gz: 21464871d23c541fcdb4db6c39d53d85f36464b4af746fd4d4d1fe14211e6891e38153aafdc34c733194c49004596551ebda32628e698cc1f189608d07792ca9
|
data/lib/artifactory/client.rb
CHANGED
@@ -210,7 +210,7 @@ module Artifactory
|
|
210
210
|
# @return [Hash] Artifacts matching search criteria
|
211
211
|
#
|
212
212
|
def search_usage(repo_key:, not_used_since:, created_before: nil)
|
213
|
-
ret =
|
213
|
+
ret = []
|
214
214
|
|
215
215
|
path = File.join("/search", "usage")
|
216
216
|
params = []
|
@@ -219,18 +219,25 @@ module Artifactory
|
|
219
219
|
params << "repos=#{repo_key.is_a?(Array) ? repo_key.join(',') : repo_key}"
|
220
220
|
|
221
221
|
api_get([path, params.join('&')].join('?'))['results'].each do |result|
|
222
|
+
path = result['uri'].scan(/\/storage\/(.+?)(\/.*)/).flatten
|
223
|
+
|
224
|
+
file = {
|
225
|
+
"path" => path.join,
|
226
|
+
"repo_key" => path[0],
|
227
|
+
"name" => path[1]
|
228
|
+
}
|
229
|
+
|
222
230
|
result.each do |k, v|
|
223
231
|
case k
|
224
232
|
when "lastDownloaded", "remoteLastDownloaded"
|
225
|
-
|
226
|
-
|
227
|
-
when "uri"
|
228
|
-
next
|
233
|
+
file[k] = Time.parse(v)
|
229
234
|
|
230
235
|
else
|
231
|
-
|
236
|
+
file[k] = v
|
232
237
|
end
|
233
238
|
end
|
239
|
+
|
240
|
+
ret << file
|
234
241
|
end
|
235
242
|
|
236
243
|
ret
|
@@ -241,11 +248,11 @@ module Artifactory
|
|
241
248
|
# @param repo_key [String, Array<String>] Repository key(s)
|
242
249
|
# @param from_date [Time] Return artifacts that have not been used since the given date
|
243
250
|
# @param to_date [Time] Return artifacts that have been created before the given date
|
244
|
-
# @param
|
251
|
+
# @param date_fields [created, lastModified, lastDownloaded] Date fields that specify which fields the from_date and to_date values should be applied to
|
245
252
|
# @return [Hash] Artifacts matching search criteria
|
246
253
|
#
|
247
254
|
def search_dates(repo_key:, from_date: nil, to_date: Time.now, date_fields:)
|
248
|
-
ret =
|
255
|
+
ret = []
|
249
256
|
|
250
257
|
valid_date_fields = ["created", "lastModified", "lastDownloaded"]
|
251
258
|
|
@@ -260,20 +267,26 @@ module Artifactory
|
|
260
267
|
params << "repos=#{repo_key.is_a?(Array) ? repo_key.join(',') : repo_key}"
|
261
268
|
params << "dateFields=#{date_fields.join(',')}"
|
262
269
|
|
263
|
-
puts([path, params.join('&')].join('?'))
|
264
270
|
api_get([path, params.join('&')].join('?'))['results'].each do |result|
|
271
|
+
path = result['uri'].scan(/\/storage\/(.+?)(\/.*)/).flatten
|
272
|
+
|
273
|
+
file = {
|
274
|
+
"path" => path.join,
|
275
|
+
"repo_key" => path[0],
|
276
|
+
"name" => path[1]
|
277
|
+
}
|
278
|
+
|
265
279
|
result.each do |k, v|
|
266
280
|
case k
|
267
281
|
when *valid_date_fields
|
268
|
-
|
269
|
-
|
270
|
-
when "uri"
|
271
|
-
next
|
282
|
+
file[k] = Time.parse(v)
|
272
283
|
|
273
284
|
else
|
274
|
-
|
285
|
+
file[k] = v
|
275
286
|
end
|
276
287
|
end
|
288
|
+
|
289
|
+
ret << file
|
277
290
|
end
|
278
291
|
|
279
292
|
ret
|
@@ -287,7 +300,7 @@ module Artifactory
|
|
287
300
|
# @return [Hash] Artifacts matching search criteria
|
288
301
|
#
|
289
302
|
def search_creation(repo_key:, from_date: nil, to_date: Time.now)
|
290
|
-
ret =
|
303
|
+
ret = []
|
291
304
|
|
292
305
|
path = File.join("/search", "creation")
|
293
306
|
params = []
|
@@ -296,18 +309,25 @@ module Artifactory
|
|
296
309
|
params << "repos=#{repo_key.is_a?(Array) ? repo_key.join(',') : repo_key}"
|
297
310
|
|
298
311
|
api_get([path, params.join('&')].join('?'))['results'].each do |result|
|
312
|
+
path = result['uri'].scan(/\/storage\/(.+?)(\/.*)/).flatten
|
313
|
+
|
314
|
+
file = {
|
315
|
+
"path" => path.join,
|
316
|
+
"repo_key" => path[0],
|
317
|
+
"name" => path[1]
|
318
|
+
}
|
319
|
+
|
299
320
|
result.each do |k, v|
|
300
321
|
case k
|
301
322
|
when "created"
|
302
|
-
|
303
|
-
|
304
|
-
when "uri"
|
305
|
-
next
|
323
|
+
file[k] = Time.parse(v)
|
306
324
|
|
307
325
|
else
|
308
|
-
|
326
|
+
file[k] = v
|
309
327
|
end
|
310
328
|
end
|
329
|
+
|
330
|
+
ret << file
|
311
331
|
end
|
312
332
|
|
313
333
|
ret
|
data/lib/artifactory/version.rb
CHANGED