artifactory 2.5.0 → 2.5.1

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
  SHA1:
3
- metadata.gz: 10265df7277800763574fae7df4d0c6ff325c890
4
- data.tar.gz: 5184c53709a8a1f37de75bd4a50d0521d823fe02
3
+ metadata.gz: debdaf9656756bf1f7068230636025e40b3a0aec
4
+ data.tar.gz: b6a4d23d52134bae4a126386b4afa2abe7159df8
5
5
  SHA512:
6
- metadata.gz: 54ee97b220dab7402ab9d355ee9913e773a2b5af56f0ec9595a4ee7fdbc974e13bedacb24a836883e36db0e9f3ebda0b831c58ed17c3125c65ea602a9127f157
7
- data.tar.gz: 06266bca20064100915396a12811a04c3f0d85f20d3d8b56f57f5545e6c379fad69a65b98ebf6243834a19aa4745b0ba39471174d99c6d7a56dce18f9e265d1c
6
+ metadata.gz: 677aa4dc20927179229f4fa6733a74565a928aedbb3d6300f698f485ee769848b618e0de60080595c52f93ba1a359df3e49ec18abe590a4fedef65afa6e830ca
7
+ data.tar.gz: f2e1802388c8c0ae0cc8561ba453f56dd84c6a6bdf8f109812dbb73f87d8faedffe45f48f708f40fe5484558af6df59bd0110b74ba5250787b5d3b57ca975559
@@ -3,6 +3,9 @@ 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.5.1 (11-10-2016)
7
+ -------------------
8
+
6
9
  v2.5.0 (09-15-2016)
7
10
  -------------------
8
11
  - Add support for extended YUM repo attributes
data/Gemfile CHANGED
@@ -5,6 +5,14 @@ group :test do
5
5
  gem 'sinatra', '~> 1.4'
6
6
  gem 'rspec', '~> 3.0'
7
7
  gem 'webmock', '~> 1.17'
8
+ if RUBY_VERSION =~ /^1\.9\.3.*/
9
+ # gaurd that webmock only brings in addressable with 1.9.3 support.
10
+ gem 'addressable', '<= 2.4.0'
11
+ # guard simplecov import of json gem
12
+ gem 'json', '<= 1.8.3'
13
+ end
8
14
  # rspec-mocks 3.4.1 breaks tests with 'System level too deep' errors.
9
15
  gem 'rspec-mocks', '3.4.0'
16
+ gem 'simplecov'
17
+ gem 'simplecov-console'
10
18
  end
data/Rakefile CHANGED
@@ -12,3 +12,8 @@ namespace :travis do
12
12
  desc 'Run tests on Travis'
13
13
  task :ci => [:unit,:integration]
14
14
  end
15
+
16
+ desc 'Generate coverage report'
17
+ RSpec::Core::RakeTask.new(:coverage) do |t|
18
+ ENV['COVERAGE'] = 'true'
19
+ end
@@ -540,6 +540,7 @@ module Artifactory
540
540
 
541
541
  response = client.put(endpoint, file, headers)
542
542
 
543
+ return unless response.is_a?(Hash)
543
544
  self.class.from_hash(response)
544
545
  end
545
546
 
@@ -15,5 +15,5 @@
15
15
  #
16
16
 
17
17
  module Artifactory
18
- VERSION = '2.5.0'
18
+ VERSION = '2.5.1'
19
19
  end
@@ -2,6 +2,18 @@ require 'bundler/setup'
2
2
  require 'rspec'
3
3
  require 'webmock/rspec'
4
4
 
5
+ if ENV['COVERAGE']
6
+ require 'simplecov'
7
+ require 'simplecov-console'
8
+ SimpleCov.start do
9
+ add_filter 'spec/'
10
+ formatter SimpleCov::Formatter::MultiFormatter.new [
11
+ SimpleCov::Formatter::HTMLFormatter,
12
+ SimpleCov::Formatter::Console,
13
+ ]
14
+ end
15
+ end
16
+
5
17
  # Require our main library
