cookbook-client 0.1.0

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.
data/NOTICE ADDED
@@ -0,0 +1,13 @@
1
+ Spoon NOTICE
2
+ ============
3
+
4
+ Developed at Opscode (http://www.opscode.com).
5
+
6
+ Contributors and Copyright holders:
7
+
8
+ * Copyright 2009, Christopher Walters <cw@opscode.com>
9
+ * Copyright 2009, Christopher Brown <cb@opscode.com>
10
+ * Copyright 2009, Tim Hinderliter <tim@opscode.com>
11
+
12
+ Spoon incorporates code modified from Stanislav Vitvitskiy's blog (http://stanislavvitvitskiy.blogspot.com/2008/12/multipart-post-in-ruby.html).
13
+
data/Rakefile ADDED
@@ -0,0 +1,59 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "cookbook-client"
8
+ gem.summary = "A command-line tool for interacting with the Cookbook Community Site, cookbooks.opscode.com"
9
+ gem.email = "info@opscode.com"
10
+ gem.homepage = "http://www.opscode.com"
11
+ gem.authors = ["Opscode, Inc."]
12
+ gem.bindir = "bin"
13
+ gem.executables = %w(spoon)
14
+ gem.add_dependency 'mixlib-authentication'
15
+ end
16
+ rescue LoadError
17
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
18
+ end
19
+
20
+ require 'spec/rake/spectask'
21
+ Spec::Rake::SpecTask.new(:spec) do |spec|
22
+ spec.libs << 'lib' << 'spec'
23
+ spec.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
24
+ spec.spec_files = FileList['spec/**/*_spec.rb']
25
+ end
26
+
27
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
28
+ spec.libs << 'lib' << 'spec'
29
+ spec.pattern = 'spec/**/*_spec.rb'
30
+ spec.rcov = true
31
+ end
32
+
33
+ begin
34
+ require 'cucumber/rake/task'
35
+ Cucumber::Rake::Task.new(:features)
36
+ rescue LoadError
37
+ task :features do
38
+ abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
39
+ end
40
+ end
41
+
42
+ task :default => :spec
43
+
44
+ require 'rake/rdoctask'
45
+ Rake::RDocTask.new do |rdoc|
46
+ if File.exist?('VERSION.yml')
47
+ config = YAML.load(File.read('VERSION.yml'))
48
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
49
+ else
50
+ version = ""
51
+ end
52
+
53
+ rdoc.rdoc_dir = 'rdoc'
54
+ rdoc.title = "mixlib-cli #{version}"
55
+ rdoc.rdoc_files.include('README*')
56
+ rdoc.rdoc_files.include('lib/**/*.rb')
57
+ rdoc.rdoc_files.include('cookbook-uploader')
58
+ end
59
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/bin/spoon ADDED
@@ -0,0 +1,233 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.push File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'rubygems'
6
+ require 'chef/cookbook_client'
7
+
8
+ ##########
9
+ # main
10
+ ##########
11
+ hostname = 'cookbooks.opscode.com'
12
+ need_help_text = nil
13
+ command = nil
14
+ search_term = nil
15
+ cookbook_name = nil
16
+ cookbook_version = nil
17
+
18
+ replacement_cookbook_name = nil
19
+ upload_cookbook_filename = nil
20
+ upload_cookbook_category = nil
21
+ user_id = nil
22
+ user_secret_filename = nil
23
+
24
+ # Parse arguments.
25
+ idx = 0
26
+ while (idx < ARGV.length) do
27
+ get_arg_or_error = lambda { |descr_str|
28
+ res = nil
29
+ if ARGV.length > idx + 1
30
+ res = ARGV[idx + 1]
31
+ idx += 1
32
+ else
33
+ puts "ERROR: missing the #{descr_str}."
34
+ need_help_text = true
35
+ end
36
+ res
37
+ }
38
+
39
+ # TODO: use case/when
40
+ # TODO: need to use the getopt (??) parser so i don't have to do all
41
+ # this checking for extra arguments..
42
+ case ARGV[idx]
43
+ when "list"
44
+ command = :list
45
+
46
+ when "search"
47
+ if search_term = get_arg_or_error.call('search term')
48
+ command = :search
49
+ end
50
+
51
+ when "show"
52
+ if cookbook_name = get_arg_or_error.call('cookbook name')
53
+ command = :show
54
+ end
55
+
56
+ when "download"
57
+ if cookbook_name = get_arg_or_error.call('cookbook name')
58
+ command = :download
59
+ end
60
+ when "-v"
61
+ cookbook_version = get_arg_or_error.call('version')
62
+
63
+ when "delete"
64
+ if cookbook_name = get_arg_or_error.call('cookbook name')
65
+ command = :delete
66
+ end
67
+ when "deprecate"
68
+ if cookbook_name = get_arg_or_error.call('cookbook name')
69
+ command = :deprecate
70
+ end
71
+
72
+ # upload and its options..
73
+ when "upload"
74
+ if upload_cookbook_filename = get_arg_or_error.call('cookbook filename')
75
+ command = :upload
76
+ end
77
+ when "-u"
78
+ user_id = get_arg_or_error.call('user id')
79
+ when "-f"
80
+ user_secret_filename = get_arg_or_error.call('user secret filename')
81
+ when "-c"
82
+ upload_cookbook_category = get_arg_or_error.call('cookbook category')
83
+
84
+ when "-r"
85
+ replacement_cookbook_name = get_arg_or_error.call('replacement cookbook name')
86
+
87
+ when "-h"
88
+ # Undocumented switch for interacting with a different community site.
89
+ hostname = get_arg_or_error.call('community site hostname')
90
+
91
+ else
92
+ puts "unknown option #{ARGV[idx]}"
93
+ need_help_text = true
94
+ end
95
+
96
+ idx += 1
97
+ end
98
+
99
+ # Check if we got all the right arguments ..
100
+ if (:upload == command || :delete == command || :deprecate == command) && (user_id.nil? || user_secret_filename.nil?)
101
+ puts "ERROR: Need user id and secret filename for upload, delete or deprecate operation."
102
+ puts
103
+ need_help_text = true
104
+ end
105
+
106
+ if :upload == command && upload_cookbook_category.nil?
107
+ puts "ERROR: Need category for uploaded cookbook."
108
+ puts
109
+ need_help_text = true
110
+ end
111
+
112
+ if :deprecate == command && replacement_cookbook_name.nil?
113
+ puts "ERROR: Need replacement cookbook name for deprecate."
114
+ puts
115
+ need_help_text = true
116
+ end
117
+
118
+ # Spit out the error message if necessary.
119
+ if command.nil? || need_help_text
120
+ puts <<-EOH
121
+ Tasks:
122
+ list
123
+ Lists all cookbooks available on cookbooks.opscode.com.
124
+
125
+ search <term>
126
+ Searches for cookbooks matching the given term in any cookbook field, as well as the maintainer name.
127
+
128
+ show <cookbook_name>
129
+ Show detailed information, including versions available, for a given cookbook.
130
+
131
+ download <cookbook_name> [-v version]
132
+ Downloads a cookbook with the given name. Defaults to the latest version available
133
+ unless -v was specified.
134
+
135
+ upload <cookbook_filename> -u <user_name> -f <user_validation_key_filename> [-c cookbook_category] [-t tag1 [tag2]]
136
+ Uploads a new cookbook with the given filename. You must also include your username
137
+ and the location of your user validation key. You can generate a new key by logging in
138
+ to cookbooks.opscode.com.
139
+
140
+ deprecate <cookbook_name> -u <user_id> -f <user_validation_key_filename> -r <recommended_replacement_cookbook_name>
141
+ Deprecate the given cookbook, and recommend a replacement cookbook. This is useful
142
+ if you would like to leave a cookbook up on the site for legacy purposes but want users
143
+ to move to a new cookbook. Authentication options are the same as for 'upload'.
144
+
145
+ delete <cookbook_name> -u <user_id> -f <user_validation_key_filename>
146
+ Delete the given cookbook. This will remove all comments, versions, and ratings for
147
+ the cookbook. Authentication options are the same as for 'upload'.
148
+ EOH
149
+
150
+ exit 1
151
+ end
152
+
153
+ def print_cookbooks(cookbook_list)
154
+ unless cookbook_list.kind_of?(Array)
155
+ raise "need an array for print_cookbooks"
156
+ end
157
+
158
+ cookbook_list.each do |cookbook|
159
+ puts "#{cookbook.name} - #{cookbook.maintainer}"
160
+ puts " #{cookbook.description}"
161
+ puts
162
+ end
163
+ end
164
+
165
+ def print_cookbook_details(cookbook)
166
+ unless cookbook.kind_of?(Chef::RemoteCookbook)
167
+ raise "need a RemoteCookbook for print_cookbook_details"
168
+ end
169
+
170
+ puts "Name: #{cookbook.name}"
171
+ puts "Description: #{cookbook.description}"
172
+ puts "Maintainer: #{cookbook.maintainer}"
173
+ puts "Root URI: #{cookbook.uri}"
174
+
175
+ cookbook.versions.each do |ver|
176
+ is_latest = (ver === cookbook.latest_version) ? " (latest)" : ""
177
+
178
+ puts " Version: #{ver.version} at #{ver.uri}#{is_latest}"
179
+ end
180
+ end
181
+
182
+
183
+ ######
184
+ # Do the action
185
+ ######
186
+ client = Chef::CookbookClient.new(hostname)
187
+
188
+ case command
189
+ when :list
190
+ res = client.do_list
191
+ print_cookbooks res
192
+
193
+ when :search
194
+ res = client.do_search search_term
195
+ print_cookbooks res
196
+
197
+ when :show
198
+ res = client.do_details cookbook_name
199
+ print_cookbook_details res
200
+ puts
201
+
202
+ when :download
203
+ puts "Downloading cookbook #{cookbook_name}..."
204
+ out_filename = client.do_download cookbook_name, cookbook_version
205
+ puts "#{File.size(out_filename)} bytes written to #{out_filename}."
206
+
207
+ when :upload
208
+ unless File.exists?(upload_cookbook_filename)
209
+ puts "No such file: #{upload_cookbook_filename}"
210
+ exit 1
211
+ end
212
+
213
+ if File.directory?(upload_cookbook_filename)
214
+ # make a tarball
215
+ puts "Don't support automagic creation of tarball, yet"
216
+ else
217
+ # assume it's a tarball, look for the right contents.
218
+ puts "Uploading cookbook #{upload_cookbook_filename}..."
219
+ res = client.do_upload upload_cookbook_filename, upload_cookbook_category, user_id, user_secret_filename
220
+ puts "Cookbook uploaded."
221
+ end
222
+
223
+ when :delete
224
+ puts "Deleting cookbook #{cookbook_name}..."
225
+ res = client.do_delete cookbook_name, user_id, user_secret_filename
226
+ puts "Cookbook deleted."
227
+
228
+ when :deprecate
229
+ puts "Deprecating cookbook #{cookbook_name}..."
230
+ res = client.do_deprecate cookbook_name, replacement_cookbook_name, user_id, user_secret_filename
231
+ puts "Cookbook deprecated."
232
+ end
233
+
@@ -0,0 +1,69 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{cookbook-client}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Opscode, Inc."]
12
+ s.date = %q{2009-11-09}
13
+ s.default_executable = %q{spoon}
14
+ s.email = %q{info@opscode.com}
15
+ s.executables = ["spoon"]
16
+ s.files = [
17
+ "NOTICE",
18
+ "Rakefile",
19
+ "VERSION",
20
+ "bin/spoon",
21
+ "cookbook-client.gemspec",
22
+ "lib/chef/cookbook_client.rb",
23
+ "lib/chef/remote_cookbook.rb",
24
+ "lib/chef/streaming_cookbook_uploader.rb",
25
+ "spec/spec.opts",
26
+ "spec/spec_helper.rb",
27
+ "spec/spoon/spoon_spec.rb"
28
+ ]
29
+ s.homepage = %q{http://www.opscode.com}
30
+ s.rdoc_options = ["--charset=UTF-8"]
31
+ s.require_paths = ["lib"]
32
+ s.rubygems_version = %q{1.3.5}
33
+ s.summary = %q{A command-line tool for interacting with the Cookbook Community Site, cookbooks.opscode.com}
34
+ s.test_files = [
35
+ "spec/spec_helper.rb",
36
+ "spec/spoon/spoon_spec.rb",
37
+ "examples/couchdb/metadata.rb",
38
+ "examples/couchdb/recipes/default.rb",
39
+ "examples/couchdb2/metadata.rb",
40
+ "examples/couchdb2/recipes/default.rb",
41
+ "examples/couchdb3/metadata.rb",
42
+ "examples/couchdb3/recipes/default.rb",
43
+ "examples/couchdb4/metadata.rb",
44
+ "examples/couchdb4/recipes/default.rb",
45
+ "examples/couchdb5/metadata.rb",
46
+ "examples/couchdb5/recipes/default.rb",
47
+ "examples/rest-delete.rb",
48
+ "examples/test-auth-against-erlang.rb",
49
+ "examples/test-hash-find.rb",
50
+ "examples/test-ssl.rb",
51
+ "examples/test-using-restclient-multipart.rb",
52
+ "examples/test_signature_verification.rb",
53
+ "examples/testrestoc.rb",
54
+ "examples/upload-using-cw_multipart.rb"
55
+ ]
56
+
57
+ if s.respond_to? :specification_version then
58
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
59
+ s.specification_version = 3
60
+
61
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
62
+ s.add_runtime_dependency(%q<mixlib-authentication>, [">= 0"])
63
+ else
64
+ s.add_dependency(%q<mixlib-authentication>, [">= 0"])
65
+ end
66
+ else
67
+ s.add_dependency(%q<mixlib-authentication>, [">= 0"])
68
+ end
69
+ end
@@ -0,0 +1,16 @@
1
+ maintainer "Opscode, Inc."
2
+ maintainer_email "cookbooks@opscode.com"
3
+ license "Apache 2.0"
4
+ description "Installs CouchDB package and starts service"
5
+ long_description <<-EOH
6
+ Installs the CouchDB package if it is available from an package repository on
7
+ the node. If the package repository is not available, CouchDB needs to be
8
+ installed via some other method, either a backported package, or compiled
9
+ directly from source.
10
+ EOH
11
+ version "0.7"
12
+ supports "ubuntu", ">= 8.10" # for package in APT
13
+
14
+ %w{ rhel centos fedora }.each do |os|
15
+ supports os # requires that CouchDB package is available in yum repositories
16
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Author:: Joshua Timberman <joshua@opscode.com>
3
+ # Cookbook Name:: couchdb
4
+ # Recipe:: default
5
+ #
6
+ # Copyright 2008, OpsCode, Inc
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+
20
+ package "couchdb"
21
+
22
+ directory "/var/lib/couchdb" do
23
+ owner "couchdb"
24
+ group "couchdb"
25
+ recursive true
26
+ end
27
+
28
+ service "couchdb" do
29
+ if platform?("centos","redhat","fedora")
30
+ start_command "/sbin/service couchdb start &> /dev/null"
31
+ stop_command "/sbin/service couchdb stop &> /dev/null"
32
+ end
33
+ supports [ :restart, :status ]
34
+ action [ :enable, :start ]
35
+ end
@@ -0,0 +1,16 @@
1
+ maintainer "Opscode, Inc."
2
+ maintainer_email "cookbooks@opscode.com"
3
+ license "Apache 2.0"
4
+ description "Installs CouchDB package and starts service"
5
+ long_description <<-EOH
6
+ Installs the CouchDB package if it is available from an package repository on
7
+ the node. If the package repository is not available, CouchDB needs to be
8
+ installed via some other method, either a backported package, or compiled
9
+ directly from source.
10
+ EOH
11
+ version "0.7.7"
12
+ supports "ubuntu", ">= 8.10" # for package in APT
13
+
14
+ %w{ rhel centos fedora }.each do |os|
15
+ supports os # requires that CouchDB package is available in yum repositories
16
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Author:: Joshua Timberman <joshua@opscode.com>
3
+ # Cookbook Name:: couchdb
4
+ # Recipe:: default
5
+ #
6
+ # Copyright 2008, OpsCode, Inc
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+
20
+ package "couchdb"
21
+
22
+ directory "/var/lib/couchdb" do
23
+ owner "couchdb"
24
+ group "couchdb"
25
+ recursive true
26
+ end
27
+
28
+ service "couchdb" do
29
+ if platform?("centos","redhat","fedora")
30
+ start_command "/sbin/service couchdb start &> /dev/null"
31
+ stop_command "/sbin/service couchdb stop &> /dev/null"
32
+ end
33
+ supports [ :restart, :status ]
34
+ action [ :enable, :start ]
35
+ end
@@ -0,0 +1,16 @@
1
+ maintainer "Opscode, Inc."
2
+ maintainer_email "cookbooks@opscode.com"
3
+ license "Apache 2.0"
4
+ description "Installs CouchDB package and starts service"
5
+ long_description <<-EOH
6
+ Installs the CouchDB package if it is available from an package repository on
7
+ the node. If the package repository is not available, CouchDB needs to be
8
+ installed via some other method, either a backported package, or compiled
9
+ directly from source.
10
+ EOH
11
+ version "0.7.7"
12
+ supports "ubuntu", ">= 8.10" # for package in APT
13
+
14
+ %w{ rhel centos fedora }.each do |os|
15
+ supports os # requires that CouchDB package is available in yum repositories
16
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Author:: Joshua Timberman <joshua@opscode.com>
3
+ # Cookbook Name:: couchdb
4
+ # Recipe:: default
5
+ #
6
+ # Copyright 2008, OpsCode, Inc
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+
20
+ package "couchdb"
21
+
22
+ directory "/var/lib/couchdb" do
23
+ owner "couchdb"
24
+ group "couchdb"
25
+ recursive true
26
+ end
27
+
28
+ service "couchdb" do
29
+ if platform?("centos","redhat","fedora")
30
+ start_command "/sbin/service couchdb start &> /dev/null"
31
+ stop_command "/sbin/service couchdb stop &> /dev/null"
32
+ end
33
+ supports [ :restart, :status ]
34
+ action [ :enable, :start ]
35
+ end
@@ -0,0 +1,16 @@
1
+ maintainer "Opscode, Inc."
2
+ maintainer_email "cookbooks@opscode.com"
3
+ license "Apache 2.0"
4
+ description "Installs CouchDB package and starts service"
5
+ long_description <<-EOH
6
+ Installs the CouchDB package if it is available from an package repository on
7
+ the node. If the package repository is not available, CouchDB needs to be
8
+ installed via some other method, either a backported package, or compiled
9
+ directly from source.
10
+ EOH
11
+ version "0.7.7"
12
+ supports "ubuntu", ">= 8.10" # for package in APT
13
+
14
+ %w{ rhel centos fedora }.each do |os|
15
+ supports os # requires that CouchDB package is available in yum repositories
16
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Author:: Joshua Timberman <joshua@opscode.com>
3
+ # Cookbook Name:: couchdb
4
+ # Recipe:: default
5
+ #
6
+ # Copyright 2008, OpsCode, Inc
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+
20
+ package "couchdb"
21
+
22
+ directory "/var/lib/couchdb" do
23
+ owner "couchdb"
24
+ group "couchdb"
25
+ recursive true
26
+ end
27
+
28
+ service "couchdb" do
29
+ if platform?("centos","redhat","fedora")
30
+ start_command "/sbin/service couchdb start &> /dev/null"
31
+ stop_command "/sbin/service couchdb stop &> /dev/null"
32
+ end
33
+ supports [ :restart, :status ]
34
+ action [ :enable, :start ]
35
+ end
@@ -0,0 +1,16 @@
1
+ maintainer "Opscode, Inc."
2
+ maintainer_email "cookbooks@opscode.com"
3
+ license "Apache 2.0"
4
+ description "Installs CouchDB package and starts service"
5
+ long_description <<-EOH
6
+ Installs the CouchDB package if it is available from an package repository on
7
+ the node. If the package repository is not available, CouchDB needs to be
8
+ installed via some other method, either a backported package, or compiled
9
+ directly from source.
10
+ EOH
11
+ version "0.7.7"
12
+ supports "ubuntu", ">= 8.10" # for package in APT
13
+
14
+ %w{ rhel centos fedora }.each do |os|
15
+ supports os # requires that CouchDB package is available in yum repositories
16
+ end
@@ -0,0 +1,35 @@
1
+ #
2
+ # Author:: Joshua Timberman <joshua@opscode.com>
3
+ # Cookbook Name:: couchdb
4
+ # Recipe:: default
5
+ #
6
+ # Copyright 2008, OpsCode, Inc
7
+ #
8
+ # Licensed under the Apache License, Version 2.0 (the "License");
9
+ # you may not use this file except in compliance with the License.
10
+ # You may obtain a copy of the License at
11
+ #
12
+ # http://www.apache.org/licenses/LICENSE-2.0
13
+ #
14
+ # Unless required by applicable law or agreed to in writing, software
15
+ # distributed under the License is distributed on an "AS IS" BASIS,
16
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+
20
+ package "couchdb"
21
+
22
+ directory "/var/lib/couchdb" do
23
+ owner "couchdb"
24
+ group "couchdb"
25
+ recursive true
26
+ end
27
+
28
+ service "couchdb" do
29
+ if platform?("centos","redhat","fedora")
30
+ start_command "/sbin/service couchdb start &> /dev/null"
31
+ stop_command "/sbin/service couchdb stop &> /dev/null"
32
+ end
33
+ supports [ :restart, :status ]
34
+ action [ :enable, :start ]
35
+ end
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ require 'rubygems'
4
+ require 'opscode/rest'
5
+
6
+ client = Opscode::REST.new
7
+
8
+ #uri = 'http://opscode-community.pivotallabs.com/api/v1/cookbooks/couchdb3'
9
+ #secret_filename = '/Users/tim/.ssh/pivotallabs-secret.txt'
10
+ #user_id = 'timh'
11
+ #uri = 'http://opscode:omgnewcommunity!@com-stg.opscode.com/api/v1/cookbooks/couchdb2'
12
+ uri = 'http://com-stg.opscode.com/api/v1/cookbooks/couchdb4'
13
+ secret_filename = '/Users/tim/.ssh/secret-timh2-com-stg.txt'
14
+ user_id = 'timh2'
15
+
16
+
17
+ user_secret = OpenSSL::PKey::RSA.new(File.read(secret_filename))
18
+
19
+ res = client.request(:delete,
20
+ uri,
21
+ :authenticate => true,
22
+ :user_id => user_id,
23
+ :user_secret => user_secret)
24
+ puts "res from delete is: #{res}"