artifactory 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b89a0d205ba82632c1f9b538a50b84f69b67ac0f
4
- data.tar.gz: 1484191f4caf8502ca9ec7519d97c67fe5cc51f7
3
+ metadata.gz: eb987fd18b2034340daf17e7f5d6d06b7289966f
4
+ data.tar.gz: 5315895f5ab0badfee1351eecfd7d80a701d509c
5
5
  SHA512:
6
- metadata.gz: 9d374065d88be5dc94f46fa9c4cf90694e8eb270ef1c92c6036a1e7941274735ca89e9ecc326d3d2d25d4a9170dd89217b0d6ee39cb2b616810817d756734249
7
- data.tar.gz: dbe9986454583e5977d555d466a9163a535ae1a623b1d7916f258c1016315db1c32e09355f8e48303793a2c3189a3c9f5044b168217ecac6ca02d031aecbd042
6
+ metadata.gz: 56040d7854457cbd0d86712e1ad7e096e539409012ea8e904fe4eda9b8d18ee7f4ad4d31f5f45ec12636c7f8f9c734b40fcbf9e45555d50660b9689db801f993
7
+ data.tar.gz: 93bdb1b294a58cb73d6bfbcb118090828b25e1dd7ee0cf5e92a00850b6850f16bdf22248a900a62a6338e03b5e3425da78500b047a60157b61d1b106d4fa2402
@@ -3,6 +3,13 @@ Artifactory Client CHANGELOG
3
3
  This file is used to document the changes between releases of the Artifactory
4
4
  Ruby client.
5
5
 
6
+ v2.2.1 (12-16-2014)
7
+ -------------------
8
+ - provide data to post in `Artifact#copy_or_move`
9
+ - pass correct variable to redirect request in `Client#request`
10
+ - use CGI escape to encode data values
11
+ - when checksums are available, upload using the checksum headers.
12
+
6
13
  v2.2.0 (11-20-2014)
7
14
  -------------------
8
15
  - Add artifact usage search
@@ -14,6 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
+ require 'cgi'
17
18
  require 'json'
18
19
  require 'net/http'
19
20
  require 'uri'
@@ -247,7 +248,7 @@ module Artifactory
247
248
  case response
248
249
  when Net::HTTPRedirection
249
250
  redirect = URI.parse(response['location'])
250
- request(verb, redirect, params, headers)
251
+ request(verb, redirect, data, headers)
251
252
  when Net::HTTPSuccess
252
253
  success(response)
253
254
  else
@@ -331,7 +332,7 @@ module Artifactory
331
332
  #
332
333
  def to_query_string(hash)
333
334
  hash.map do |key, value|
334
- "#{URI.escape(key.to_s)}=#{URI.escape(value.to_s)}"
335
+ "#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}"
335
336
  end.join('&')[/.+/]
336
337
  end
337
338
 
@@ -534,20 +534,18 @@ module Artifactory
534
534
  matrix = to_matrix_properties(properties)
535
535
  endpoint = File.join("#{url_safe(repo)}#{matrix}", remote_path)
536
536
 
537
- response = client.put(endpoint, file, headers)
537
+ # Include checksums in headers if given.
538
+ headers['X-Checksum-Md5'] = md5 if md5
539
+ headers['X-Checksum-Sha1'] = sha1 if sha1
538
540
 
539
- # Upload checksums if they were given
540
- upload_checksum(repo, remote_path, :md5, md5) if md5
541
- upload_checksum(repo, remote_path, :sha1, sha1) if sha1
541
+ response = client.put(endpoint, file, headers)
542
542
 
543
543
  self.class.from_hash(response)
544
544
  end
545
545
 
546
546
  #
547
547
  # Upload the checksum for this artifact. **The artifact must already be
548
- # uploaded or Artifactory will throw an exception!**. This is both a public
549
- # and private API. It is automatically called in {upload} if the SHA
550
- # values are set. You may also call it manually.
548
+ # uploaded or Artifactory will throw an exception!**.
551
549
  #