6
18
  require 'artifactory'
7
19
 
@@ -109,6 +109,21 @@ module Artifactory
109
109
  end
110
110
  end
111
111
 
112
+ describe '#upload_checksum' do
113
+ it 'uploads checksum.sha1' do
114
+ value = 'ABCD1234'
115
+
116
+ tempfile = double('Tempfile').as_null_object
117
+ expect(Tempfile).to receive(:new).with('checksum.sha1') { tempfile }
118
+ expect(tempfile).to receive(:write).with(value).once
119
+ expect(client).to receive(:put).with(
120
+ "libs-release-local/remote/path.sha1",
121
+ tempfile
122
+ )
123
+ subject.upload_checksum('libs-release-local', '/remote/path', 'sha1', value)
124
+ end
125
+ end
126
+
112
127
  describe '#upload_with_checksum' do
113
128
  it 'delegates to #upload' do
114
129
  expect(subject).to receive(:upload).with(
@@ -136,6 +151,19 @@ module Artifactory
136
151
  )
137
152
  subject.upload_from_archive('libs-release-local', '/remote/path')
138
153
  end
154
+
155
+ it 'receives empty response' do
156
+ file = double(File)
157
+ allow(File).to receive(:new).and_return( file )
158
+ expect(client).to receive(:put).with(
159
+ "libs-release-local/remote/path",
160
+ file,
161
+ { 'X-Explode-Archive' => true },
162
+ )
163
+ subject.local_path = '/local/path'
164
+ subject.upload_from_archive('libs-release-local', '/remote/path')
165
+ end
166
+
139
167
  end
140
168
 
141
169
  describe '.gavc_search' do
@@ -498,7 +526,25 @@ module Artifactory
498
526
  end
499
527
 
500
528
  describe '#download' do
501
- it
529
+ it 'download content to directory' do
530
+ Dir.mktmpdir('artifact_download') do |tmpdir|
531
+ subject.download_uri = '/artifact.deb'
532
+
533
+ expect(client).to receive(:get) { 'some content' }
534
+ subject.download(tmpdir)
535
+ expect(Dir.entries(tmpdir)).to include('artifact.deb')
536
+ end
537
+ end
538
+
539
+ it 'download content to directory with filename' do
540
+ Dir.mktmpdir('artifact_download') do |tmpdir|
541
+ subject.download_uri = '/artifact.deb'
542
+
543
+ expect(client).to receive(:get) { 'some content' }
544
+ subject.download(tmpdir, {filename: 'foobar.deb'})
545
+ expect(Dir.entries(tmpdir)).to include('foobar.deb')
546
+ end
547
+ end
502
548
  end
503
549
 
504
550
  describe '#relative_path' do
@@ -193,5 +193,25 @@ module Artifactory
193
193
  expect(subject.artifacts).to be_a(Collection::Artifact)
194
194
  end
195
195
  end
196
+
197
+ describe '#upload_with_checksum' do
198
+ it 'delecates to artifact' do
199
+ artifact = double('Artifact')
200
+ allow(Resource::Artifact).to receive(:new) { artifact }
201
+ subject.key = 'libs-release-local'
202
+ expect(artifact).to receive(:upload_with_checksum).once
203
+ subject.upload_with_checksum('/local/path', '/remote/path', 'checksum', {properties: :foobar})
204
+ end
205
+ end
206
+
207
+ describe '#upload_from_archive' do
208
+ it 'delecates to artifact' do
209
+ artifact = double('Artifact')
210
+ allow(Resource::Artifact).to receive(:new) { artifact }
211
+ subject.key = 'libs-release-local'
212
+ expect(artifact).to receive(:upload_from_archive).once
213
+ subject.upload_from_archive('/local/path', '/remote/path', {properties: :foobar})
214
+ end
215
+ end
196
216
  end
197
217
  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.5.0
4
+ version: 2.5.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: 2016-09-15 00:00:00.000000000 Z
11
+ date: 2016-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler