linode_dynamic_dns 0.0.1 → 1.0.1

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: ce6e7ccd29726e4f6cc09cadb24cbe207ff0f959
4
- data.tar.gz: 8a5b6e45bee042889d24479e0f4482c8adcdcfe6
3
+ metadata.gz: 9628e215941a08794f4ed38da514754673c23f44
4
+ data.tar.gz: 60d470e9bcd6f568b7be6b658a1a4cd8a08e3d2e
5
5
  SHA512:
6
- metadata.gz: da7921589fd6db6cb6cdfbe9e6dad68110e5d0fd0a47fa06b9ca9ed08f6fac83cefd419b81326a9264fd2763daf6fcab49a3e112fc8f7d7c33639069410dfb58
7
- data.tar.gz: 3f57937a589bf9ff56b83c08457546ce93608140bfcf589c7a7cf6395cd0e7488a51db89ca09710bc3c4a03a914ff788a1208e971becdad53af9fa05fad61d31
6
+ metadata.gz: 680737e96a84eabcc723bc6834f3af6065f0a4cd4028cd4187e7838d78fd2b38862b1dcca224dc7754d971ee0128924778cabf5989d5f3d2fdca7a129cd3c912
7
+ data.tar.gz: aeab5c165416815d0038c94e527d7e427a8be4daa1e64fa74e88e65c8752a218c019af5ef615a760eb8d08254330257cf36ef3819e9a91b670d63ef604b9ab78
@@ -2,15 +2,30 @@
2
2
  #
3
3
  require 'linode'
4
4
  require 'linode_dynamic_dns'
5
+ require 'optparse'
6
+
7
+ @verbose = false
8
+
9
+ optparse = OptionParser.new do |opts|
10
+ opts.on('-v', '--verbose', "Print verbose output") do
11
+ @verbose = true
12
+ end
13
+ opts.on('-c', '--config CONFIG', "Specify a config file") do |arg|
14
+ @config = File.expand_path(arg)
15
+ end
16
+ end
17
+ optparse.parse!
18
+
19
+ LinodeDynamicDns.set_config(@config) if @config
5
20
 
6
21
  my_ip = LinodeDynamicDns.get_my_ip
7
- puts "My IP is #{my_ip}"
22
+ puts "My IP is #{my_ip}" if @verbose
8
23
  domain_id = LinodeDynamicDns.get_domain_id
9
- puts "My Domain ID is #{domain_id}"
24
+ puts "My Domain ID is #{domain_id}" if @verbose
10
25
  record_id = LinodeDynamicDns.get_record_id(domain_id)
11
- puts "My Record ID is #{record_id}"
26
+ puts "My Record ID is #{record_id}" if @verbose
12
27
  LinodeDynamicDns.update_record_ip(domain_id, record_id, my_ip)
13
- puts "Updated #{LinodeDynamicDns.config.record}.#{LinodeDynamicDns.config.domain} to #{my_ip}"
28
+ puts "Updated #{LinodeDynamicDns.config.record}.#{LinodeDynamicDns.config.domain} to #{my_ip}" if @verbose
14
29
 
15
30
 
16
31
 
@@ -3,13 +3,23 @@ require 'yaml'
3
3
 
4
4
  module LinodeDynamicDns
5
5
  def self.config
6
- @config ||= OpenStruct.new(
7
- YAML.load_file(
8
- File.join(
9
- File.dirname(__FILE__), '../..', 'config',
10
- 'linode_dynamic_dns.yaml'
11
- )
12
- )
13
- )
6
+ @config ||= load_config_from(
7
+ File.join(
8
+ File.dirname(__FILE__), '../..', 'config',
9
+ 'linode_dynamic_dns.yaml'
10
+ )
11
+ )
12
+ end
13
+
14
+ def self.load_config_from(path)
15
+ OpenStruct.new(
16
+ YAML.load_file(
17
+ path
18
+ )
19
+ )
20
+ end
21
+
22
+ def self.set_config(path)
23
+ @config = load_config_from(File.expand_path(path))
14
24
  end
15
25
  end
@@ -1,3 +1,3 @@
1
1
  module LinodeDynamicDns
2
- VERSION = "0.0.1"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linode_dynamic_dns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grier Johnson
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 2.2.2
98
+ rubygems_version: 2.0.14
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: A small script for updating a linode dns record based on your current IP