dnapi 1.1.74.jruby192.c

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/lib/dnapi.rb +54 -0
  2. data/lib/dnapi/app.rb +130 -0
  3. data/lib/dnapi/component.rb +50 -0
  4. data/lib/dnapi/component_possessor.rb +49 -0
  5. data/lib/dnapi/components/addons.rb +26 -0
  6. data/lib/dnapi/components/apache.rb +13 -0
  7. data/lib/dnapi/components/cloudkick.rb +13 -0
  8. data/lib/dnapi/components/encrypted_backup.rb +12 -0
  9. data/lib/dnapi/components/exim.rb +10 -0
  10. data/lib/dnapi/components/monitor.rb +12 -0
  11. data/lib/dnapi/components/nagios.rb +28 -0
  12. data/lib/dnapi/components/newrelic.rb +12 -0
  13. data/lib/dnapi/components/passenger3.rb +13 -0
  14. data/lib/dnapi/components/ruby.rb +234 -0
  15. data/lib/dnapi/components/ssmtp.rb +10 -0
  16. data/lib/dnapi/components/stunneled.rb +13 -0
  17. data/lib/dnapi/components/volume.rb +32 -0
  18. data/lib/dnapi/cron.rb +5 -0
  19. data/lib/dnapi/db_stack.rb +92 -0
  20. data/lib/dnapi/ebuild_dep.rb +5 -0
  21. data/lib/dnapi/environment.rb +327 -0
  22. data/lib/dnapi/extensions.rb +32 -0
  23. data/lib/dnapi/gem_dep.rb +9 -0
  24. data/lib/dnapi/instance.rb +69 -0
  25. data/lib/dnapi/monitoring.rb +22 -0
  26. data/lib/dnapi/recipe.rb +27 -0
  27. data/lib/dnapi/ssl_cert.rb +13 -0
  28. data/lib/dnapi/stack.rb +111 -0
  29. data/lib/dnapi/struct.rb +149 -0
  30. data/lib/dnapi/test.rb +114 -0
  31. data/lib/dnapi/test/ext.rb +32 -0
  32. data/lib/dnapi/test/sweatshop.rb +148 -0
  33. data/lib/dnapi/version.rb +3 -0
  34. data/lib/dnapi/vhost.rb +24 -0
  35. data/spec/app_spec.rb +68 -0
  36. data/spec/component_spec.rb +66 -0
  37. data/spec/components/addons_spec.rb +33 -0
  38. data/spec/components/cloudkick_spec.rb +17 -0
  39. data/spec/components/nagios_spec.rb +42 -0
  40. data/spec/components/nodejs_spec.rb +27 -0
  41. data/spec/components/passenger3_spec.rb +12 -0
  42. data/spec/components/ruby_spec.rb +321 -0
  43. data/spec/components/stunneled.rb +15 -0
  44. data/spec/components/volume_spec.rb +21 -0
  45. data/spec/db_stack_spec.rb +111 -0
  46. data/spec/environment_spec.rb +227 -0
  47. data/spec/instance_spec.rb +52 -0
  48. data/spec/proxies.rb +143 -0
  49. data/spec/proxies_spec.rb +76 -0
  50. data/spec/spec_helper.rb +2 -0
  51. data/spec/stack_spec.rb +105 -0
  52. data/spec/struct_spec.rb +100 -0
  53. metadata +181 -0
