cloudflare-dns-update 2.1.0 → 2.1.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: 6233abf492347fbca6f5f3612c7f17c31bd3b899
4
- data.tar.gz: 71393d51929cb97ff6ddda857370b7dc69f29dcb
3
+ metadata.gz: 6dad16eca439baf778b65ace80eee737f6ab3884
4
+ data.tar.gz: fec02f50d441f579a4e5d3b560c1dcfb086a9bc0
5
5
  SHA512:
6
- metadata.gz: 2d0c6f568e5f4c43a4200ed1c58ea544eb9cb23ea8c4c2c4a65c3654736b7fcaa634cc69538c33bc85ec66bb477045892c612ada9942184f6aecf0d6aa5b2032
7
- data.tar.gz: a1524e97636719e1ac123c468ebfb26b796c9cdb51f6f3aa21741467614a8fd41d3b8de66318c96f1c97bb4dd06b58d7fa21e6ddd4ded9e1e041cbef512416f9
6
+ metadata.gz: 26c35465cc6f0145337771131676d5d071c4c7d4c00b4e504c2c9452cc27dce547c4a267120c6e4b86f24f7c62c2202058b7d09050df830dfd4f18e17e9c068f
7
+ data.tar.gz: f8c26eef30fb4fe0ce5058002fd4be70ea4957be9b6ea8b45f78e182a3e62653ca926aa1d9dae12db740263e8b1c88d22bc8be90aa8b2df392d67136e830da21
@@ -40,6 +40,7 @@ module Cloudflare::DNS::Update
40
40
 
41
41
  options do
42
42
  option '-c/--configuration <path>', "Use the specified configuration file."
43
+ option '-f/--force', "Force push updates to cloudflare even if content hasn't changed.", default: false
43
44
  option '--verbose | --quiet', "Verbosity of output for debugging.", key: :logging
44
45
  option '-h/--help', "Print out help information."
45
46
  option '-v/--version', "Print out the application version."
@@ -138,14 +139,13 @@ module Cloudflare::DNS::Update
138
139
  raise RuntimeError.new("Couldn't load zone #{configuration[:zone].inspect} from API!")
139
140
  end
140
141
 
141
- domains = configuration[:domains]
142
-
142
+ # Make sure there is no trailing space:
143
143
  content.chomp!
144
144
 
145
- configuration[:domains].each do |record|
146
- if record[:content] != content
147
- logger.info "Content changed #{content.inspect}, updating record..."
148
-
145
+ if content != configuration[:content] || @options[:force]
146
+ logger.info "Content changed #{content.inspect}, updating records..."
147
+
148
+ configuration[:domains].each do |record|
149
149
  domain = zone.dns_records.find_by_id(record[:id])
150
150
 
151
151
  changes = {
@@ -162,9 +162,12 @@ module Cloudflare::DNS::Update
162
162
  else
163
163
  logger.warn "Failed to update domain content to #{content}: #{response.errors.join(', ')}!"
164
164
  end
165
- else
166
- logger.debug "Content hasn't changed."
167
165
  end
166
+
167
+ # Save the last value of content:
168
+ configuration[:content] = content
169
+ else
170
+ logger.debug "Content hasn't changed."
168
171
  end
169
172
 
170
173
  return content
@@ -177,15 +180,13 @@ module Cloudflare::DNS::Update
177
180
  elsif @options[:help]
178
181
  print_usage(program_name)
179
182
  else
180
- track_time do
181
- connect!
182
-
183
- initialize_zone
184
- initialize_domains
185
- initialize_command
186
-
187
- update_domains
188
- end
183
+ connect!
184
+
185
+ initialize_zone
186
+ initialize_domains
187
+ initialize_command
188
+
189
+ update_domains
189
190
  end
190
191
  end
191
192
  end
@@ -22,7 +22,7 @@
22
22
  module Cloudflare
23
23
  module DNS
24
24
  module Update
25
- VERSION = "2.1.0"
25
+ VERSION = "2.1.1"
26
26
  end
27
27
  end
28
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudflare-dns-update
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams