broham 0.0.7 → 0.0.8

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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/broham.gemspec +3 -3
  3. data/lib/broham.rb +15 -12
  4. metadata +26 -13
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{broham}
8
- s.version = "0.0.7"
8
+ s.version = "0.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Philip (flip) Kromer"]
12
- s.date = %q{2010-04-08}
12
+ s.date = %q{2010-04-09}
13
13
  s.description = %q{Bro! Broham always knows where his bros are, bro. Using broham, a newly-created cloud machine can annouce its availability for a certain role ("nfs_server" or "db_slave-2"), allowing any other interested nodes to discover its public_ip, private_ip, etc. See also: http://j.mp/amongbros}
14
14
  s.email = %q{flip@infochimps.org}
15
15
  s.executables = ["broham", "broham-diss", "broham-fuck_all_yall", "broham-host", "broham-register", "broham-register_as_next", "broham-sup", "broham-unregister", "broham-unregister-like", "broham-yo"]
@@ -44,7 +44,7 @@ Gem::Specification.new do |s|
44
44
  s.homepage = %q{http://github.com/mrflip/broham}
45
45
  s.rdoc_options = ["--charset=UTF-8"]
46
46
  s.require_paths = ["lib"]
47
- s.rubygems_version = %q{1.3.5}
47
+ s.rubygems_version = %q{1.3.6}
48
48
  s.summary = %q{Broham: A simple, global, highly-available, none-too-bright service registry. Broham always knows where his bros are, bro.}
49
49
  s.test_files = [
50
50
  "spec/broham_spec.rb",
@@ -6,11 +6,13 @@ require 'sdb/active_sdb'
6
6
  require 'ohai'
7
7
  OHAI_INFO = Ohai::System.new unless defined?(OHAI_INFO)
8
8
  OHAI_INFO.all_plugins
9
- # Settings from Configliere
10
- require 'configliere'; Configliere.use :define
9
+ # Settings from Configliere.
10
+ require 'configliere'
11
11
  Settings.define :access_key, :required => true, :description => "Amazon AWS access key ID -- found in your AWS console (http://bit.ly/awsconsole)"
12
12
  Settings.define :secret_access_key, :required => true, :description => "Amazon AWS secret access key -- found in your AWS console (http://bit.ly/awsconsole)"
13
13
 
14
+ ::Log = Logger.new(STDERR) unless defined?(Log)
15
+
14
16
  #
15
17
  # Make sure you are using a recent (>= 1.11,0) version of right_aws, and set the
16
18
  # SDB_API_VERSION environment variable to '2009-04-15':
@@ -121,17 +123,20 @@ class Broham < RightAws::ActiveSdb::Base
121
123
  def self.my_availability_zone() OHAI_INFO[:ec2][:availability_zone] ; end
122
124
  def self.timestamp() Time.now.utc.strftime("%Y%m%d%H%M%S") ; end
123
125
 
124
- def private_ip() self['private_ip' ] || default_ip ; end
125
- def public_ip() self['public_ip' ] || default_ip ; end
126
- def default_ip() self['default_ip' ] ; end
127
- def fqdn() self['fqdn' ] ; end
128
- def availability_zone() self['availability_zone'] ; end
126
+ def private_ip() self['private_ip' ].first || default_ip ; end
127
+ def public_ip() self['public_ip' ].first || default_ip ; end
128
+ def default_ip() self['default_ip' ].first ; end
129
+ def fqdn() self['fqdn' ].first ; end
130
+ def availability_zone() self['availability_zone'].first ; end
129
131
  def idx()
130
- self['idx']
132
+ self['idx'].first
131
133
  end
132
134
 
133
- def self.establish_connection
134
- @connection ||= RightAws::ActiveSdb.establish_connection(Settings[:access_key], Settings[:secret_access_key])
135
+ def self.establish_connection options={}
136
+ options = { :logger => Log }.merge options
137
+ access_key = options[:access_key] || Settings[:access_key]
138
+ secret_access_key = options[:access_key] || Settings[:secret_access_key]
139
+ @connection ||= RightAws::ActiveSdb.establish_connection(access_key, secret_access_key, options)
135
140
  end
136
141
 
137
142
  # Register an nfs server share
@@ -159,5 +164,3 @@ class Broham < RightAws::ActiveSdb::Base
159
164
  end
160
165
 
161
166
  end
162
-
163
- Broham.establish_connection
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: broham
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 8
9
+ version: 0.0.8
5
10
  platform: ruby
6
11
  authors:
7
12
  - Philip (flip) Kromer
@@ -9,29 +14,35 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-04-08 00:00:00 -05:00
17
+ date: 2010-04-09 00:00:00 -05:00
13
18
  default_executable:
14
19
  dependencies:
15
20
  - !ruby/object:Gem::Dependency
16
21
  name: rspec
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
20
24
  requirements:
21
25
  - - ">="
22
26
  - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 2
30
+ - 9
23
31
  version: 1.2.9
24
- version:
32
+ type: :development
33
+ version_requirements: *id001
25
34
  - !ruby/object:Gem::Dependency
26
35
  name: yard
27
- type: :development
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
30
38
  requirements:
31
39
  - - ">="
32
40
  - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
33
43
  version: "0"
34
- version:
44
+ type: :development
45
+ version_requirements: *id002
35
46
  description: "Bro! Broham always knows where his bros are, bro. Using broham, a newly-created cloud machine can annouce its availability for a certain role (\"nfs_server\" or \"db_slave-2\"), allowing any other interested nodes to discover its public_ip, private_ip, etc. See also: http://j.mp/amongbros"
36
47
  email: flip@infochimps.org
37
48
  executables:
@@ -86,18 +97,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
97
  requirements:
87
98
  - - ">="
88
99
  - !ruby/object:Gem::Version
100
+ segments:
101
+ - 0
89
102
  version: "0"
90
- version:
91
103
  required_rubygems_version: !ruby/object:Gem::Requirement
92
104
  requirements:
93
105
  - - ">="
94
106
  - !ruby/object:Gem::Version
107
+ segments:
108
+ - 0
95
109
  version: "0"
96
- version:
97
110
  requirements: []
98
111
 
99
112
  rubyforge_project:
100
- rubygems_version: 1.3.5
113
+ rubygems_version: 1.3.6
101
114
  signing_key:
102
115
  specification_version: 3
103
116
  summary: "Broham: A simple, global, highly-available, none-too-bright service registry. Broham always knows where his bros are, bro."