diff --git a/lib/chef/knife/topo/version.rb b/lib/chef/knife/topo/version.rb index 1e00783..42b3f43 100644 --- a/lib/chef/knife/topo/version.rb +++ b/lib/chef/knife/topo/version.rb @@ -1,5 +1,5 @@ module Knife module Topo - VERSION = "0.0.10" + VERSION = "0.0.11" end end diff --git a/test-repo/cookbooks/testapp/attributes/default.rb b/test-repo/cookbooks/testapp/attributes/default.rb new file mode 100644 index 0000000..195d4da --- /dev/null +++ b/test-repo/cookbooks/testapp/attributes/default.rb @@ -0,0 +1,3 @@ +default['testapp']['user'] = 'vagrant' +default['testapp']['path'] = "/home/vagrant" +default['testapp']['appname'] = 'testapp' diff --git a/test-repo/cookbooks/testapp/metadata.rb b/test-repo/cookbooks/testapp/metadata.rb index f16c854..191a904 100644 --- a/test-repo/cookbooks/testapp/metadata.rb +++ b/test-repo/cookbooks/testapp/metadata.rb @@ -4,6 +4,6 @@ license 'Apache v2.0' description 'Installs/Configures test application' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.11' +version '0.1.12' depends 'mongodb', '~> 0.16' depends 'nodejs', '~> 1.3' \ No newline at end of file diff --git a/test-repo/cookbooks/testapp/recipes/deploy.rb b/test-repo/cookbooks/testapp/recipes/deploy.rb index 3797b60..cae5bee 100644 --- a/test-repo/cookbooks/testapp/recipes/deploy.rb +++ b/test-repo/cookbooks/testapp/recipes/deploy.rb @@ -6,44 +6,49 @@ # # -directory "/home/vagrant/ypo" do - owner "vagrant" - group "vagrant" +user = node['testapp']['user'] +appname = node['testapp']['appname'] +basepath = node['testapp']['path'] +fullpath = ::File.join(basepath, appname) + +directory fullpath do + owner user + group user mode 00750 action :create end -cookbook_file "/home/vagrant/ypo/server.js" do +cookbook_file ::File.join(fullpath, "server.js") do source 'server.js' end -cookbook_file "/home/vagrant/ypo/package.json" do +cookbook_file ::File.join(fullpath, "package.json") do source 'package.json' end -cookbook_file "/home/vagrant/ypo/index.html" do +cookbook_file ::File.join(fullpath, "index.html") do source 'index.html' end -execute 'install_ypo' do - cwd "/home/vagrant/ypo" - user "vagrant" +execute 'install_testapp' do + cwd fullpath + user user command "npm install" end -template "ypo.upstart.conf" do - path "/etc/init/ypo.conf" +template "testapp.upstart.conf" do + path ::File.join("/etc/init", appname + ".conf") source 'nodejs.upstart.conf.erb' mode '0644' variables( - :user => 'vagrant', + :user => user, :node_dir => '/usr/local', - :app_dir => '/home/vagrant', - :entry => 'ypo' + :app_dir => basepath, + :entry => appname ) end -service 'ypo' do +service appname do provider Chef::Provider::Service::Upstart supports :restart => true, :start => true, :stop => true action [:restart]