Permalink
Browse files

latest

  • Loading branch information...
parisholley committed Apr 11, 2012
1 parent e7a8024 commit 02a0fbca9368769699e4dc574e1ce01bfe38f1f3
Showing with 23 additions and 4 deletions.
  1. +23 −4 php-app/recipes/default.rb
View
@@ -12,12 +12,31 @@
require_recipe "mysql::server"
+
+if File.exists?("#{node['vagrant']['directory']}/etc/hosts")
+ execute "/etc/hosts" do
+ command "cp #{node['vagrant']['directory']}/etc/hosts /etc/hosts"
+ action :run
+ end
+end
+
+if File.exists?("#{node['vagrant']['directory']}/dump.sql")
+ execute "create-database" do
+ command "mysql -uroot -p#{node['mysql']['server_root_password']} -e \"create database #{node['mysql']['database']}\""
+ action :run
+ end
+
+ execute "create-tables" do
+ command "mysql -uroot -p#{node['mysql']['server_root_password']} #{node['mysql']['database']} < #{node['vagrant']['directory']}/dump.sql"
+ end
+end
+
execute "disable-default-site" do
- command "sudo a2dissite default"
- notifies :reload, resources(:service => "apache2"), :delayed
+ command "sudo a2dissite default"
+ notifies :reload, resources(:service => "apache2"), :delayed
end
web_app "php-app" do
- template "php-app.conf.erb"
- notifies :reload, resources(:service => "apache2"), :delayed
+ template "php-app.conf.erb"
+ notifies :reload, resources(:service => "apache2"), :delayed
end

0 comments on commit 02a0fbc

Please sign in to comment.