mystro-common 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,9 +2,17 @@ module Mystro
2
2
  class Account
3
3
  class << self
4
4
  #attr_reader :name
5
- attr_reader :list
5
+ #attr_reader :list
6
6
  attr_reader :selected
7
7
 
8
+ def [](name)
9
+ get(name)
10
+ end
11
+
12
+ def get(name)
13
+ @list[name]
14
+ end
15
+
8
16
  def read
9
17
  dir = Mystro.directory
10
18
  @list = { }
@@ -3,7 +3,7 @@ module Mystro
3
3
  module Version
4
4
  MAJOR = 0
5
5
  MINOR = 1
6
- TINY = 4
6
+ TINY = 5
7
7
  TAG = nil
8
8
  STRING = [MAJOR, MINOR, TINY, TAG].compact.join(".")
9
9
  end
@@ -9,12 +9,17 @@ module Mystro
9
9
  all.select {|e| [*e.value].flatten.include?(dns)}
10
10
  end
11
11
 
12
+ def find_by_name(name)
13
+ connection.zones.all.detect {|e| e.domain == name}
14
+ end
15
+
12
16
  # customize the connect function, because we are defaulting
13
17
  # to the zone from the configuration
14
18
  def connect
15
19
  @fog ||= begin
16
- raise "could not connect to DNS; #{opt.to_hash.inspect}; #{cfg.to_hash.inspect}" unless opt && cfg.zone
17
- zone(cfg.zone)
20
+ raise "must set zone" unless cfg.zone
21
+ raise "must set options" unless opt
22
+ find_by_name(cfg.zone)
18
23
  end
19
24
  rescue => e
20
25
  Mystro::Log.error "DNS connect failed: #{e.message} at #{e.backtrace.first}"
@@ -30,11 +35,12 @@ module Mystro
30
35
  end
31
36
 
32
37
  def zone(name)
33
- z = connection.zones.get(name)
34
- raise("zone #{name} not found") unless z
38
+ n = "#{name}."
39
+ z = connection.zones.get(n)
40
+ raise("zone #{n} not found") unless z
35
41
  z
36
42
  rescue => e
37
- raise("problem retrieving zone #{name}: #{e.message} at #{e.backtrace.first}")
43
+ raise("#{e.message} at #{e.backtrace.first}")
38
44
  end
39
45
 
40
46
  def create_zone(model)
@@ -42,4 +48,4 @@ module Mystro
42
48
  end
43
49
  end
44
50
  end
45
- end
51
+ end
data/lib/mystro/plugin.rb CHANGED
@@ -57,13 +57,13 @@ module Mystro
57
57
 
58
58
  def jobs
59
59
  @jobs ||= begin
60
- jobs = []
60
+ jobs = {}
61
61
  (@plugins||{}).each do |key, opts|
62
62
  if opts[:jobs]
63
- jobs << opts[:jobs]
63
+ jobs[key] = opts[:jobs]
64
64
  end
65
65
  end
66
- jobs.flatten
66
+ jobs
67
67
  end
68
68
  end
69
69
 
data/lib/mystro-common.rb CHANGED
@@ -16,7 +16,7 @@ module Mystro
16
16
  end
17
17
 
18
18
  def current_account
19
- Mystro::Account.list[selected]
19
+ Mystro::Account.get(selected)
20
20
  end
21
21
 
22
22
  def directory
@@ -17,10 +17,10 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency "fog", "~> 1.12.1" # talk to cloud
21
- gem.add_dependency "yell", "~> 1.2.0" # logging
22
- gem.add_dependency "hashie" # better data objects
23
- gem.add_dependency "activesupport", "3.2.8" # active support
24
- gem.add_dependency "ipaddress" # ip address library
25
- gem.add_dependency "erubis" # userdata templates
20
+ gem.add_dependency "fog", "~> 1.12.1" # talk to cloud
21
+ gem.add_dependency "yell", "~> 1.2.0" # logging
22
+ gem.add_dependency "hashie" # better data objects
23
+ gem.add_dependency "activesupport", "3.2.14" # active support
24
+ gem.add_dependency "ipaddress" # ip address library
25
+ gem.add_dependency "erubis" # userdata templates
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mystro-common
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-31 00:00:00.000000000 Z
12
+ date: 2013-08-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 3.2.8
69
+ version: 3.2.14
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - '='
76
76
  - !ruby/object:Gem::Version
77
- version: 3.2.8
77
+ version: 3.2.14
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: ipaddress
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -151,18 +151,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
151
  - - ! '>='
152
152
  - !ruby/object:Gem::Version
153
153
  version: '0'
154
- segments:
155
- - 0
156
- hash: -618115457408293498
157
154
  required_rubygems_version: !ruby/object:Gem::Requirement
158
155
  none: false
159
156
  requirements:
160
157
  - - ! '>='
161
158
  - !ruby/object:Gem::Version
162
159
  version: '0'
163
- segments:
164
- - 0
165
- hash: -618115457408293498
166
160
  requirements: []
167
161
  rubyforge_project:
168
162
  rubygems_version: 1.8.25