vanagon 0.15.11 → 0.15.12

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: dd7f47d8b1278c31171ea168f3fd9c256852fa60
4
- data.tar.gz: 5d8fe77d2118bcc5d504d63af7579f51ca6a1551
3
+ metadata.gz: d2c4eb81b2e7e740b09969dc3e70f4a7293ce2b1
4
+ data.tar.gz: fd11e4e76da97f18170b90e2a80c2ef6863be29a
5
5
  SHA512:
6
- metadata.gz: 39ba4af17ff65f15b90a8c79944e32251986978b3c90102827fb978a9b2aee0ffec071041d7fd44b622b6c237edcc2a698776389c4cddf2049f9104dab8bbccc
7
- data.tar.gz: 372a532f5eedc4efbd2f33c830c1a3835a91218a737d61c5359f37fd96a3de8cbf78674574972473377304e0c2030c7c259240753b3a9a4b231e29b78ae53acd
6
+ metadata.gz: 9a9ee542de85c254ffc753e8355d6236953aff2dbf2d9107e664d234b172fbf7de469499892411f3efb902be94d52c3ba470fdb946d10f3b6d2e9194b6a2e9b9
7
+ data.tar.gz: 656bffd6573ae387c554eaf0fd935665d2114236532eda69a81b68b1d99b8de6e816c78190dc242fe9297b34b4a0932409cafa9964a93d2baa98bfe6d00ecc9e
@@ -3,6 +3,7 @@ require 'vanagon/environment'
3
3
  require 'vanagon/platform'
4
4
  require 'vanagon/project/dsl'
5
5
  require 'vanagon/utilities'
6
+ require 'digest'
6
7
  require 'ostruct'
7
8
 
8
9
  class Vanagon
@@ -671,20 +672,19 @@ class Vanagon
671
672
  # set in the project definition.
672
673
  #
673
674
  # @param [Vanagon::Platform] the platform to publish settings for
674
- def publish_yaml_settings(platform)
675
+ def publish_yaml_settings(platform) # rubocop:disable Metrics/AbcSize
675
676
  return unless yaml_settings
676
677
  raise(Vanagon::Error, "You must specify a project version") unless version
677
678
 
678
679
  filename = "#{name}-#{version}.#{platform.name}.settings.yaml"
679
- filepath = File.join('output', filename)
680
+ filepath = File.expand_path(File.join('output', filename))
680
681
 
681
682
  File.open(filepath, 'w') do |f|
682
683
  f.write(@settings.to_yaml)
683
684
  end
684
685
 
685
- File.open("#{filepath}.sha1", 'w') do |f|
686
- f.write(system("#{platform.shasum} #{filepath}", err: File::NULL))
687
- end
686
+ sha1 = Digest::SHA1.file(filepath).hexdigest
687
+ File.open("#{filepath}.sha1", 'w') { |f| f.puts(sha1) }
688
688
  end
689
689
 
690
690
  # Load the settings hash from an upstream vanagon project.
@@ -743,6 +743,7 @@ class Vanagon
743
743
  sum: settings_sha1_uri,
744
744
  sum_type: 'sha1')
745
745
  source.fetch
746
+ source.verify
746
747
  yaml_path = source.file
747
748
  if source_type == :http
748
749
  yaml_path = File.join(working_directory, source.file)
@@ -165,6 +165,7 @@ describe 'Vanagon::Project' do
165
165
  allow(Vanagon::Component::Source::Http).to receive(:valid_url?).with(http_yaml_uri).and_return(true)
166
166
  http_source = instance_double(Vanagon::Component::Source::Http)
167
167
  allow(Vanagon::Component::Source).to receive(:source).and_return(http_source)
168
+ allow(http_source).to receive(:verify).and_return(true)
168
169
 
169
170
  expect { project.load_yaml_settings(http_yaml_uri) }.to raise_error(Vanagon::Error)
170
171
  end
@@ -173,6 +174,7 @@ describe 'Vanagon::Project' do
173
174
  before(:each) do
174
175
  local_source = instance_double(Vanagon::Component::Source::Local)
175
176
  allow(local_source).to receive(:fetch)
177
+ allow(local_source).to receive(:verify).and_return(true)
176
178
  allow(local_source).to receive(:file).and_return(yaml_path)
177
179
 
178
180
  allow(Vanagon::Component::Source).to receive(:determine_source_type).and_return(:local)
@@ -390,17 +392,21 @@ describe 'Vanagon::Project' do
390
392
  project
391
393
  end
392
394
 
393
- let(:yaml_output_path) { "output/test-project-version.#{platform_name}.settings.yaml" }
394
- let(:sha1_output_path) { "output/test-project-version.#{platform_name}.settings.yaml.sha1" }
395
+ let(:yaml_output_path) { File.expand_path("test-project-version.#{platform_name}.settings.yaml", "output") }
396
+ let(:sha1_output_path) { File.expand_path("test-project-version.#{platform_name}.settings.yaml.sha1", "output") }
395
397
 
396
398
  let(:yaml_file) { double('yaml_file') }
397
399
  let(:sha1_file) { double('sha1_file') }
398
400
 
401
+ let(:sha1_content) { 'abcdef' }
402
+ let(:sha1_object) { instance_double(Digest::SHA1, hexdigest: sha1_content) }
403
+
399
404
  it 'writes project settings as yaml and a sha1sum for the settings to the output directory' do
400
405
  expect(File).to receive(:open).with(yaml_output_path, "w").and_yield(yaml_file)