552
550
  # @example Set an artifact's md5
553
551
  # artifact = Artifact.new(local_path: '/local/path/to/file.deb')
@@ -678,7 +676,7 @@ module Artifactory
678
676
 
679
677
  endpoint = File.join('/api', action.to_s, relative_path) + '?' + params.join('&')
680
678
 
681
- client.post(endpoint)
679
+ client.post(endpoint, {})
682
680
  end
683
681
  end
684
682
  end
@@ -15,5 +15,5 @@
15
15
  #
16
16
 
17
17
  module Artifactory
18
- VERSION = '2.2.0'
18
+ VERSION = '2.2.1'
19
19
  end
@@ -91,5 +91,17 @@ module Artifactory
91
91
  end
92
92
  end
93
93
  end
94
+
95
+ describe '#to_query_string' do
96
+ it 'converts spaces to "+" characters' do
97
+ params = {user: 'Seth Chisamore'}
98
+ expect(subject.to_query_string(params)).to eq('user=Seth+Chisamore')
99
+ end
100
+
101
+ it 'converts "+" to "%2B"' do
102
+ params = {version: '12.0.0-alpha.1+20140826080510.git.50.f5ff271'}
103
+ expect(subject.to_query_string(params)).to eq('version=12.0.0-alpha.1%2B20140826080510.git.50.f5ff271')
104
+ end
105
+ end
94
106
  end
95
107
  end
@@ -52,6 +52,24 @@ module Artifactory
52
52
  end
53
53
  end
54
54
 
55
+ context 'when the md5 is available' do
56
+ subject { described_class.new(client: client, local_path: local_path, checksums: { 'md5' => 'ABCDEF123456' } ) }
57
+
58
+ it 'PUTs the file with the checksum headers set' do
59
+ expect(client).to receive(:put).with('libs-release-local/remote/path', file, { 'X-Checksum-Md5' => 'ABCDEF123456' } )
60
+ subject.upload('libs-release-local', '/remote/path')
61
+ end
62
+ end
63
+
64
+ context 'when the sha1 is available' do
65
+ subject { described_class.new(client: client, local_path: local_path, checksums: { 'sha1' => 'SHA1' } ) }
66
+
67
+ it 'PUTs the file with the checksum headers set' do
68
+ expect(client).to receive(:put).with('libs-release-local/remote/path', file, { 'X-Checksum-Sha1' => 'SHA1' } )
69
+ subject.upload('libs-release-local', '/remote/path')
70
+ end
71
+ end
72
+
55
73
  context 'when matrix properties are given' do
56
74
  it 'converts the hash into matrix properties' do
57
75
  expect(client).to receive(:put).with('libs-release-local;branch=master;user=Seth/remote/path', file, {})
@@ -498,12 +516,12 @@ module Artifactory
498
516
  end
499
517
 
500
518
  it 'sends POST to the client with parsed params' do
501
- expect(client).to receive(:post).with('/api/move/foo/bar/artifact.deb?to=/to/path')
519
+ expect(client).to receive(:post).with('/api/move/foo/bar/artifact.deb?to=/to/path', {})
502
520
  subject.copy_or_move(:move, '/to/path')
503
521
  end
504
522
 
505
523
  it 'adds the correct parameters to the request' do
506
- expect(client).to receive(:post).with('/api/move/foo/bar/artifact.deb?to=/to/path&failFast=1&dry=1')
524
+ expect(client).to receive(:post).with('/api/move/foo/bar/artifact.deb?to=/to/path&failFast=1&dry=1', {})
507
525
  subject.copy_or_move(:move, '/to/path', fail_fast: true, dry_run: true)
508
526
  end
509
527
  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: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Vargo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
133
  version: '0'
134
134
  requirements: []
135
135
  rubyforge_project:
136
- rubygems_version: 2.2.2
136
+ rubygems_version: 2.4.5
137
137
  signing_key:
138
138
  specification_version: 4
139
139
  summary: Artifactory is a simple, lightweight Ruby client for interacting with the