spice 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +3 -1
- data/lib/spice.rb +4 -4
- data/lib/spice/chef.rb +5 -5
- data/lib/spice/connection.rb +1 -1
- data/lib/spice/search.rb +20 -0
- data/lib/spice/version.rb +1 -1
- data/spec/spice/client_spec.rb +0 -1
- data/spec/spice/cookbook_spec.rb +0 -5
- metadata +5 -43
- data/Gemfile.lock +0 -92
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -83,7 +83,9 @@ TODO
|
|
83
83
|
|
84
84
|
### Contributors
|
85
85
|
|
86
|
-
* Ian Meyer
|
86
|
+
* [Ian Meyer](https://github.com/imeyer) - Opscode Platform support
|
87
|
+
* [Holger Just](https://github.com/meineerde) - Search functionality
|
88
|
+
* [Sean Porter](https://github.com/portertech) - Platform bug fixes
|
87
89
|
|
88
90
|
## Contributing to spice
|
89
91
|
|
data/lib/spice.rb
CHANGED
@@ -4,12 +4,13 @@ require 'yajl'
|
|
4
4
|
|
5
5
|
require 'spice/authentication'
|
6
6
|
require 'spice/chef'
|
7
|
-
require 'spice/role'
|
8
7
|
|
8
|
+
require 'spice/role'
|
9
9
|
require 'spice/client'
|
10
10
|
require 'spice/cookbook'
|
11
11
|
require 'spice/data_bag'
|
12
12
|
require 'spice/node'
|
13
|
+
require 'spice/search'
|
13
14
|
require 'spice/connection'
|
14
15
|
|
15
16
|
require 'spice/version'
|
@@ -78,13 +79,12 @@ module Spice
|
|
78
79
|
|
79
80
|
def connect!
|
80
81
|
@connection = Connection.new(
|
81
|
-
:url => "#{scheme}://#{host}:#{port}",
|
82
|
+
:url => "#{scheme}://#{host}:#{port}/#{url_path}",
|
82
83
|
:client_name => client_name,
|
83
84
|
:key_file => key_file
|
84
85
|
)
|
85
86
|
end
|
86
|
-
|
87
|
-
|
87
|
+
|
88
88
|
def reset!
|
89
89
|
@host = default_host
|
90
90
|
@port = default_port
|
data/lib/spice/chef.rb
CHANGED
@@ -8,23 +8,23 @@ module Spice
|
|
8
8
|
|
9
9
|
class << self
|
10
10
|
def clients
|
11
|
-
Client.all
|
11
|
+
@clients ||= Client.all
|
12
12
|
end
|
13
13
|
|
14
14
|
def nodes
|
15
|
-
Node.all
|
15
|
+
@nodes ||= Node.all
|
16
16
|
end
|
17
17
|
|
18
18
|
def data_bags
|
19
|
-
DataBag.all
|
19
|
+
@data_bags ||= DataBag.all
|
20
20
|
end
|
21
21
|
|
22
22
|
def roles
|
23
|
-
Role.all
|
23
|
+
@roles ||= Role.all
|
24
24
|
end
|
25
25
|
|
26
26
|
def cookbooks
|
27
|
-
Cookbook.all
|
27
|
+
@cookbooks ||= Cookbook.all
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/lib/spice/connection.rb
CHANGED
data/lib/spice/search.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
module Spice
|
2
|
+
class Search < Spice::Chef
|
3
|
+
INDEXES = %w(node role client users)
|
4
|
+
|
5
|
+
INDEXES.each do |index|
|
6
|
+
define_method index do |options|
|
7
|
+
options ||= {}
|
8
|
+
options.symbolize_keys!
|
9
|
+
|
10
|
+
type = index
|
11
|
+
query = options[:q] || '*:*'
|
12
|
+
sort = options[:sort] || "X_CHEF_id_CHEF_X asc"
|
13
|
+
start = options[:start] || 0
|
14
|
+
rows = options[:rows] || 1000
|
15
|
+
|
16
|
+
connection.get("/search/#{index}?q=#{escape(query)}&sort=#{escape(sort)}&start=#{escape(start)}&rows=#{escape(rows)}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/spice/version.rb
CHANGED
data/spec/spice/client_spec.rb
CHANGED
data/spec/spice/cookbook_spec.rb
CHANGED
@@ -3,7 +3,6 @@ require 'spec_helper'
|
|
3
3
|
module Spice
|
4
4
|
describe Cookbook do
|
5
5
|
describe ".all" do
|
6
|
-
before { setup_chef_cookbook }
|
7
6
|
|
8
7
|
it "returns a list of cookbooks" do
|
9
8
|
stub_cookbook_list
|
@@ -12,7 +11,6 @@ module Spice
|
|
12
11
|
end
|
13
12
|
|
14
13
|
describe ".show" do
|
15
|
-
before { setup_chef_cookbook }
|
16
14
|
|
17
15
|
context "valid" do
|
18
16
|
it "returns a valid cookbook" do
|
@@ -38,7 +36,6 @@ module Spice
|
|
38
36
|
end
|
39
37
|
|
40
38
|
describe ".create" do
|
41
|
-
before { setup_chef_cookbook }
|
42
39
|
|
43
40
|
context "valid" do
|
44
41
|
it "creates a valid non-admin cookbook" do
|
@@ -70,7 +67,6 @@ module Spice
|
|
70
67
|
end
|
71
68
|
|
72
69
|
describe ".update" do
|
73
|
-
before { setup_chef_cookbook }
|
74
70
|
|
75
71
|
context "valid" do
|
76
72
|
it "makes a cookbook an admin" do
|
@@ -86,7 +82,6 @@ module Spice
|
|
86
82
|
end
|
87
83
|
|
88
84
|
describe ".delete" do
|
89
|
-
before { setup_chef_cookbook }
|
90
85
|
|
91
86
|
context "valid" do
|
92
87
|
it "deletes a cookbook" do
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 4
|
8
|
-
- 0
|
9
|
-
version: 0.4.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.4.1
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Dan Ryan
|
@@ -14,7 +10,7 @@ autorequire:
|
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
12
|
|
17
|
-
date: 2011-
|
13
|
+
date: 2011-03-23 00:00:00 -07:00
|
18
14
|
default_executable:
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
@@ -25,8 +21,6 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ">="
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
24
|
version: "0"
|
31
25
|
type: :runtime
|
32
26
|
version_requirements: *id001
|
@@ -38,8 +32,6 @@ dependencies:
|
|
38
32
|
requirements:
|
39
33
|
- - ">="
|
40
34
|
- !ruby/object:Gem::Version
|
41
|
-
segments:
|
42
|
-
- 0
|
43
35
|
version: "0"
|
44
36
|
type: :runtime
|
45
37
|
version_requirements: *id002
|
@@ -51,8 +43,6 @@ dependencies:
|
|
51
43
|
requirements:
|
52
44
|
- - ">="
|
53
45
|
- !ruby/object:Gem::Version
|
54
|
-
segments:
|
55
|
-
- 0
|
56
46
|
version: "0"
|
57
47
|
type: :runtime
|
58
48
|
version_requirements: *id003
|
@@ -64,10 +54,6 @@ dependencies:
|
|
64
54
|
requirements:
|
65
55
|
- - ~>
|
66
56
|
- !ruby/object:Gem::Version
|
67
|
-
segments:
|
68
|
-
- 0
|
69
|
-
- 6
|
70
|
-
- 4
|
71
57
|
version: 0.6.4
|
72
58
|
type: :development
|
73
59
|
version_requirements: *id004
|
@@ -79,10 +65,6 @@ dependencies:
|
|
79
65
|
requirements:
|
80
66
|
- - ~>
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
segments:
|
83
|
-
- 2
|
84
|
-
- 5
|
85
|
-
- 0
|
86
68
|
version: 2.5.0
|
87
69
|
type: :development
|
88
70
|
version_requirements: *id005
|
@@ -94,10 +76,6 @@ dependencies:
|
|
94
76
|
requirements:
|
95
77
|
- - ~>
|
96
78
|
- !ruby/object:Gem::Version
|
97
|
-
segments:
|
98
|
-
- 0
|
99
|
-
- 10
|
100
|
-
- 0
|
101
79
|
version: 0.10.0
|
102
80
|
type: :development
|
103
81
|
version_requirements: *id006
|
@@ -109,10 +87,6 @@ dependencies:
|
|
109
87
|
requirements:
|
110
88
|
- - ~>
|
111
89
|
- !ruby/object:Gem::Version
|
112
|
-
segments:
|
113
|
-
- 1
|
114
|
-
- 6
|
115
|
-
- 1
|
116
90
|
version: 1.6.1
|
117
91
|
type: :development
|
118
92
|
version_requirements: *id007
|
@@ -124,10 +98,6 @@ dependencies:
|
|
124
98
|
requirements:
|
125
99
|
- - ~>
|
126
100
|
- !ruby/object:Gem::Version
|
127
|
-
segments:
|
128
|
-
- 0
|
129
|
-
- 3
|
130
|
-
- 5
|
131
101
|
version: 0.3.5
|
132
102
|
type: :development
|
133
103
|
version_requirements: *id008
|
@@ -139,8 +109,6 @@ dependencies:
|
|
139
109
|
requirements:
|
140
110
|
- - ">="
|
141
111
|
- !ruby/object:Gem::Version
|
142
|
-
segments:
|
143
|
-
- 0
|
144
112
|
version: "0"
|
145
113
|
type: :development
|
146
114
|
version_requirements: *id009
|
@@ -152,8 +120,6 @@ dependencies:
|
|
152
120
|
requirements:
|
153
121
|
- - ">="
|
154
122
|
- !ruby/object:Gem::Version
|
155
|
-
segments:
|
156
|
-
- 0
|
157
123
|
version: "0"
|
158
124
|
type: :development
|
159
125
|
version_requirements: *id010
|
@@ -173,7 +139,6 @@ files:
|
|
173
139
|
- .rspec
|
174
140
|
- CHANGELOG.md
|
175
141
|
- Gemfile
|
176
|
-
- Gemfile.lock
|
177
142
|
- LICENSE.txt
|
178
143
|
- Notes.md
|
179
144
|
- README.md
|
@@ -193,6 +158,7 @@ files:
|
|
193
158
|
- lib/spice/mock.rb
|
194
159
|
- lib/spice/node.rb
|
195
160
|
- lib/spice/role.rb
|
161
|
+
- lib/spice/search.rb
|
196
162
|
- lib/spice/version.rb
|
197
163
|
- pkg/spice-0.0.1.alpha.1.gem
|
198
164
|
- spec/spec_helper.rb
|
@@ -227,21 +193,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
227
193
|
requirements:
|
228
194
|
- - ">="
|
229
195
|
- !ruby/object:Gem::Version
|
230
|
-
segments:
|
231
|
-
- 0
|
232
196
|
version: "0"
|
233
197
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
198
|
none: false
|
235
199
|
requirements:
|
236
200
|
- - ">="
|
237
201
|
- !ruby/object:Gem::Version
|
238
|
-
segments:
|
239
|
-
- 0
|
240
202
|
version: "0"
|
241
203
|
requirements: []
|
242
204
|
|
243
205
|
rubyforge_project: spice
|
244
|
-
rubygems_version: 1.3
|
206
|
+
rubygems_version: 1.5.3
|
245
207
|
signing_key:
|
246
208
|
specification_version: 3
|
247
209
|
summary: Chef API wrapper
|
data/Gemfile.lock
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
spice (0.4.0)
|
5
|
-
mixlib-authentication
|
6
|
-
rest-client
|
7
|
-
yajl-ruby
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: http://rubygems.org/
|
11
|
-
specs:
|
12
|
-
abstract (1.0.0)
|
13
|
-
addressable (2.2.2)
|
14
|
-
builder (3.0.0)
|
15
|
-
bunny (0.6.0)
|
16
|
-
chef (0.9.12)
|
17
|
-
bunny (>= 0.6.0)
|
18
|
-
erubis
|
19
|
-
extlib
|
20
|
-
highline
|
21
|
-
json (>= 1.4.4, <= 1.4.6)
|
22
|
-
mixlib-authentication (>= 1.1.0)
|
23
|
-
mixlib-cli (>= 1.1.0)
|
24
|
-
mixlib-config (>= 1.1.2)
|
25
|
-
mixlib-log (>= 1.2.0)
|
26
|
-
moneta
|
27
|
-
ohai (>= 0.5.7)
|
28
|
-
rest-client (>= 1.0.4, < 1.7.0)
|
29
|
-
uuidtools
|
30
|
-
crack (0.1.8)
|
31
|
-
cucumber (0.10.0)
|
32
|
-
builder (>= 2.1.2)
|
33
|
-
diff-lcs (~> 1.1.2)
|
34
|
-
gherkin (~> 2.3.2)
|
35
|
-
json (~> 1.4.6)
|
36
|
-
term-ansicolor (~> 1.0.5)
|
37
|
-
diff-lcs (1.1.2)
|
38
|
-
erubis (2.6.6)
|
39
|
-
abstract (>= 1.0.0)
|
40
|
-
extlib (0.9.15)
|
41
|
-
gherkin (2.3.2)
|
42
|
-
json (~> 1.4.6)
|
43
|
-
term-ansicolor (~> 1.0.5)
|
44
|
-
highline (1.6.1)
|
45
|
-
json (1.4.6)
|
46
|
-
mime-types (1.16)
|
47
|
-
mixlib-authentication (1.1.4)
|
48
|
-
mixlib-log
|
49
|
-
mixlib-cli (1.2.0)
|
50
|
-
mixlib-config (1.1.2)
|
51
|
-
mixlib-log (1.2.0)
|
52
|
-
moneta (0.6.0)
|
53
|
-
ohai (0.5.8)
|
54
|
-
extlib
|
55
|
-
json (>= 1.4.4, <= 1.4.6)
|
56
|
-
mixlib-cli
|
57
|
-
mixlib-config
|
58
|
-
mixlib-log
|
59
|
-
systemu
|
60
|
-
rcov (0.9.9)
|
61
|
-
rest-client (1.6.1)
|
62
|
-
mime-types (>= 1.16)
|
63
|
-
rspec (2.5.0)
|
64
|
-
rspec-core (~> 2.5.0)
|
65
|
-
rspec-expectations (~> 2.5.0)
|
66
|
-
rspec-mocks (~> 2.5.0)
|
67
|
-
rspec-core (2.5.1)
|
68
|
-
rspec-expectations (2.5.0)
|
69
|
-
diff-lcs (~> 1.1.2)
|
70
|
-
rspec-mocks (2.5.0)
|
71
|
-
systemu (1.2.0)
|
72
|
-
term-ansicolor (1.0.5)
|
73
|
-
timecop (0.3.5)
|
74
|
-
uuidtools (2.1.1)
|
75
|
-
webmock (1.6.1)
|
76
|
-
addressable (>= 2.2.2)
|
77
|
-
crack (>= 0.1.7)
|
78
|
-
yajl-ruby (0.8.1)
|
79
|
-
yard (0.6.4)
|
80
|
-
|
81
|
-
PLATFORMS
|
82
|
-
ruby
|
83
|
-
|
84
|
-
DEPENDENCIES
|
85
|
-
chef
|
86
|
-
cucumber (~> 0.10.0)
|
87
|
-
rcov
|
88
|
-
rspec (~> 2.5.0)
|
89
|
-
spice!
|
90
|
-
timecop (~> 0.3.5)
|
91
|
-
webmock (~> 1.6.1)
|
92
|
-
yard (~> 0.6.4)
|