cloudflare-dns-update 0.0.3 → 0.1.0
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 +4 -4
- data/README.md +2 -0
- data/bin/cloudflare-dns-update +33 -33
- data/cloudflare-dns-update.gemspec +1 -1
- data/lib/cloudflare/dns/update.rb +1 -1
- data/lib/cloudflare/dns/update/version.rb +2 -2
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0914036e0da33020c961cfc4d386c80a23f834ec
|
4
|
+
data.tar.gz: 44565d1e878351c742ca76f76980bb0cb17a4300
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1c7c8a67573e407d9d9080db16482dec37fe0fe47b227a52a225c335bb155bc0ecbbb1974a21f7e4d590352506c184f9b825ef3cce6a66d57b25e2be2d2d99e
|
7
|
+
data.tar.gz: 72a3cf7bd5fb7ab7f3445e77cfc0d95e442224ffc206ee12818a630968c30b52270b380e1db997b51aaf14ffbdea19d96574d5d215c63b2c455bce93c56afaa6
|
data/README.md
CHANGED
@@ -20,6 +20,8 @@ Simply set up configurations for each domain you wish to update, and add to `/et
|
|
20
20
|
|
21
21
|
cloudflare-dns-update --configuration /srv/dyndns/hinoki.oriontransfer.co.nz.yml
|
22
22
|
|
23
|
+
Note that in case you want to update more than one domains in a zone with the same IP address, you can have multiple domains in a configuration file. Follow instructions of the configuration process.
|
24
|
+
|
23
25
|
## Contributing
|
24
26
|
|
25
27
|
1. Fork it
|
data/bin/cloudflare-dns-update
CHANGED
@@ -65,7 +65,7 @@ end
|
|
65
65
|
cloudflare = nil
|
66
66
|
|
67
67
|
configuration_store.transaction do |configuration|
|
68
|
-
cloudflare = CloudFlare.
|
68
|
+
cloudflare = CloudFlare.connection(configuration[:key], configuration[:email])
|
69
69
|
end
|
70
70
|
|
71
71
|
configuration_store.transaction do |configuration|
|
@@ -76,22 +76,22 @@ configuration_store.transaction do |configuration|
|
|
76
76
|
end
|
77
77
|
|
78
78
|
configuration_store.transaction do |configuration|
|
79
|
-
unless configuration[:
|
79
|
+
unless configuration[:domains]
|
80
80
|
puts "Getting list of domains for #{configuration[:zone]}..."
|
81
|
-
|
81
|
+
|
82
82
|
result = cloudflare.rec_load_all(configuration[:zone])
|
83
83
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
84
|
+
records = result['response']['recs']['objs']
|
85
|
+
|
86
|
+
records.each.with_index do |record, index|
|
87
|
+
puts "(#{index}) #{record['name']} #{record['type']} #{record['content']}"
|
88
|
+
end
|
89
|
+
|
90
|
+
input = get_input "Which record to update?\nYou can select more than one record by separating numbers with comma (e.g. 0,2,5):"
|
91
|
+
indexes = input.split(',').map(&:strip)
|
92
|
+
|
93
|
+
configuration[:domains] = indexes.inject([]) do |a, index|
|
94
|
+
a << records[index.to_i]
|
95
95
|
end
|
96
96
|
end
|
97
97
|
end
|
@@ -105,29 +105,29 @@ end
|
|
105
105
|
|
106
106
|
configuration_store.transaction do |configuration|
|
107
107
|
content = run(configuration[:content_command])
|
108
|
-
|
108
|
+
domains = configuration[:domains] || [configuration[:domain]]
|
109
109
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
110
|
+
domains.each do |domain|
|
111
|
+
if domain['content'] != content
|
112
|
+
puts "Content changed #{content.dump}, updating record..."
|
113
|
+
# zone, type, zoneid, name, content, ttl, service_mode = nil, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil
|
114
|
+
|
115
|
+
arguments = [
|
116
|
+
configuration[:zone],
|
117
|
+
domain['type'],
|
118
|
+
domain['rec_id'],
|
119
|
+
domain['name'],
|
120
|
+
content,
|
121
|
+
domain['ttl']
|
122
|
+
]
|
123
|
+
|
124
|
+
result = cloudflare.rec_edit(*arguments)
|
125
|
+
|
126
126
|
puts "Updating domain content: #{content}"
|
127
127
|
domain['content'] = content
|
128
128
|
configuration[:domain] = domain
|
129
|
+
else
|
130
|
+
puts "Content hasn't changed."
|
129
131
|
end
|
130
|
-
else
|
131
|
-
puts "Content hasn't changed."
|
132
132
|
end
|
133
133
|
end
|
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudflare-dns-update
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: trollop
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 2.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 2.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: cloudflare
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.0.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.0.0
|
69
69
|
description: "\tProvides a client tool for updating CloudFlare records, with a specific\n\temphasis
|
70
70
|
on updating IP addresses for domain records. This provides\n\tdyndns-like functionality.\n"
|
71
71
|
email:
|
@@ -75,7 +75,7 @@ executables:
|
|
75
75
|
extensions: []
|
76
76
|
extra_rdoc_files: []
|
77
77
|
files:
|
78
|
-
- .gitignore
|
78
|
+
- ".gitignore"
|
79
79
|
- Gemfile
|
80
80
|
- README.md
|
81
81
|
- Rakefile
|
@@ -93,17 +93,17 @@ require_paths:
|
|
93
93
|
- lib
|
94
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
|
-
- -
|
96
|
+
- - ">="
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
105
|
rubyforge_project:
|
106
|
-
rubygems_version: 2.
|
106
|
+
rubygems_version: 2.2.2
|
107
107
|
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: A dyndns client for CloudFlare.
|