@@ -0,0 +1,2 @@
1
+ $:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
2
+ require 'dnapi/test'
@@ -0,0 +1,105 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe DNApi::Stack do
4
+ describe "Nginxtcp" do
5
+ it 'has node & nginxtcp for recipes' do
6
+ DNApi::Stack::Nginxtcp.recipes.should == [DNApi::Recipe::Nginxtcp, DNApi::Recipe::Node]
7
+ end
8
+ end
9
+
10
+ describe "NginxMongrel" do
11
+ it 'has nginx & mongrel for recipes' do
12
+ DNApi::Stack::NginxMongrel.recipes.should == [DNApi::Recipe::Nginx, DNApi::Recipe::Mongrel]
13
+ end
14
+
15
+ it "does not support Ruby 1.9.2" do
16
+ DNApi::Stack::NginxMongrel.ruby_versions.should_not include(DNApi::Components::Ruby192)
17
+ end
18
+
19
+ it "does not support JRuby" do
20
+ DNApi::Stack::NginxMongrel.ruby_versions.should_not include(DNApi::Components::JRuby187)
21
+ DNApi::Stack::NginxMongrel.ruby_versions.should_not include(DNApi::Components::JRuby192)
22
+ end
23
+
24
+ it "does not support Rubinius" do
25
+ DNApi::Stack::NginxMongrel.ruby_versions.should_not include(DNApi::Components::Rubinius)
26
+ end
27
+ end
28
+
29
+ describe "Trinidad" do
30
+ it 'only supports JRuby' do
31
+ DNApi::Stack::Trinidad.ruby_versions.should == [DNApi::Components::JRuby187, DNApi::Components::JRuby192]
32
+ end
33
+
34
+ it "has Nginx & Trinidad as recipes" do
35
+ DNApi::Stack::Trinidad.recipes.should == [DNApi::Recipe::Nginx, DNApi::Recipe::Trinidad]
36
+ end
37
+ end
38
+
39
+ describe "NginxPassenger" do
40
+ it 'has nginx & nginx-passenger for recipes' do
41
+ DNApi::Stack::NginxPassenger.recipes.should == [DNApi::Recipe::Nginx, DNApi::Recipe::NginxPassenger]
42
+ end
43
+
44
+ it 'does not support JRuby' do
45
+ DNApi::Stack::NginxMongrel.ruby_versions.should_not include(DNApi::Components::JRuby187)
46
+ DNApi::Stack::NginxMongrel.ruby_versions.should_not include(DNApi::Components::JRuby192)
47
+ end
48
+ end
49
+
50
+ describe "NginxPassenger3" do
51
+ it "is the ONLY stack that supports Rubinius" do
52
+ DNApi::Stack.all.select {|stack| stack.ruby_versions.include?(DNApi::Components::Rubinius) }.should == [DNApi::Stack::NginxPassenger3]
53
+ end
54
+
55
+ it 'does not support Ruby 1.8.6' do
56
+ DNApi::Stack::NginxPassenger3.ruby_versions.should_not include(DNApi::Components::Ruby186)
57
+ end
58
+
59
+ it 'has nginx & nginx-passenger for recipes' do
60
+ DNApi::Stack::NginxPassenger.recipes.should == [DNApi::Recipe::Nginx, DNApi::Recipe::NginxPassenger]
61
+ end
62
+ end
63
+
64
+ describe "ApachePassenger" do
65
+ it 'has only ApachePassenger for recipes' do
66
+ DNApi::Stack::ApachePassenger.recipes.should == [DNApi::Recipe::Passenger, DNApi::Recipe::ApachePassenger]
67
+ end
68
+ end
69
+
70
+ describe "NginxUnicorn" do
71
+ it 'has nginx & nginx-passenger for recipes' do
72
+ DNApi::Stack::NginxUnicorn.recipes.should == [DNApi::Recipe::Nginx, DNApi::Recipe::Unicorn]
73
+ end
74
+
75
+ it 'does not support JRuby' do
76
+ DNApi::Stack::NginxMongrel.ruby_versions.should_not include(DNApi::Components::JRuby187)
77
+ DNApi::Stack::NginxMongrel.ruby_versions.should_not include(DNApi::Components::JRuby192)
78
+ end
79
+
80
+ it "does not support Rubinius" do
81
+ DNApi::Stack::NginxUnicorn.ruby_versions.should_not include(DNApi::Components::Rubinius)
82
+ end
83
+ end
84
+
85
+ context "responds to legacy helper methods" do
86
+ it { should respond_to(:apache?)}
87
+ it { should respond_to(:nginx?)}
88
+ it { should respond_to(:passenger?)}
89
+ it { should respond_to(:unicorn?)}
90
+ it { should respond_to(:mongrel?)}
91
+ it { should respond_to(:trinidad?)}
92
+ it { should respond_to(:thin?)}
93
+
94
+ it do
95
+ DNApi::Stack::NginxMongrel.should be_mongrel
96
+ DNApi::Stack::NginxMongrel.should be_nginx
97
+ DNApi::Stack::NginxPassenger.should be_passenger
98
+ DNApi::Stack::NginxPassenger3.should be_passenger
99
+ DNApi::Stack::ApachePassenger.should be_apache
100
+ DNApi::Stack::NginxUnicorn.should be_unicorn
101
+ DNApi::Stack::Trinidad.should be_trinidad
102
+ DNApi::Stack::NginxThin.should be_thin
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,100 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe DNApi::Struct do
4
+ describe "#initialize" do
5
+ it 'correctly maps attributes to members' do
6
+ klass = DNApi::Struct.new(:foo, :bar, :baz)
7
+
8
+ instance = klass.new(:bar => :x, :baz => :y, :foo => :z)
9
+ instance.foo.should == :z
10
+ instance.bar.should == :x
11
+ instance.baz.should == :y
12
+ end
13
+
14
+ it 'sets the value for any parameters' do
15
+ klass = Class.new(DNApi::Struct.new(:baz)) do
16
+ attr_accessor :foo
17
+ end
18
+
19
+ klass.new.baz.should be_nil
20
+ klass.new(:foo => 'bar').foo.should eql('bar')
21
+ end
22
+
23
+ it 'expects a hash argument' do
24
+ lambda { Class.new(DNApi::Struct.new(:foo)).new("blam!") }.should raise_error(ArgumentError)
25
+ end
26
+ end
27
+
28
+ describe ".many" do
29
+ before(:each) do
30
+ @klass_in_context = Class.new(DNApi::Struct.new(:foo, :bar)) do
31
+ many :apples
32
+ end
33
+ end
34
+
35
+ it 'adds an attr_accessor for the association' do
36
+ instance = @klass_in_context.new
37
+ instance.apples.should be_empty
38
+ end
39
+
40
+ it 'accepts an empty array as a create parameter' do
41
+ instance = @klass_in_context.new(:apples => [])
42
+ instance.apples.should be_empty
43
+ end
44
+
45
+ it 'accepts input to the association as a create parameter' do
46
+ instance = @klass_in_context.new(:apples => [:a, :b, :c])
47
+ instance.apples.should eql([:a, :b, :c])
48
+ end
49
+ end
50
+
51
+ describe ".unserialized_member" do
52
+ it 'adds an attr_accessor for member' do
53
+ @klass = DNApi::Struct.new(:foo, :bar) do
54
+ unserialized_member :baz
55
+ end
56
+
57
+ instance = @klass.new
58
+ instance.baz = 123
59
+ end
60
+ end
61
+
62
+ describe "#to_hash" do
63
+ it 'rejects any nil members' do
64
+ #DNApi::Struct.new(:a, :b).new(:a => nil, :b => :c).to_hash.should == {'b' => :c}
65
+ end
66
+ end
67
+
68
+ describe "#to_jexp" do
69
+ it 'is a hash with valid JSON types' do
70
+ DNApi::Struct.new(:alpha).new(:alpha => :beta).to_jexp.should == {'alpha' => 'beta'}
71
+ end
72
+ end
73
+
74
+ describe "#==" do
75
+ it 'includes unserialized members in the comparison' do
76
+ klass = DNApi::Struct.new(:alpha) do
77
+ unserialized_member :beta
78
+ end
79
+
80
+ base_case = klass.new(:alpha => 1, :beta => 2)
81
+ equal_case = klass.new(:alpha => 1, :beta => 2)
82
+ unequal_case = klass.new(:alpha => 1, :beta => 3)
83
+
84
+ equal_case.should == base_case
85
+ unequal_case.should_not == base_case
86
+ end
87
+ end
88
+
89
+ describe "#inspect" do
90
+ it 'includes unserialized members' do
91
+ klass = DNApi::Struct.new(:alpha) do
92
+ unserialized_member :beta
93
+ end
94
+
95
+ instance = klass.new(:alpha => :si, :beta => :omega)
96
+
97
+ instance.inspect.should include("beta=:omega")
98
+ end
99
+ end
100
+ end
metadata ADDED
@@ -0,0 +1,181 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dnapi
3
+ version: !ruby/object:Gem::Version
4
+ hash: 1239077196
5
+ prerelease: 7
6
+ segments:
7
+ - 1
8
+ - 1
9
+ - 74
10
+ - jruby
11
+ - 192
12
+ - c
13
+ version: 1.1.74.jruby192.c
14
+ platform: ruby
15
+ authors:
16
+ - Engine Yard
17
+ autorequire:
18
+ bindir: bin
19
+ cert_chain: []
20
+
21
+ date: 2011-07-26 00:00:00 Z
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: json
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ version: "0"
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: extlib
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ hash: 3
46
+ segments:
47
+ - 0
48
+ version: "0"
49
+ type: :runtime
50
+ version_requirements: *id002
51
+ - !ruby/object:Gem::Dependency
52
+ name: sexp_processor
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ hash: 3
60
+ segments:
61
+ - 0
62
+ version: "0"
63
+ type: :runtime
64
+ version_requirements: *id003
65
+ description: API for chef DNA.
66
+ email:
67
+ - gems@engineyard.com
68
+ executables: []
69
+
70
+ extensions: []
71
+
72
+ extra_rdoc_files: []
73
+
74
+ files:
75
+ - lib/dnapi/app.rb
76
+ - lib/dnapi/component.rb
77
+ - lib/dnapi/component_possessor.rb
78
+ - lib/dnapi/components/addons.rb
79
+ - lib/dnapi/components/apache.rb
80
+ - lib/dnapi/components/cloudkick.rb
81
+ - lib/dnapi/components/encrypted_backup.rb
82
+ - lib/dnapi/components/exim.rb
83
+ - lib/dnapi/components/monitor.rb
84
+ - lib/dnapi/components/nagios.rb
85
+ - lib/dnapi/components/newrelic.rb
86
+ - lib/dnapi/components/passenger3.rb
87
+ - lib/dnapi/components/ruby.rb
88
+ - lib/dnapi/components/ssmtp.rb
89
+ - lib/dnapi/components/stunneled.rb
90
+ - lib/dnapi/components/volume.rb
91
+ - lib/dnapi/cron.rb
92
+ - lib/dnapi/db_stack.rb
93
+ - lib/dnapi/ebuild_dep.rb
94
+ - lib/dnapi/environment.rb
95
+ - lib/dnapi/extensions.rb
96
+ - lib/dnapi/gem_dep.rb
97
+ - lib/dnapi/instance.rb
98
+ - lib/dnapi/monitoring.rb
99
+ - lib/dnapi/recipe.rb
100
+ - lib/dnapi/ssl_cert.rb
101
+ - lib/dnapi/stack.rb
102
+ - lib/dnapi/struct.rb
103
+ - lib/dnapi/test/ext.rb
104
+ - lib/dnapi/test/sweatshop.rb
105
+ - lib/dnapi/test.rb
106
+ - lib/dnapi/version.rb
107
+ - lib/dnapi/vhost.rb
108
+ - lib/dnapi.rb
109
+ - spec/app_spec.rb
110
+ - spec/component_spec.rb
111
+ - spec/components/addons_spec.rb
112
+ - spec/components/cloudkick_spec.rb
113
+ - spec/components/nagios_spec.rb
114
+ - spec/components/nodejs_spec.rb
115
+ - spec/components/passenger3_spec.rb
116
+ - spec/components/ruby_spec.rb
117
+ - spec/components/stunneled.rb
118
+ - spec/components/volume_spec.rb
119
+ - spec/db_stack_spec.rb
120
+ - spec/environment_spec.rb
121
+ - spec/instance_spec.rb
122
+ - spec/proxies.rb
123
+ - spec/proxies_spec.rb
124
+ - spec/spec_helper.rb
125
+ - spec/stack_spec.rb
126
+ - spec/struct_spec.rb
127
+ homepage: http://github.com/engineyard/dnapi
128
+ licenses: []
129
+
130
+ post_install_message:
131
+ rdoc_options: []
132
+
133
+ require_paths:
134
+ - lib
135
+ required_ruby_version: !ruby/object:Gem::Requirement
136
+ none: false
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ hash: 3
141
+ segments:
142
+ - 0
143
+ version: "0"
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ">"
148
+ - !ruby/object:Gem::Version
149
+ hash: 25
150
+ segments:
151
+ - 1
152
+ - 3
153
+ - 1
154
+ version: 1.3.1
155
+ requirements: []
156
+
157
+ rubyforge_project:
158
+ rubygems_version: 1.8.6
159
+ signing_key:
160
+ specification_version: 3
161
+ summary: API for chef DNA.
162
+ test_files:
163
+ - spec/app_spec.rb
164
+ - spec/component_spec.rb
165
+ - spec/components/addons_spec.rb
166
+ - spec/components/cloudkick_spec.rb
167
+ - spec/components/nagios_spec.rb
168
+ - spec/components/nodejs_spec.rb
169
+ - spec/components/passenger3_spec.rb
170
+ - spec/components/ruby_spec.rb
171
+ - spec/components/stunneled.rb
172
+ - spec/components/volume_spec.rb
173
+ - spec/db_stack_spec.rb
174
+ - spec/environment_spec.rb
175
+ - spec/instance_spec.rb
176
+ - spec/proxies.rb
177
+ - spec/proxies_spec.rb
178
+ - spec/spec_helper.rb
179
+ - spec/stack_spec.rb
180
+ - spec/struct_spec.rb
181
+ has_rdoc: