vara 0.17.2 → 0.17.3

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: 4b7ad623bfe74edb46c3a0d2ea8d0caff857045b
4
- data.tar.gz: a4da45b3a28751e767f4a4a5a93b28aea5411184
3
+ metadata.gz: 6ce2c2e730b28154e9a4dec7266f2ea1e35113e6
4
+ data.tar.gz: f5304de651d5f0d8ab77168af2477d0e00b36c97
5
5
  SHA512:
6
- metadata.gz: 1e3c08d3f8072090718e4679833ec24e6dc0c8b9b84cbbb566300bf404d7dcdd5292f058f35ab302c22406cadb35709c255866ebe256dc44e7dec5ef1ce1ae99
7
- data.tar.gz: 0824ab84abfcd9f0fbad0f9d8aab2592692fd00ec70dfa30b98b05aaaf719c4f1c97a334cb0a468cf911abcfd2942c678c86ad3f75ef5836ac2ac66f938555d7
6
+ metadata.gz: 67043f52e18867c3dc258d89125df22884be362d09e42d62c3c209e2ae66bcc463f2ea71ae8ad1dd7efdcd6a079ff7ce38f904b8055ee07fd675bfdc9679a908
7
+ data.tar.gz: b88c30cf4ced4e267fd5b95d1c808b9609f624c8b5fce4a0ae683d75557f28c65cabd2f13f121425b7d544303d6881097ca2f80aa4ba449883bacf065f050927
@@ -31,7 +31,9 @@ module Vara
31
31
 
32
32
  attr_reader :product_dir, :versioner, :external_release_paths
33
33
 
34
- ALLOWED_RELEASE_KEYS = %w(file name url md5 version)
34
+ REQUIRED_RELEASE_KEYS = %w(file name md5 version)
35
+ EXCLUSIVE_KEYS = %w(url aws)
36
+ REQUIRED_AWS_KEYS = %w(access_key_id secret_access_key bucket_name region filename)
35
37
 
36
38
  def merged_metadata
37
39
  binaries_path = File.join(product_dir, 'metadata_parts', 'binaries.yml')
@@ -63,13 +65,38 @@ module Vara
63
65
  end
64
66
  end
65
67
 
68
+ # rubocop:disable CyclomaticComplexity
66
69
  def validate_release(external_release, external_release_path)
67
- missing_keys = ALLOWED_RELEASE_KEYS - external_release.keys.to_a
68
- fail "Specified release #{File.basename(external_release_path)} is missing keywords: #{missing_keys}" unless missing_keys.empty?
69
- extra_keys = external_release.keys.to_a - ALLOWED_RELEASE_KEYS
70
- fail "Specified release #{File.basename(external_release_path)} has extra keywords: #{extra_keys}" unless extra_keys.empty?
70
+ missing_keys = REQUIRED_RELEASE_KEYS - external_release.keys.to_a
71
+ specified_release = "Specified release #{File.basename(external_release_path)} "
72
+
73
+ fail specified_release + "is missing required keywords: #{missing_keys}" unless missing_keys.empty?
74
+
75
+ exclusive_key_count = (EXCLUSIVE_KEYS - external_release.keys.to_a).length
76
+ case
77
+ when exclusive_key_count < 1
78
+ fail specified_release + "contains more than one of the following keys, but only one is allowed: #{EXCLUSIVE_KEYS}"
79
+ when exclusive_key_count > 1
80
+ fail specified_release + "requires one of the following keys: #{EXCLUSIVE_KEYS}"
81
+ end
82
+
83
+ if external_release.key?('aws')
84
+ missing_aws_keys = missing_aws_keys(external_release)
85
+
86
+ fail specified_release + "is missing required aws hash keywords: #{missing_aws_keys}" unless missing_aws_keys.empty?
87
+ end
88
+
89
+ extra_keys = external_release.keys.to_a - REQUIRED_RELEASE_KEYS - EXCLUSIVE_KEYS
90
+ fail specified_release + "has extra keywords: #{extra_keys}" unless extra_keys.empty?
71
91
  external_release
72
92
  end
93
+ # rubocop:enable CyclomaticComplexity
94
+
95
+ def missing_aws_keys(external_release)
96
+ REQUIRED_AWS_KEYS.select do |required_aws_key|
97
+ !external_release['aws'].key?(required_aws_key)
98
+ end
99
+ end
73
100
 
74
101
  def save_processed_metadata(processed_metadata_hash)
75
102
  product_name = processed_metadata_hash.fetch('name').tr('-', '_')
@@ -1,5 +1,5 @@
1
1
  module Vara
2
- VERSION = '0.17.2'
2
+ VERSION = '0.17.3'
3
3
  end
4
4
 
5
5
  # Copyright (c) 2014-2015 Pivotal Software, Inc.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.2
4
+ version: 0.17.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - CF Release Engineering
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-22 00:00:00.000000000 Z
11
+ date: 2016-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  version: '0'
206
206
  requirements: []
207
207
  rubyforge_project:
208
- rubygems_version: 2.4.5
208
+ rubygems_version: 2.2.2
209
209
  signing_key:
210
210
  specification_version: 4
211
211
  summary: Vara starts with a product git repository that meets specific requirements.