artifactory 3.0.5 → 3.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b7b1a0145b81545ac79eb8ee9a46168c9c1cc754bb173684de8c0ecf33f3687
4
- data.tar.gz: 10e223e64e4c9e35dc8df1858c76732f8c430b5684f604f3a64f943d10534429
3
+ metadata.gz: 9f2ac1ef78888d5d68cd444274bfdc534226285b1680c3dbd5051e588a7e782c
4
+ data.tar.gz: 73dd6f6671ed821caf2bb0a2d209011848d62f7a2b29377d32b0b28ae672cf70
5
5
  SHA512:
6
- metadata.gz: 4ca390ee594e732b753cc2d42af359b92d7e1917d897b600fdb6692aa7b1919dd54e6dedb9711bf519c643b0fe51ae5dd51c45cb1058078f6783dc3717629242
7
- data.tar.gz: 1b0673c2f1f863bc446c09db795f62f951e857436ec63ae64c7f5ce252244a18a5b026005afb4e2a32a1a9fe690508b1d84306f6724ea6a504a9883f9ea67f9f
6
+ metadata.gz: 547a6b02af33b3c6ae0dcef9f696bda622664256953963a93537075c84f5951eadc0191465598608a79ba7c4efe0441d03eb92e918df1812c70edc854bc83621
7
+ data.tar.gz: 0ef42dcf24579618c86fd7e8512021e4eef5c16cdc4dcef65116da36cab77403dc704b927708783c42ee8261975dce7dd14522b95db4f8dfc25fff2ec8c99989
@@ -15,7 +15,7 @@
15
15
  #
16
16
 
17
17
  require "pathname"
18
- require "artifactory/version"
18
+ require_relative "artifactory/version"
19
19
 
20
20
  module Artifactory
21
21
  autoload :Client, "artifactory/client"
@@ -208,7 +208,7 @@ module Artifactory
208
208
  end
209
209
 
210
210
  # Setup PATCH/POST/PUT
211
- if [:patch, :post, :put].include?(verb)
211
+ if %i{patch post put}.include?(verb)
212
212
  if data.respond_to?(:read)
213
213
  request.content_length = data.size
214
214
  request.body_stream = data
@@ -314,7 +314,7 @@ module Artifactory
314
314
  #
315
315
  def build_uri(verb, path, params = {})
316
316
  # Add any query string parameters
317
- if [:delete, :get].include?(verb)
317
+ if %i{delete get}.include?(verb)
318
318
  path = [path, to_query_string(params)].compact.join("?")
319
319
  end
320
320
 
@@ -27,20 +27,20 @@ module Artifactory
27
27
  # @return [Array<Symbol>]
28
28
  #
29
29
  def keys
30
- @keys ||= [
31
- :endpoint,
32
- :username,
33
- :password,
34
- :api_key,
35
- :proxy_address,
36
- :proxy_password,
37
- :proxy_port,
38
- :proxy_username,
39
- :ssl_pem_file,
40
- :ssl_verify,
41
- :user_agent,
42
- :read_timeout,
43
- ]
30
+ @keys ||= %i{
31
+ endpoint
32
+ username
33
+ password
34
+ api_key
35
+ proxy_address
36
+ proxy_password
37
+ proxy_port
38
+ proxy_username
39
+ ssl_pem_file
40
+ ssl_verify
41
+ user_agent
42
+ read_timeout
43
+ }
44
44
  end
45
45
  end
46
46
 
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "artifactory/version"
17
+ require_relative "version"
18
18
 
19
19
  module Artifactory
20
20
  module Defaults
@@ -51,7 +51,7 @@ module Artifactory
51
51
 
52
52
  #{Resource::Build::BUILD_TYPES.join("\n ")}"
53
53
 
54
- EOH
54
+ EOH
55
55
  end
56
56
  end
57
57
  end
@@ -98,8 +98,7 @@ module Artifactory
98
98
  group: :g,
99
99
  name: :a,
100
100
  version: :v,
101
- classifier: :c
102
- )
101
+ classifier: :c)
103
102
  params = Util.slice(options, :g, :a, :v, :c, :repos)
104
103
  format_repos!(params)
105
104
 
@@ -293,14 +292,14 @@ module Artifactory
293
292
  options = Util.rename_keys(options,
294
293
  group: :g,
295
294
  name: :a,
296
- version: :v
297
- )
295
+ version: :v)
298
296
  params = Util.slice(options, :g, :a, :v, :repos)
299
297
  format_repos!(params)
300
298
 
301
299
  client.get("/api/search/versions", params)["results"]
302
300
  rescue Error::HTTPError => e
303
301
  raise unless e.code == 404
302
+
304
303
  []
305
304
  end
306
305
 
