record_store 5.2.1 → 5.2.2

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: 7b0eb3158b6884906c3158f0b09e46417b714d9f
4
- data.tar.gz: f2d23e9c6aee9c94bfd276f8dec1db488d78d900
3
+ metadata.gz: d39d4eef870b4fb7d6634f320f94c1eafdc744e9
4
+ data.tar.gz: dd9eba4966da027f358a0f82b0b515a916188774
5
5
  SHA512:
6
- metadata.gz: 7aa13c01efa056267a2cdcdb791d288830c2d9372b54ca9ee0ea547bf6b05302d34065128bce6701d5fb655d36425fb28b74bab2abaa3e722c1f10bfe1970b9b
7
- data.tar.gz: 6ac7dcd241e3385df6b93694514615b4231b599ce18b3a940d15060a4d92d7cda3c4e967fb35379460099d4ed188e41de27c309f404943d56a67b150221dc5fe
6
+ metadata.gz: b5e25983fc1d7cafa44207f6c8e0ec38969eeda47da61b876bb60e783c19627f06e3468ed2f948553331523e5b8f3fa1bd2c355023dbfae1fa3dafba579eaf26
7
+ data.tar.gz: 406d44994a2b93a02ec891f35ee1a86f95e56b5e88d325185016a4f0cecedf5a151e930b13ba1e8a6ed3f23fb4a306115defa85770e18d91df5548a6286714ac
data/.gitignore CHANGED
@@ -3,3 +3,4 @@ test/vcr_debug.log
3
3
  dev/
4
4
  pkg/
5
5
  Gemfile.lock
6
+ .bundle/config
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 5.2.2
4
+ - support regex based ignore patterns [FEATURE]
5
+
3
6
  ## 5.2.1
4
7
  - remove alias at domain root validation
5
8
 
@@ -1,3 +1,3 @@
1
1
  module RecordStore
2
- VERSION = '5.2.1'.freeze
2
+ VERSION = '5.2.2'.freeze
3
3
  end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RecordStore
4
+ class Zone
5
+ class Config
6
+ class IgnorePattern
7
+ MATCH_TYPE_FIELD = 'match'
8
+ MATCH_TYPE_REGEX = 'regex'
9
+ MATCH_TYPE_EXACT = 'exact'
10
+
11
+ def initialize(orig_hash)
12
+ @orig_hash = orig_hash
13
+ end
14
+
15
+ def ignore?(record)
16
+ all_pairs.all? do |(key, value)|
17
+ record.respond_to?(key) && value_matches?(value, record.send(key))
18
+ end
19
+ end
20
+
21
+ def to_hash
22
+ @orig_hash
23
+ end
24
+
25
+ private
26
+
27
+ def all_pairs
28
+ to_hash.reject { |key| key == MATCH_TYPE_FIELD }
29
+ end
30
+
31
+ def value_matches?(ignore_pattern_value, record_value)
32
+ return record_value.match?(ignore_pattern_value) if regex?
33
+ return record_value == ignore_pattern_value if exact?
34
+
35
+ false
36
+ end
37
+
38
+ def regex?
39
+ to_hash[MATCH_TYPE_FIELD] == MATCH_TYPE_REGEX
40
+ end
41
+
42
+ def exact?
43
+ to_hash.fetch(MATCH_TYPE_FIELD, MATCH_TYPE_EXACT) == MATCH_TYPE_EXACT
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -8,7 +8,10 @@ module RecordStore
8
8
  validate :validate_zone_config
9
9
 
10
10
  def initialize(ignore_patterns: [], providers: nil, supports_alias: nil)
11
- @ignore_patterns = ignore_patterns
11
+ @ignore_patterns = ignore_patterns.map do |ignore_pattern|
12
+ Zone::Config::IgnorePattern.new(ignore_pattern)
13
+ end
14
+
12
15
  @providers = providers
13
16
  @supports_alias = supports_alias
14
17
  end
@@ -24,7 +27,7 @@ module RecordStore
24
27
  def to_hash
25
28
  config_hash = {
26
29
  providers: providers,
27
- ignore_patterns: ignore_patterns,
30
+ ignore_patterns: ignore_patterns.map(&:to_hash)
28
31
  }
29
32
  config_hash.merge!(supports_alias: supports_alias) if supports_alias
30
33
 
@@ -35,7 +35,7 @@ module RecordStore
35
35
  def filter_records(current_records, ignore_patterns)
36
36
  ignore_patterns.inject(current_records) do |remaining_records, pattern|
37
37
  remaining_records.reject do |record|
38
- pattern.all? { |(key, value)| record.respond_to?(key) && value === record.send(key) }
38
+ pattern.ignore?(record)
39
39
  end
40
40
  end
41
41
  end
data/lib/record_store.rb CHANGED
@@ -24,6 +24,7 @@ require 'record_store/record/srv'
24
24
  require 'record_store/zone/yaml_definitions'
25
25
  require 'record_store/zone'
26
26
  require 'record_store/zone/config'
27
+ require 'record_store/zone/config/ignore_pattern'
27
28
  require 'record_store/changeset'
28
29
  require 'record_store/provider'
29
30
  require 'record_store/provider/dynect'
data/record_store.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_runtime_dependency 'fog-json'
29
29
  spec.add_runtime_dependency 'fog-xml'
30
30
  spec.add_runtime_dependency 'fog-dynect', '~> 0.2.0'
31
- spec.add_runtime_dependency 'dnsimple-ruby', '~> 2.0'
31
+ spec.add_runtime_dependency 'dnsimple', '~> 4.4.0'
32
32
  spec.add_runtime_dependency 'google-cloud-dns'
33
33
  spec.add_runtime_dependency 'ruby-limiter', '~> 1.0', '>= 1.0.1'
34
34
 
@@ -17,7 +17,7 @@
17
17
  "client_email": "client_email",
18
18
  "client_id": "client_id",
19
19
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
20
- "token_uri": "https://accounts.google.com/o/oauth2/token",
20
+ "token_uri": "https://oauth2.googleapis.com/token",
21
21
  "auth_provider_x509_cert_url": "auth_provider_x509_cert_url",
22
22
  "client_x509_cert_url": "client_x509_cert_url"
23
23
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: record_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.1
4
+ version: 5.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-07-18 00:00:00.000000000 Z
12
+ date: 2018-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -124,19 +124,19 @@ dependencies:
124
124
  - !ruby/object:Gem::Version
125
125
  version: 0.2.0
126
126
  - !ruby/object:Gem::Dependency
127
- name: dnsimple-ruby
127
+ name: dnsimple
128
128
  requirement: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '2.0'
132
+ version: 4.4.0
133
133
  type: :runtime
134
134
  prerelease: false
135
135
  version_requirements: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: '2.0'
139
+ version: 4.4.0
140
140
  - !ruby/object:Gem::Dependency
141
141
  name: google-cloud-dns
142
142
  requirement: !ruby/object:Gem::Requirement
@@ -297,6 +297,7 @@ files:
297
297
  - lib/record_store/version.rb
298
298
  - lib/record_store/zone.rb
299
299
  - lib/record_store/zone/config.rb
300
+ - lib/record_store/zone/config/ignore_pattern.rb
300
301
  - lib/record_store/zone/yaml_definitions.rb
301
302
  - record_store.gemspec
302
303
  - shipit.rubygems.yml