ridley 0.7.0.beta → 0.7.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +51 -54
- data/lib/ridley.rb +7 -13
- data/lib/ridley/client.rb +251 -0
- data/lib/ridley/connection.rb +32 -188
- data/lib/ridley/middleware/chef_auth.rb +4 -1
- data/lib/ridley/resource.rb +36 -42
- data/lib/ridley/resources.rb +3 -0
- data/lib/ridley/resources/{client.rb → client_resource.rb} +7 -20
- data/lib/ridley/resources/cookbook_resource.rb +121 -0
- data/lib/ridley/resources/{data_bag_item.rb → data_bag_item_resource.rb} +52 -63
- data/lib/ridley/resources/data_bag_resource.rb +74 -0
- data/lib/ridley/resources/encrypted_data_bag_item_resource.rb +55 -0
- data/lib/ridley/resources/{environment.rb → environment_resource.rb} +8 -21
- data/lib/ridley/resources/{node.rb → node_resource.rb} +24 -37
- data/lib/ridley/resources/{role.rb → role_resource.rb} +1 -14
- data/lib/ridley/resources/sandbox_resource.rb +86 -0
- data/lib/ridley/resources/search.rb +24 -55
- data/lib/ridley/sandbox_uploader.rb +118 -0
- data/lib/ridley/ssh.rb +2 -2
- data/lib/ridley/ssh/worker.rb +2 -1
- data/lib/ridley/version.rb +1 -1
- data/ridley.gemspec +1 -1
- data/spec/acceptance/bootstrapping_spec.rb +1 -1
- data/spec/acceptance/client_resource_spec.rb +18 -20
- data/spec/acceptance/cookbook_resource_spec.rb +4 -22
- data/spec/acceptance/data_bag_item_resource_spec.rb +5 -7
- data/spec/acceptance/data_bag_resource_spec.rb +4 -6
- data/spec/acceptance/environment_resource_spec.rb +14 -16
- data/spec/acceptance/node_resource_spec.rb +12 -14
- data/spec/acceptance/role_resource_spec.rb +13 -15
- data/spec/acceptance/sandbox_resource_spec.rb +7 -9
- data/spec/acceptance/search_resource_spec.rb +6 -8
- data/spec/support/shared_examples/ridley_resource.rb +23 -22
- data/spec/unit/ridley/client_spec.rb +153 -0
- data/spec/unit/ridley/connection_spec.rb +8 -221
- data/spec/unit/ridley/resources/{client_spec.rb → client_resource_spec.rb} +4 -4
- data/spec/unit/ridley/resources/cookbook_resource_spec.rb +5 -0
- data/spec/unit/ridley/resources/{data_bag_item_spec.rb → data_bag_item_resource_spec.rb} +2 -2
- data/spec/unit/ridley/resources/{data_bag_spec.rb → data_bag_resource_spec.rb} +3 -3
- data/spec/unit/ridley/resources/{environment_spec.rb → environment_resource_spec.rb} +4 -4
- data/spec/unit/ridley/resources/{node_spec.rb → node_resource_spec.rb} +4 -4
- data/spec/unit/ridley/resources/{role_spec.rb → role_resource_spec.rb} +3 -3
- data/spec/unit/ridley/resources/sandbox_resource_spec.rb +172 -0
- data/spec/unit/ridley/resources/search_spec.rb +34 -30
- data/spec/unit/ridley/sandbox_uploader_spec.rb +99 -0
- data/spec/unit/ridley/ssh_spec.rb +2 -2
- data/spec/unit/ridley_spec.rb +4 -12
- metadata +36 -28
- data/lib/ridley/dsl.rb +0 -58
- data/lib/ridley/resources/cookbook.rb +0 -51
- data/lib/ridley/resources/data_bag.rb +0 -81
- data/lib/ridley/resources/encrypted_data_bag_item.rb +0 -54
- data/lib/ridley/resources/sandbox.rb +0 -154
- data/spec/unit/ridley/resources/cookbook_spec.rb +0 -5
@@ -1,7 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Ridley::Search do
|
4
|
-
let(:
|
3
|
+
describe Ridley::Search do\
|
4
|
+
let(:client) do
|
5
|
+
double('client',
|
6
|
+
connection: double('connection')
|
7
|
+
)
|
8
|
+
end
|
5
9
|
let(:index) { :role }
|
6
10
|
let(:query) { "*:*" }
|
7
11
|
let(:response) do
|
@@ -19,21 +23,21 @@ describe Ridley::Search do
|
|
19
23
|
subject { Ridley::Search }
|
20
24
|
|
21
25
|
describe "::indexes" do
|
22
|
-
it "sends a get request to the
|
23
|
-
connection.should_receive(:get).with("search").and_return(response)
|
26
|
+
it "sends a get request to the client to receive the indexes" do
|
27
|
+
client.connection.should_receive(:get).with("search").and_return(response)
|
24
28
|
|
25
|
-
subject.indexes(
|
29
|
+
subject.indexes(client)
|
26
30
|
end
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
30
34
|
describe "#run" do
|
31
35
|
subject do
|
32
|
-
Ridley::Search.new(
|
36
|
+
Ridley::Search.new(client, index, query)
|
33
37
|
end
|
34
38
|
|
35
|
-
it "sends a get request to the
|
36
|
-
connection.should_receive(:get).with("search/#{index}", q: query).and_return(response)
|
39
|
+
it "sends a get request to the client to the index's location with the given query" do
|
40
|
+
client.connection.should_receive(:get).with("search/#{index}", q: query).and_return(response)
|
37
41
|
|
38
42
|
subject.run
|
39
43
|
end
|
@@ -42,8 +46,8 @@ describe Ridley::Search do
|
|
42
46
|
let(:sort) { "DESC" }
|
43
47
|
before(:each) { subject.sort = sort }
|
44
48
|
|
45
|
-
it "sends a get request to the
|
46
|
-
connection.should_receive(:get).with("search/#{index}", q: query, sort: sort).and_return(response)
|
49
|
+
it "sends a get request to the client with a query parameter for 'set'" do
|
50
|
+
client.connection.should_receive(:get).with("search/#{index}", q: query, sort: sort).and_return(response)
|
47
51
|
|
48
52
|
subject.run
|
49
53
|
end
|
@@ -53,8 +57,8 @@ describe Ridley::Search do
|
|
53
57
|
let(:start) { 1 }
|
54
58
|
before(:each) { subject.start = start }
|
55
59
|
|
56
|
-
it "sends a get request to the
|
57
|
-
connection.should_receive(:get).with("search/#{index}", q: query, start: start).and_return(response)
|
60
|
+
it "sends a get request to the client with a query parameter for 'start'" do
|
61
|
+
client.connection.should_receive(:get).with("search/#{index}", q: query, start: start).and_return(response)
|
58
62
|
|
59
63
|
subject.run
|
60
64
|
end
|
@@ -64,8 +68,8 @@ describe Ridley::Search do
|
|
64
68
|
let(:rows) { 1 }
|
65
69
|
before(:each) { subject.rows = rows }
|
66
70
|
|
67
|
-
it "sends a get request to the
|
68
|
-
connection.should_receive(:get).with("search/#{index}", q: query, rows: rows).and_return(response)
|
71
|
+
it "sends a get request to the client with a query parameter for 'rows'" do
|
72
|
+
client.connection.should_receive(:get).with("search/#{index}", q: query, rows: rows).and_return(response)
|
69
73
|
|
70
74
|
subject.run
|
71
75
|
end
|
@@ -99,14 +103,14 @@ describe Ridley::Search do
|
|
99
103
|
)
|
100
104
|
end
|
101
105
|
|
102
|
-
subject { Ridley::Search.new(
|
106
|
+
subject { Ridley::Search.new(client, index, query) }
|
103
107
|
|
104
|
-
it "returns an array of Ridley::
|
105
|
-
connection.should_receive(:get).with("search/#{index}", q: query).and_return(response)
|
108
|
+
it "returns an array of Ridley::NodeResource" do
|
109
|
+
client.connection.should_receive(:get).with("search/#{index}", q: query).and_return(response)
|
106
110
|
result = subject.run
|
107
111
|
|
108
112
|
result.should be_a(Array)
|
109
|
-
result.should each be_a(Ridley::
|
113
|
+
result.should each be_a(Ridley::NodeResource)
|
110
114
|
end
|
111
115
|
end
|
112
116
|
|
@@ -134,14 +138,14 @@ describe Ridley::Search do
|
|
134
138
|
)
|
135
139
|
end
|
136
140
|
|
137
|
-
subject { Ridley::Search.new(
|
141
|
+
subject { Ridley::Search.new(client, index, query) }
|
138
142
|
|
139
|
-
it "returns an array of Ridley::
|
140
|
-
connection.should_receive(:get).with("search/#{index}", q: query).and_return(response)
|
143
|
+
it "returns an array of Ridley::RoleResource" do
|
144
|
+
client.connection.should_receive(:get).with("search/#{index}", q: query).and_return(response)
|
141
145
|
result = subject.run
|
142
146
|
|
143
147
|
result.should be_a(Array)
|
144
|
-
result.should each be_a(Ridley::
|
148
|
+
result.should each be_a(Ridley::RoleResource)
|
145
149
|
end
|
146
150
|
end
|
147
151
|
|
@@ -168,14 +172,14 @@ describe Ridley::Search do
|
|
168
172
|
)
|
169
173
|
end
|
170
174
|
|
171
|
-
subject { Ridley::Search.new(
|
175
|
+
subject { Ridley::Search.new(client, index, query) }
|
172
176
|
|
173
|
-
it "returns an array of Ridley::
|
174
|
-
connection.should_receive(:get).with("search/#{index}", q: query).and_return(response)
|
177
|
+
it "returns an array of Ridley::EnvironmentResource" do
|
178
|
+
client.connection.should_receive(:get).with("search/#{index}", q: query).and_return(response)
|
175
179
|
result = subject.run
|
176
180
|
|
177
181
|
result.should be_a(Array)
|
178
|
-
result.should each be_a(Ridley::
|
182
|
+
result.should each be_a(Ridley::EnvironmentResource)
|
179
183
|
end
|
180
184
|
end
|
181
185
|
|
@@ -203,14 +207,14 @@ describe Ridley::Search do
|
|
203
207
|
)
|
204
208
|
end
|
205
209
|
|
206
|
-
subject { Ridley::Search.new(
|
210
|
+
subject { Ridley::Search.new(client, index, query) }
|
207
211
|
|
208
|
-
it "returns an array of Ridley::
|
209
|
-
connection.should_receive(:get).with("search/#{index}", q: query).and_return(response)
|
212
|
+
it "returns an array of Ridley::ClientResource" do
|
213
|
+
client.connection.should_receive(:get).with("search/#{index}", q: query).and_return(response)
|
210
214
|
result = subject.run
|
211
215
|
|
212
216
|
result.should be_a(Array)
|
213
|
-
result.should each be_a(Ridley::
|
217
|
+
result.should each be_a(Ridley::ClientResource)
|
214
218
|
end
|
215
219
|
end
|
216
220
|
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Ridley::SandboxUploader do
|
4
|
+
let(:client) do
|
5
|
+
double('client',
|
6
|
+
client_name: 'reset',
|
7
|
+
client_key: fixtures_path.join('reset.pem')
|
8
|
+
)
|
9
|
+
end
|
10
|
+
|
11
|
+
let(:checksums) do
|
12
|
+
{
|
13
|
+
"oGCPHrQ+5MylEL+V+NIJ9w==" => {
|
14
|
+
needs_upload: true,
|
15
|
+
url: "https://api.opscode.com/organizations/vialstudios/sandboxes/bd091b150b0a4578b97771af6abf3e05"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
let(:sandbox) do
|
21
|
+
Ridley::SandboxResource.new(client, checksums: checksums)
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "ClassMethods" do
|
25
|
+
subject { described_class }
|
26
|
+
describe "::upload" do
|
27
|
+
it "terminates the uploader after upload" do
|
28
|
+
uploader = double('uploader', alive?: true)
|
29
|
+
Ridley::SandboxUploader.should_receive(:pool).with(size: 12, args: [sandbox]).and_return(uploader)
|
30
|
+
uploader.should_receive(:multi_upload).with(checksums)
|
31
|
+
uploader.should_receive(:terminate)
|
32
|
+
|
33
|
+
subject.upload(sandbox, checksums)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "::checksum" do
|
38
|
+
it "returns a string" do
|
39
|
+
subject.checksum(fixtures_path.join('reset.pem')).should be_a(String)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "::checksum64" do
|
44
|
+
it "returns a string" do
|
45
|
+
subject.checksum64(fixtures_path.join('reset.pem')).should be_a(String)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
subject { described_class.new(sandbox) }
|
51
|
+
|
52
|
+
describe "#multi_upload" do
|
53
|
+
it "sends an upload command for each pair of checksum/path" do
|
54
|
+
subject.should_receive(:upload).with(checksums.first[0], checksums.first[1])
|
55
|
+
|
56
|
+
subject.multi_upload(checksums)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "#upload" do
|
61
|
+
let(:chk_id) { "oGCPHrQ+5MylEL+V+NIJ9w==" }
|
62
|
+
let(:path) { fixtures_path.join('reset.pem').to_s }
|
63
|
+
|
64
|
+
context "when the checksum needs uploading" do
|
65
|
+
let(:checksums) do
|
66
|
+
{
|
67
|
+
chk_id => {
|
68
|
+
url: "https://api.opscode.com/organizations/vialstudios/sandboxes/bd091b150b0a4578b97771af6abf3e05",
|
69
|
+
needs_upload: true
|
70
|
+
}
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
it "uploads each checksum to their target URL" do
|
75
|
+
stub_request(:put, checksums[chk_id][:url])
|
76
|
+
|
77
|
+
subject.upload(chk_id, path)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context "when the checksum doesn't need uploading" do
|
82
|
+
let(:checksums) do
|
83
|
+
{
|
84
|
+
chk_id => {
|
85
|
+
needs_upload: false
|
86
|
+
}
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
90
|
+
let(:sandbox) do
|
91
|
+
Ridley::SandboxResource.new(client, checksums: checksums)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "returns nil" do
|
95
|
+
subject.upload(chk_id, path).should be_nil
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -4,11 +4,11 @@ describe Ridley::SSH do
|
|
4
4
|
let(:connection) { double('conn', ssh: { user: "vagrant", password: "vagrant" }) }
|
5
5
|
|
6
6
|
let(:node_one) do
|
7
|
-
Ridley::
|
7
|
+
Ridley::NodeResource.new(connection, automatic: { cloud: { public_hostname: "33.33.33.10" } })
|
8
8
|
end
|
9
9
|
|
10
10
|
let(:node_two) do
|
11
|
-
Ridley::
|
11
|
+
Ridley::NodeResource.new(connection, automatic: { cloud: { public_hostname: "33.33.33.11" } })
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "ClassMethods" do
|
data/spec/unit/ridley_spec.rb
CHANGED
@@ -6,20 +6,12 @@ describe Ridley do
|
|
6
6
|
describe "ClassMethods" do
|
7
7
|
subject { Ridley }
|
8
8
|
|
9
|
-
describe "::
|
10
|
-
it "delegates to Ridley::Connection.sync" do
|
11
|
-
Ridley::Connection.should_receive(:sync).with(config)
|
12
|
-
|
13
|
-
subject.sync(config) do; end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
describe "::connection" do
|
9
|
+
describe "::new" do
|
18
10
|
it "creates a new Ridley::Connection" do
|
19
|
-
|
20
|
-
Ridley::
|
11
|
+
client = double('client')
|
12
|
+
Ridley::Client.should_receive(:new).with(config).and_return(client)
|
21
13
|
|
22
|
-
subject.
|
14
|
+
subject.new(config).should eql(client)
|
23
15
|
end
|
24
16
|
end
|
25
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ridley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.0.
|
4
|
+
version: 0.7.0.rc1
|
5
5
|
prerelease: 6
|
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-01-
|
12
|
+
date: 2013-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -114,7 +114,7 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ! '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 0.8.4
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -122,7 +122,7 @@ dependencies:
|
|
122
122
|
requirements:
|
123
123
|
- - ! '>='
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
125
|
+
version: 0.8.4
|
126
126
|
- !ruby/object:Gem::Dependency
|
127
127
|
name: activesupport
|
128
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -223,8 +223,8 @@ files:
|
|
223
223
|
- lib/ridley/bootstrapper.rb
|
224
224
|
- lib/ridley/bootstrapper/context.rb
|
225
225
|
- lib/ridley/chain_link.rb
|
226
|
+
- lib/ridley/client.rb
|
226
227
|
- lib/ridley/connection.rb
|
227
|
-
- lib/ridley/dsl.rb
|
228
228
|
- lib/ridley/errors.rb
|
229
229
|
- lib/ridley/log.rb
|
230
230
|
- lib/ridley/logging.rb
|
@@ -233,16 +233,18 @@ files:
|
|
233
233
|
- lib/ridley/middleware/chef_response.rb
|
234
234
|
- lib/ridley/middleware/parse_json.rb
|
235
235
|
- lib/ridley/resource.rb
|
236
|
-
- lib/ridley/resources
|
237
|
-
- lib/ridley/resources/
|
238
|
-
- lib/ridley/resources/
|
239
|
-
- lib/ridley/resources/
|
240
|
-
- lib/ridley/resources/
|
241
|
-
- lib/ridley/resources/
|
242
|
-
- lib/ridley/resources/
|
243
|
-
- lib/ridley/resources/
|
244
|
-
- lib/ridley/resources/
|
236
|
+
- lib/ridley/resources.rb
|
237
|
+
- lib/ridley/resources/client_resource.rb
|
238
|
+
- lib/ridley/resources/cookbook_resource.rb
|
239
|
+
- lib/ridley/resources/data_bag_item_resource.rb
|
240
|
+
- lib/ridley/resources/data_bag_resource.rb
|
241
|
+
- lib/ridley/resources/encrypted_data_bag_item_resource.rb
|
242
|
+
- lib/ridley/resources/environment_resource.rb
|
243
|
+
- lib/ridley/resources/node_resource.rb
|
244
|
+
- lib/ridley/resources/role_resource.rb
|
245
|
+
- lib/ridley/resources/sandbox_resource.rb
|
245
246
|
- lib/ridley/resources/search.rb
|
247
|
+
- lib/ridley/sandbox_uploader.rb
|
246
248
|
- lib/ridley/ssh.rb
|
247
249
|
- lib/ridley/ssh/response.rb
|
248
250
|
- lib/ridley/ssh/response_set.rb
|
@@ -270,20 +272,23 @@ files:
|
|
270
272
|
- spec/support/spec_helpers.rb
|
271
273
|
- spec/unit/ridley/bootstrapper/context_spec.rb
|
272
274
|
- spec/unit/ridley/bootstrapper_spec.rb
|
275
|
+
- spec/unit/ridley/client_spec.rb
|
273
276
|
- spec/unit/ridley/connection_spec.rb
|
274
277
|
- spec/unit/ridley/errors_spec.rb
|
275
278
|
- spec/unit/ridley/middleware/chef_auth_spec.rb
|
276
279
|
- spec/unit/ridley/middleware/chef_response_spec.rb
|
277
280
|
- spec/unit/ridley/middleware/parse_json_spec.rb
|
278
281
|
- spec/unit/ridley/resource_spec.rb
|
279
|
-
- spec/unit/ridley/resources/
|
280
|
-
- spec/unit/ridley/resources/
|
281
|
-
- spec/unit/ridley/resources/
|
282
|
-
- spec/unit/ridley/resources/
|
283
|
-
- spec/unit/ridley/resources/
|
284
|
-
- spec/unit/ridley/resources/
|
285
|
-
- spec/unit/ridley/resources/
|
282
|
+
- spec/unit/ridley/resources/client_resource_spec.rb
|
283
|
+
- spec/unit/ridley/resources/cookbook_resource_spec.rb
|
284
|
+
- spec/unit/ridley/resources/data_bag_item_resource_spec.rb
|
285
|
+
- spec/unit/ridley/resources/data_bag_resource_spec.rb
|
286
|
+
- spec/unit/ridley/resources/environment_resource_spec.rb
|
287
|
+
- spec/unit/ridley/resources/node_resource_spec.rb
|
288
|
+
- spec/unit/ridley/resources/role_resource_spec.rb
|
289
|
+
- spec/unit/ridley/resources/sandbox_resource_spec.rb
|
286
290
|
- spec/unit/ridley/resources/search_spec.rb
|
291
|
+
- spec/unit/ridley/sandbox_uploader_spec.rb
|
287
292
|
- spec/unit/ridley/ssh/response_set_spec.rb
|
288
293
|
- spec/unit/ridley/ssh/worker_spec.rb
|
289
294
|
- spec/unit/ridley/ssh_spec.rb
|
@@ -335,20 +340,23 @@ test_files:
|
|
335
340
|
- spec/support/spec_helpers.rb
|
336
341
|
- spec/unit/ridley/bootstrapper/context_spec.rb
|
337
342
|
- spec/unit/ridley/bootstrapper_spec.rb
|
343
|
+
- spec/unit/ridley/client_spec.rb
|
338
344
|
- spec/unit/ridley/connection_spec.rb
|
339
345
|
- spec/unit/ridley/errors_spec.rb
|
340
346
|
- spec/unit/ridley/middleware/chef_auth_spec.rb
|
341
347
|
- spec/unit/ridley/middleware/chef_response_spec.rb
|
342
348
|
- spec/unit/ridley/middleware/parse_json_spec.rb
|
343
349
|
- spec/unit/ridley/resource_spec.rb
|
344
|
-
- spec/unit/ridley/resources/
|
345
|
-
- spec/unit/ridley/resources/
|
346
|
-
- spec/unit/ridley/resources/
|
347
|
-
- spec/unit/ridley/resources/
|
348
|
-
- spec/unit/ridley/resources/
|
349
|
-
- spec/unit/ridley/resources/
|
350
|
-
- spec/unit/ridley/resources/
|
350
|
+
- spec/unit/ridley/resources/client_resource_spec.rb
|
351
|
+
- spec/unit/ridley/resources/cookbook_resource_spec.rb
|
352
|
+
- spec/unit/ridley/resources/data_bag_item_resource_spec.rb
|
353
|
+
- spec/unit/ridley/resources/data_bag_resource_spec.rb
|
354
|
+
- spec/unit/ridley/resources/environment_resource_spec.rb
|
355
|
+
- spec/unit/ridley/resources/node_resource_spec.rb
|
356
|
+
- spec/unit/ridley/resources/role_resource_spec.rb
|
357
|
+
- spec/unit/ridley/resources/sandbox_resource_spec.rb
|
351
358
|
- spec/unit/ridley/resources/search_spec.rb
|
359
|
+
- spec/unit/ridley/sandbox_uploader_spec.rb
|
352
360
|
- spec/unit/ridley/ssh/response_set_spec.rb
|
353
361
|
- spec/unit/ridley/ssh/worker_spec.rb
|
354
362
|
- spec/unit/ridley/ssh_spec.rb
|
data/lib/ridley/dsl.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
module Ridley
|
2
|
-
# @api public
|
3
|
-
# @author Jamie Winsor <jamie@vialstudios.com>
|
4
|
-
#
|
5
|
-
# A DSL to be included into Ridley::Connection. Instance functions of the same name as
|
6
|
-
# Chef a resource are coerced into class functions of a class of the same name.
|
7
|
-
#
|
8
|
-
# This is accomplished by returning a Ridley::Context object and coercing any messages sent
|
9
|
-
# to it into a message to the Chef resource's class in Ridley.
|
10
|
-
#
|
11
|
-
# @example
|
12
|
-
# class Connection
|
13
|
-
# include Ridley::DSL
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# connection = Ridley::Connection.new
|
17
|
-
# connection.role.all
|
18
|
-
#
|
19
|
-
# The 'role' function is made available to the instance of Ridley::Connection by including
|
20
|
-
# Ridley::DSL. This function returns a Ridley::Context object which receives the 'all' message.
|
21
|
-
# The Ridley::Context coerces the 'all' message into a message to the Ridley::Role class and
|
22
|
-
# sends along the instance of Ridley::Connection that is chaining 'role.all'
|
23
|
-
#
|
24
|
-
# connection.role.all => Ridley::Role.all(connection)
|
25
|
-
#
|
26
|
-
# Any additional arguments will also be passed to the class function of the Chef resource's class
|
27
|
-
#
|
28
|
-
# connection.role.find("reset") => Ridley::Role.find(connection, "reset")
|
29
|
-
#
|
30
|
-
# @example instantiating new resources
|
31
|
-
# class connection
|
32
|
-
# include Ridley::DSL
|
33
|
-
# end
|
34
|
-
#
|
35
|
-
# connection = Ridley::Connection.new
|
36
|
-
# connection.role.new(name: "hello") => <#Ridley::Role: @name="hello">
|
37
|
-
#
|
38
|
-
# New instances of resources can be instantiated by calling new on the Ridley::Context. These messages
|
39
|
-
# will be send to the Chef resource's class in Ridley and can be treated as a normal Ruby object. Each
|
40
|
-
# instantiated object will have the connection information contained within so you can do things like
|
41
|
-
# save a role after changing it's attributes.
|
42
|
-
#
|
43
|
-
# r = connection.role.new(name: "new-role")
|
44
|
-
# r.name => "new-role"
|
45
|
-
# r.name = "other-name"
|
46
|
-
# r.save
|
47
|
-
#
|
48
|
-
# connection.role.find("new-role") => <#Ridley::Role: @name="new-role">
|
49
|
-
#
|
50
|
-
# @see Ridley::Context
|
51
|
-
# @see Ridley::Role
|
52
|
-
# @see Ridley::Connection
|
53
|
-
module DSL; end
|
54
|
-
end
|
55
|
-
|
56
|
-
Dir["#{File.dirname(__FILE__)}/resources/*.rb"].sort.each do |path|
|
57
|
-
require "ridley/resources/#{File.basename(path, '.rb')}"
|
58
|
-
end
|