406
+ expect(Digest::SHA1).to receive(:file).with(yaml_output_path).and_return(sha1_object)
401
407
  expect(File).to receive(:open).with(sha1_output_path, "w").and_yield(sha1_file)
402
408
  expect(yaml_file).to receive(:write).with({key: 'value'}.to_yaml)
403
- expect(sha1_file).to receive(:write)
409
+ expect(sha1_file).to receive(:puts).with(sha1_content)
404
410
  expect { project.publish_yaml_settings(platform) }.not_to raise_error
405
411
  end
406
412
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.11
4
+ version: 0.15.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-08 00:00:00.000000000 Z
11
+ date: 2018-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -259,46 +259,46 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  version: '0'
260
260
  requirements: []
261
261
  rubyforge_project:
262
- rubygems_version: 2.2.5
262
+ rubygems_version: 2.6.14
263
263
  signing_key:
264
264
  specification_version: 3
265
265
  summary: All of your packages will fit into this van with this one simple trick.
266
266
  test_files:
267
- - spec/lib/vanagon/component_spec.rb
268
- - spec/lib/vanagon/project_spec.rb
269
- - spec/lib/vanagon/optparse_spec.rb
270
- - spec/lib/vanagon/driver_spec.rb
271
- - spec/lib/vanagon/environment_spec.rb
272
- - spec/lib/vanagon/platform/windows_spec.rb
273
- - spec/lib/vanagon/platform/solaris_11_spec.rb
274
- - spec/lib/vanagon/platform/solaris_10_spec.rb
275
- - spec/lib/vanagon/platform/dsl_spec.rb
276
- - spec/lib/vanagon/platform/osx_spec.rb
277
- - spec/lib/vanagon/platform/deb_spec.rb
278
- - spec/lib/vanagon/platform/rpm_spec.rb
279
- - spec/lib/vanagon/platform/rpm/aix_spec.rb
280
- - spec/lib/vanagon/component/source/rewrite_spec.rb
267
+ - spec/lib/git/rev_list_spec.rb
268
+ - spec/lib/makefile_spec.rb
269
+ - spec/lib/vanagon/common/pathname_spec.rb
270
+ - spec/lib/vanagon/common/user_spec.rb
271
+ - spec/lib/vanagon/component/dsl_spec.rb
272
+ - spec/lib/vanagon/component/rules_spec.rb
281
273
  - spec/lib/vanagon/component/source/git_spec.rb
282
- - spec/lib/vanagon/component/source/local_spec.rb
283
274
  - spec/lib/vanagon/component/source/http_spec.rb
284
- - spec/lib/vanagon/component/dsl_spec.rb
275
+ - spec/lib/vanagon/component/source/local_spec.rb
276
+ - spec/lib/vanagon/component/source/rewrite_spec.rb
285
277
  - spec/lib/vanagon/component/source_spec.rb
286
- - spec/lib/vanagon/component/rules_spec.rb
287
- - spec/lib/vanagon/extensions/string_spec.rb
288
- - spec/lib/vanagon/extensions/set/json_spec.rb
289
- - spec/lib/vanagon/extensions/ostruct/json_spec.rb
290
- - spec/lib/vanagon/project/dsl_spec.rb
291
- - spec/lib/vanagon/utilities/shell_utilities_spec.rb
292
- - spec/lib/vanagon/utilities_spec.rb
293
- - spec/lib/vanagon/common/pathname_spec.rb
294
- - spec/lib/vanagon/common/user_spec.rb
295
- - spec/lib/vanagon/platform_spec.rb
278
+ - spec/lib/vanagon/component_spec.rb
279
+ - spec/lib/vanagon/driver_spec.rb
296
280
  - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
281
+ - spec/lib/vanagon/engine/base_spec.rb
297
282
  - spec/lib/vanagon/engine/docker_spec.rb
298
283
  - spec/lib/vanagon/engine/ec2_spec.rb
299
284
  - spec/lib/vanagon/engine/hardware_spec.rb
300
285
  - spec/lib/vanagon/engine/local_spec.rb
301
- - spec/lib/vanagon/engine/base_spec.rb
302
286
  - spec/lib/vanagon/engine/pooler_spec.rb
303
- - spec/lib/makefile_spec.rb
304
- - spec/lib/git/rev_list_spec.rb
287
+ - spec/lib/vanagon/environment_spec.rb
288
+ - spec/lib/vanagon/extensions/ostruct/json_spec.rb
289
+ - spec/lib/vanagon/extensions/set/json_spec.rb
290
+ - spec/lib/vanagon/extensions/string_spec.rb
291
+ - spec/lib/vanagon/optparse_spec.rb
292
+ - spec/lib/vanagon/platform/deb_spec.rb
293
+ - spec/lib/vanagon/platform/dsl_spec.rb
294
+ - spec/lib/vanagon/platform/osx_spec.rb
295
+ - spec/lib/vanagon/platform/rpm/aix_spec.rb
296
+ - spec/lib/vanagon/platform/rpm_spec.rb
297
+ - spec/lib/vanagon/platform/solaris_10_spec.rb
298
+ - spec/lib/vanagon/platform/solaris_11_spec.rb
299
+ - spec/lib/vanagon/platform/windows_spec.rb
300
+ - spec/lib/vanagon/platform_spec.rb
301
+ - spec/lib/vanagon/project/dsl_spec.rb
302
+ - spec/lib/vanagon/project_spec.rb
303
+ - spec/lib/vanagon/utilities/shell_utilities_spec.rb
304
+ - spec/lib/vanagon/utilities_spec.rb