dnapi 1.1.85 → 1.1.86.pre

Sign up to get free protection for your applications and to get access to all the features.
data/lib/dnapi.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'forwardable'
2
2
  require 'extlib'
3
3
  require 'json'
4
+ require 'jexp'
4
5
 
5
6
  module DNApi
6
7
  def self.build(attributes = {})
@@ -32,7 +33,6 @@ module DNApi
32
33
  end
33
34
 
34
35
  require 'dnapi/component'
35
- require 'dnapi/extensions'
36
36
  require 'dnapi/struct'
37
37
  require 'dnapi/component_possessor'
38
38
  require 'dnapi/recipe'
@@ -97,11 +97,7 @@ module DNApi
97
97
  end
98
98
 
99
99
  def db_host
100
- if db_master
101
- db_master.public_hostname
102
- else
103
- solo.public_hostname
104
- end
100
+ host = (db_master || solo) and host.public_hostname
105
101
  end
106
102
 
107
103
  def solo?
@@ -141,7 +137,7 @@ module DNApi
141
137
  end
142
138
 
143
139
  def environment_hash
144
- {:name => name, :framework_env => framework_env, :stack => stack.name}
140
+ {:name => name, :framework_env => framework_env, :stack => (stack and stack.name)}
145
141
  end
146
142
 
147
143
  def haproxy_hash
@@ -220,7 +216,7 @@ module DNApi
220
216
  end
221
217
 
222
218
  def to_legacy_hash
223
- shared = %w( alert_email aws_secret_key aws_secret_id
219
+ shared = %w(alert_email aws_secret_key aws_secret_id
224
220
  backup_interval backup_window
225
221
  admin_ssh_key mailserver
226
222
  internal_ssh_public_key
data/lib/dnapi/struct.rb CHANGED
@@ -129,7 +129,10 @@ module DNApi
129
129
  def to_hash
130
130
  data = members.zip(values)
131
131
  association_data = _many.zip(_many_values) + _ones.zip(_ones_values)
132
- (data + association_data).inject({}) {|h,(k,v)| h.update(k => v) } #.reject {|k,v| v.nil? }
132
+ hash = (data + association_data).inject({}) do |h,(k,v)|
133
+ h.update(k => v)
134
+ end #.reject {|k,v| v.nil? }
135
+ hash
133
136
  end
134
137
 
135
138
  def ==(other)
data/lib/dnapi/test.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'dnapi'
2
2
 
3
- %w( randexp ey_slater ).each do |dep|
3
+ %w( randexp ).each do |dep|
4
4
  begin
5
5
  require dep
6
6
  rescue LoadError => e
data/lib/dnapi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DNApi
2
- VERSION = '1.1.85'
2
+ VERSION = '1.1.86.pre'
3
3
  end
data/spec/proxies_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
- require File.dirname(__FILE__) + '/proxies'
1
+ require File.expand_path('proxies', File.dirname(__FILE__))
2
2
  require 'pp'
3
3
  require 'sexp_processor' #defines Object#deep_copy
4
4
 
data/spec/stack_spec.rb CHANGED
@@ -75,6 +75,7 @@ describe DNApi::Stack do
75
75
  end
76
76
 
77
77
  context "responds to legacy helper methods" do
78
+ subject { DNApi::Stack.all.first }
78
79
  it { should respond_to(:apache?)}
79
80
  it { should respond_to(:nginx?)}
80
81
  it { should respond_to(:passenger?)}
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnapi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 185
5
- prerelease:
4
+ hash: 961916164
5
+ prerelease: 7
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 85
10
- version: 1.1.85
9
+ - 86
10
+ - pre
11
+ version: 1.1.86.pre
11
12
  platform: ruby
12
13
  authors:
13
14
  - Engine Yard
@@ -59,6 +60,22 @@ dependencies:
59
60
  version: "0"
60
61
  type: :runtime
61
62
  version_requirements: *id003
63
+ - !ruby/object:Gem::Dependency
64
+ name: jexp
65
+ prerelease: false
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 25
72
+ segments:
73
+ - 0
74
+ - 1
75
+ - 1
76
+ version: 0.1.1
77
+ type: :runtime
78
+ version_requirements: *id004
62
79
  description: API for chef DNA.
63
80
  email:
64
81
  - gems@engineyard.com
@@ -96,7 +113,6 @@ files:
96
113
  - lib/dnapi/db_stack.rb
97
114
  - lib/dnapi/ebuild_dep.rb
98
115
  - lib/dnapi/environment.rb
99
- - lib/dnapi/extensions.rb
100
116
  - lib/dnapi/gem_dep.rb
101
117
  - lib/dnapi/instance.rb
102
118
  - lib/dnapi/monitoring.rb
@@ -1,32 +0,0 @@
1
- class Array
2
- def to_jexp
3
- map {|v| JSON.jexp(v) }
4
- end
5
- end
6
-
7
- class Hash
8
- def to_jexp
9
- inject(self::class.new) do |h, (key, value)|
10
- h.update key.to_s => JSON.jexp(value)
11
- end
12
- end
13
- end
14
-
15
- class Integer
16
- def to_jexp() self end
17
- end
18
-
19
- module JSON
20
- def self.jexp(*a)
21
- if a.size == 1 && RUBY_VERSION >= "1.9.0"
22
- o = a.first
23
- o.respond_to?(:to_jexp) ? o.to_jexp : JSON.parse(JSON.dump([o])).first
24
- else
25
- return *a.map{|o| o.respond_to?(:to_jexp) ? o.to_jexp : JSON.parse(JSON.dump([o])).first}
26
- end
27
- end
28
- end
29
-
30
- class String
31
- def to_jexp() self end
32
- end