Permalink
Browse files

updating with demo recipes for getting started

  • Loading branch information...
1 parent 48afc7b commit 3f7a5899c4470fab881d703420e23d2bda2086e8 Ezra Zygmuntowicz committed Jan 31, 2009
View
18 config/dna.json
@@ -0,0 +1,18 @@
+{
+ "apps": [
+ "beast",
+ "mephisto"
+ ],
+ "user": "ez",
+ "gems": [
+ {
+ "name": "merb",
+ "version": "1.0.8.1"
+ },
+ {
+ "name": "tmm1-amqp",
+ "source": "http://gems.github.com",
+ "version": "0.6.0"
+ }
+ ]
+}
View
43 cookbooks/applications/recipes/default.rb
@@ -0,0 +1,43 @@
+#
+# Cookbook Name:: applications
+# Recipe:: default
+#
+# Copyright 2009, Engine Yard, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+directory "/data" do
+ owner node[:user]
+ mode 0755
+end
+
+node[:apps].each do |app|
+
+ cap_directories = [
+ "/data/#{app}/shared",
+ "/data/#{app}/shared/config",
+ "/data/#{app}/shared/system",
+ "/data/#{app}/releases"
+ ]
+
+ cap_directories.each do |dir|
+ directory dir do
+ owner node[:user]
+ mode 0755
+ recursive true
+ end
+ end
+
+end
+
View
1 cookbooks/gems/attributes/recipe.rb
@@ -1 +0,0 @@
-recipes("gems")
View
16 cookbooks/gems/recipes/default.rb
@@ -1,5 +1,11 @@
-
-
-gem_package "merb" do
- version '1.0.8.1'
-end
+node[:gems].each do |gem|
+ gem_package gem[:name] do
+ if gem[:version] && !gem[:version].empty?
+ version gem[:version]
+ end
+ if gem[:source]
+ source gem[:source]
+ end
+ action :install
+ end
+end
View
1 cookbooks/main/attributes/recipe.rb
@@ -0,0 +1 @@
+recipes("main")
View
31 cookbooks/main/recipes/default.rb
@@ -0,0 +1,31 @@
+#
+# Cookbook Name:: main
+# Recipe:: default
+#
+# Copyright 2009, Engine Yard, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+
+include_recipe 'gems'
+include_recipe 'applications'
+
+template "/data/someservice.conf" do
+ owner node[:user]
+ mode 0644
+ source "someservice.conf.erb"
+ variables({
+ :applications => node[:apps]
+ })
+end
View
4 cookbooks/main/templates/default/someservice.conf.erb
@@ -0,0 +1,4 @@
+<% @applications.each do |app| %>
+ SetFoo <%= app %>
+ Dir /data/<%= app %>
+<% end %>

0 comments on commit 3f7a589

Please sign in to comment.