@@ -344,8 +343,7 @@ module Artifactory
344
343
  options = Util.rename_keys(options,
345
344
  group: :g,
346
345
  name: :a,
347
- version: :v
348
- )
346
+ version: :v)
349
347
  params = Util.slice(options, :g, :a, :v, :repos, :remote)
350
348
  format_repos!(params)
351
349
 
@@ -356,6 +354,7 @@ module Artifactory
356
354
  client.get("/api/search/latestVersion", params)
357
355
  rescue Error::HTTPError => e
358
356
  raise unless e.code == 404
357
+
359
358
  nil
360
359
  end
361
360
 
@@ -555,6 +554,7 @@ module Artifactory
555
554
  response = client.put(endpoint, file, headers)
556
555
 
557
556
  return unless response.is_a?(Hash)
557
+
558
558
  self.class.from_hash(response)
559
559
  end
560
560
 
@@ -608,8 +608,7 @@ module Artifactory
608
608
  def upload_with_checksum(repo, remote_path, checksum, properties = {})
609
609
  upload(repo, remote_path, properties,
610
610
  "X-Checksum-Deploy" => true,
611
- "X-Checksum-Sha1" => checksum
612
- )
611
+ "X-Checksum-Sha1" => checksum)
613
612
  end
614
613
 
615
614
  #
@@ -626,8 +625,7 @@ module Artifactory
626
625
  #
627
626
  def upload_from_archive(repo, remote_path, properties = {})
628
627
  upload(repo, remote_path, properties,
629
- "X-Explode-Archive" => true
630
- )
628
+ "X-Explode-Archive" => true)
631
629
  end
632
630
 
633
631
  private
@@ -59,6 +59,7 @@ module Artifactory
59
59
  find_from_config("config/backups/backup/key[text()='#{key}']", config, options)
60
60
  rescue Error::HTTPError => e
61
61
  raise unless e.code == 404
62
+
62
63
  nil
63
64
  end
64
65
 
@@ -102,6 +103,7 @@ module Artifactory
102
103
  def find_from_config(xpath, config, options = {})
103
104
  name_node = REXML::XPath.match(config, xpath)
104
105
  return nil if name_node.empty?
106
+
105
107
  properties = Util.xml_to_hash(name_node[0].parent, "excludedRepositories", false)
106
108
  from_hash(properties, options)
107
109
  end
@@ -156,6 +156,7 @@ module Artifactory
156
156
  def find_from_config(xpath, config, options = {})
157
157
  name_node = REXML::XPath.match(config, xpath)
158
158
  return nil if name_node.empty?
159
+
159
160
  properties = {}
160
161
  name_node[0].parent.each_element_with_text do |e|
161
162
  properties[e.name] = Util.to_type(e.text)
@@ -227,6 +228,7 @@ module Artifactory
227
228
  #
228
229
  def format_repos!(options)
229
230
  return options if options[:repos].nil? || options[:repos].empty?
231
+
230
232
  options[:repos] = Array(options[:repos]).compact.join(",")
231
233
  options
232
234
  end
@@ -340,7 +342,7 @@ module Artifactory
340
342
  if properties.empty?
341
343
  nil
342
344
  else
343
- ";#{properties.join(';')}"
345
+ ";#{properties.join(";")}"
344
346
  end
345
347
  end
346
348
 
@@ -377,7 +379,7 @@ module Artifactory
377
379
  end
378
380
  end.compact
379
381
 
380
- "#<#{short_classname} #{list.join(', ')}>"
382
+ "#<#{short_classname} #{list.join(", ")}>"
381
383
  end
382
384
 
383
385
  private
@@ -49,6 +49,7 @@ module Artifactory
49
49
  # builds. Whoever decided that was a good idea clearly doesn't
50
50
  # understand the point of REST interfaces...
51
51
  raise unless e.code == 404
52
+
52
53
  []
53
54
  end
54
55
 
@@ -78,6 +79,7 @@ module Artifactory
78
79
  from_hash(response["buildInfo"], client: client)
79
80
  rescue Error::HTTPError => e
80
81
  raise unless e.code == 404
82
+
81
83
  nil
82
84
  end
83
85
 
@@ -189,8 +191,7 @@ module Artifactory
189
191
 
190
192
  endpoint = "/api/build/promote/#{url_safe(name)}/#{url_safe(number)}"
191
193
  client.post(endpoint, JSON.fast_generate(request_body),
192
- "Content-Type" => "application/json"
193
- )
194
+ "Content-Type" => "application/json")
194
195
  end
195
196
 
196
197
  #
@@ -206,8 +207,7 @@ module Artifactory
206
207
  file.rewind
207
208
 
208
209
  client.put("/api/build", file,
209
- "Content-Type" => "application/json"
210
- )
210
+ "Content-Type" => "application/json")
211
211
  true
212
212
  ensure
213
213
  if file
@@ -41,6 +41,7 @@ module Artifactory
41
41
  # builds. Whoever decided that was a good idea clearly doesn't
