diffend 0.2.43 → 0.2.44

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: 00ff9a1819f62275a52e0d531ac9a3d9061e388867ec5e73ea0dc923a9ba30ed
4
- data.tar.gz: '092ac2a98fd88ca4c8cc014aec5a2e485c6a280b17e44e3000b99d5dddbb0bf3'
3
+ metadata.gz: 07bae52f686cd3e88f10c37295b5cebe4227aa58f22af34c3dc81468e644324f
4
+ data.tar.gz: 6aa9385bc4d9f3db721df93ca8cab6896da38deb91c96d458fe98922323663ad
5
5
  SHA512:
6
- metadata.gz: 6f6d630a67a621c4a92c1835340ef2195834ba9c2717de4d4da4256b31cbf709347d2129593b167de4dfb8bdf27d771127b9fcefdde2e3b4ee5cfe05b8f2e666
7
- data.tar.gz: feee0a4cd775f6aa3a7324294975e20c9edb51fb9bc733c33765bc0f3c31a130315f94d92779acab7d5ac6f3b3783d9b9ed992f48fd741a5069e58d88cbcdd03
6
+ metadata.gz: ef8e5536b559884c981b27a228719bf3b8f6d6f81e32c4dd8ae4cf3485fa0e7da61ca6ab09e4596992e3c27e5b68b3f8fefaa7b18c606ffe99c30e4f0f896fd5
7
+ data.tar.gz: 38ba600074cc62b4c23ab4a6f0604afa45d94f5a299dc4428a24441d84b82e1c3982442a27dd659c349056992978f334d1f8e45e069c8780fee39d7dca17b740
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  ## [Unreleased][master]
4
4
 
5
+ ## [0.2.44] (2021-03-31)
6
+ - `project_id`, `shareable_id` and `shareable_key` need to be a valid UUID
7
+
5
8
  ## [0.2.43] (2021-03-16)
6
9
  - introduce `DIFFEND_TAGS` ([#119](https://github.com/diffend-io/diffend-ruby/pull/119))
7
10
  - add support for `bundle add` command ([#118](https://github.com/diffend-io/diffend-ruby/pull/118))
@@ -138,7 +141,8 @@
138
141
 
139
142
  - initial release
140
143
 
141
- [master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.43...HEAD
144
+ [master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.44...HEAD
145
+ [0.2.44]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.43...v0.2.44
142
146
  [0.2.43]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.42...v0.2.43
143
147
  [0.2.42]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.41...v0.2.42
144
148
  [0.2.41]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.40...v0.2.41
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- diffend (0.2.43)
4
+ diffend (0.2.44)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,6 +32,17 @@ module Diffend
32
32
  Expected #{Validator::KNOWN_KEYS[key].join(' or ')}, was #{config.public_send(key).class}.
33
33
  MSG
34
34
  end
35
+
36
+ # Invalid uuid value message
37
+ #
38
+ # @param key [String] invalid key
39
+ #
40
+ # @return [String]
41
+ def invalid_uuid(key)
42
+ <<~MSG
43
+ Diffend configuration value for #{key} is invalid.
44
+ MSG
45
+ end
35
46
  end
36
47
  end
37
48
  end
@@ -17,6 +17,14 @@ module Diffend
17
17
  development?: [TrueClass, FalseClass]
18
18
  }.freeze
19
19
 
20
+ # List of known uuid keys
21
+ UUID_KEYS = %i[project_id shareable_id shareable_key].freeze
22
+
23
+ # Imported from https://github.com/assaf/uuid/blob/master/lib/uuid.rb#L199
24
+ UUID_FORMAT = /\A[\da-f]{8}-([\da-f]{4}-){3}[\da-f]{12}\z/i
25
+
26
+ private_constant :UUID_KEYS, :UUID_FORMAT
27
+
20
28
  class << self
21
29
  # @param config [Diffend::Config]
22
30
  def call(config)
@@ -28,6 +36,12 @@ module Diffend
28
36
 
29
37
  config.errors << ErrorMessages.invalid_key(config, key) if invalid?(config, key)
30
38
  end
39
+
40
+ UUID_KEYS.each do |key|
41
+ next if valid_uuid?(config, key)
42
+
43
+ config.errors << ErrorMessages.invalid_uuid(key)
44
+ end
31
45
  end
32
46
 
33
47
  private
@@ -49,6 +63,14 @@ module Diffend
49
63
  def invalid?(config, key)
50
64
  !KNOWN_KEYS[key].include?(config.public_send(key).class)
51
65
  end
66
+
67
+ # @param config [Diffend::Config]
68
+ # @param key [String]
69
+ #
70
+ # @return [Boolean] true if key has a valid uuid, false otherwise
71
+ def valid_uuid?(config, key)
72
+ UUID_FORMAT.match?(config.public_send(key))
73
+ end
52
74
  end
53
75
  end
54
76
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Diffend
4
4
  # Current version
5
- VERSION = '0.2.43'
5
+ VERSION = '0.2.44'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diffend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.43
4
+ version: 0.2.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Pajor
@@ -34,7 +34,7 @@ cert_chain:
34
34
  9MmF6uCQa1EjK2p8tYT0MnbHrFkoehxdX4VO9y99GAkhZyJNKPYPtyAUFV27sT2V
35
35
  LfCJRk4ifKIN/FUCwDSn8Cz0m6oH265q0p6wdzI6qrWOjP8tGOMBTA==
36
36
  -----END CERTIFICATE-----
37
- date: 2021-03-16 00:00:00.000000000 Z
37
+ date: 2021-03-31 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: bundler
metadata.gz.sig CHANGED
Binary file