42
42
  # understand the point of REST interfaces...
43
43
  raise unless e.code == 404
44
+
44
45
  []
45
46
  end
46
47
 
@@ -49,7 +49,7 @@ module Artifactory
49
49
  def delete
50
50
  client.delete(api_path)
51
51
  true
52
- rescue Error::HTTPError => e
52
+ rescue Error::HTTPError
53
53
  false
54
54
  end
55
55
 
@@ -72,6 +72,7 @@ module Artifactory
72
72
  response = client.post(api_path, file, headers)
73
73
 
74
74
  return unless response.is_a?(Hash)
75
+
75
76
  self.class.all.select { |x| x.certificate_alias.eql?(certificate_alias) }.first
76
77
  end
77
78
 
@@ -61,6 +61,7 @@ module Artifactory
61
61
  from_hash(response, client: client)
62
62
  rescue Error::HTTPError => e
63
63
  raise unless e.code == 404
64
+
64
65
  nil
65
66
  end
66
67
  end
@@ -59,6 +59,7 @@ module Artifactory
59
59
  find_from_config("config/repoLayouts/repoLayout/name[text()='#{name}']", config, options)
60
60
  rescue Error::HTTPError => e
61
61
  raise unless e.code == 404
62
+
62
63
  nil
63
64
  end
64
65
  end
@@ -59,6 +59,7 @@ module Artifactory
59
59
  find_from_config("config/security/ldapSettings/ldapSetting/key[text()='#{name}']", config, options)
60
60
  rescue Error::HTTPError => e
61
61
  raise unless e.code == 404
62
+
62
63
  nil
63
64
  end
64
65
 
@@ -100,6 +101,7 @@ module Artifactory
100
101
  def find_from_config(xpath, config, options = {})
101
102
  name_node = REXML::XPath.match(config, xpath)
102
103
  return nil if name_node.empty?
104
+
103
105
  properties = Util.xml_to_hash(name_node[0].parent, "search")
104
106
  from_hash(properties, options)
105
107
  end
@@ -59,6 +59,7 @@ module Artifactory
59
59
  find_from_config("config/mailServer/host[text()='#{host}']", config, options)
60
60
  rescue Error::HTTPError => e
61
61
  raise unless e.code == 404
62
+
62
63
  nil
63
64
  end
64
65
  end
@@ -66,6 +66,7 @@ module Artifactory
66
66
  from_hash(response, client: client)
67
67
  rescue Error::HTTPError => e
68
68
  raise unless e.code == 404
69
+
69
70
  nil
70
71
  end
71
72
 
@@ -118,8 +119,9 @@ module Artifactory
118
119
  def abbreviate_permissions(array)
119
120
  inverse = VERBOSE_PERMS.invert
120
121
  if (inverse.keys & array).sort != array.sort
121
- raise "One of your principals contains an invalid permission. Valid permissions are #{inverse.keys.join(', ')}"
122
+ raise "One of your principals contains an invalid permission. Valid permissions are #{inverse.keys.join(", ")}"
122
123
  end
124
+
123
125
  array.map { |elt| inverse[elt] }.sort
124
126
  end
125
127
 
@@ -61,6 +61,7 @@ module Artifactory
61
61
  from_hash(response, client: client)
62
62
  rescue Error::HTTPError => e
63
63
  raise unless e.code == 400
64
+
64
65
  nil
65
66
  end
66
67
  end
@@ -59,6 +59,7 @@ module Artifactory
59
59
  find_from_config("config/urlBase[text()='#{url}']", config, options)
60
60
  rescue Error::HTTPError => e
61
61
  raise unless e.code == 404
62
+
62
63
  nil
63
64
  end
64
65
 
@@ -61,6 +61,7 @@ module Artifactory
61
61
  from_hash(response, client: client)
62
62
  rescue Error::HTTPError => e
63
63
  raise unless e.code == 404
64
+
64
65
  nil
65
66
  end
66
67
  end
@@ -49,7 +49,7 @@ module Artifactory
49
49
  result = string
50
50
  .to_s
51
51
  .split("_")
52
- .map { |e| e.capitalize }
52
+ .map(&:capitalize)
53
53
  .join
54
54
 
55
55
  if lowercase
@@ -144,6 +144,7 @@ module Artifactory
144
144
  return true if string.eql?("true")
145
145
  return false if string.eql?("false")
146
146
  return string.to_i if numeric?(string)
147
+
147
148
  string
148
149
  end
149
150
 
@@ -15,5 +15,5 @@
15
15
  #
16
16
 
17
17
  module Artifactory
18
- VERSION = "3.0.5".freeze
18
+ VERSION = "3.0.12".freeze
19
19
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: artifactory
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.5
4
+ version: 3.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef Release Engineering Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-18 00:00:00.000000000 Z
11
+ date: 2019-12-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Ruby client for Artifactory
14
14
  email: releng@chef.io