Skip to content

Commit

Permalink
[drupal]: drupal 7.0 is default; switching to drush for all install t…
Browse files Browse the repository at this point in the history
…asks
  • Loading branch information
mdxp committed Mar 10, 2011
1 parent b18bfb0 commit c44b2d8
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 32 deletions.
11 changes: 6 additions & 5 deletions attributes/default.rb
Expand Up @@ -18,8 +18,8 @@
# limitations under the License.
#

default[:drupal][:version] = "6.19"
default[:drupal][:checksum] = "b2067b18408321af8595715e2c1fb0e9f20c188b4276bb616c066ff6ab26ee88"
default[:drupal][:version] = "7.0"
default[:drupal][:checksum] = "62e4146b2a2208d0772cef6578205b369f361b2079bf3fa9408e92f5419902e8"
default[:drupal][:dir] = "/var/www/drupal"
default[:drupal][:db][:database] = "drupal"
default[:drupal][:db][:user] = "drupal"
Expand All @@ -29,8 +29,9 @@
set_unless[:drupal][:db][:password] = secure_password
default[:drupal][:src] = Chef::Config[:file_cache_path]

default[:drupal][:drush][:version] = "4.2"
default[:drupal][:drush][:checksum] = "6ab024cdec530223a008fb3ec3e5a94f478c8a999038ffc181561fbb4e7c3872"
default[:drupal][:drush][:version] = "4.x-dev"
default[:drupal][:drush][:checksum] = "86bf384f5d70793a6f41d0e4a0d25fa1dceaccb17c9f7db1c5bf0397be6ab64a"
default[:drupal][:drush][:dir] = "/usr/local/drush"

default[:drupal][:modules] = ["views", ["webform","3.9"]]
default[:drupal][:modules] = ["views", "webform"]

72 changes: 45 additions & 27 deletions recipes/default.rb
Expand Up @@ -20,6 +20,7 @@

include_recipe "apache2"
include_recipe %w{php::php5 php::module_mysql}
include_recipe "drupal::drush"
include_recipe "mysql::server"
Gem.clear_paths
require 'mysql'
Expand Down Expand Up @@ -52,23 +53,25 @@
end

#install drupal
remote_file "#{node[:drupal][:src]}/drupal-#{node[:drupal][:version]}.tar.gz" do
checksum node[:drupal][:checksum]
source "http://ftp.drupal.org/files/projects/drupal-#{node[:drupal][:version]}.tar.gz"
mode "0644"
end
#remote_file "#{node[:drupal][:src]}/drupal-#{node[:drupal][:version]}.tar.gz" do
# checksum node[:drupal][:checksum]
# source "http://ftp.drupal.org/files/projects/drupal-#{node[:drupal][:version]}.tar.gz"
# mode "0644"
#end

directory "#{node[:drupal][:dir]}" do
owner "root"
group "root"
mode "0755"
action :create
end
#directory "#{node[:drupal][:dir]}" do
# owner "root"
# group "root"
# mode "0755"
# action :create
#end

execute "untar-drupal" do
cwd node[:drupal][:dir]
command "tar --strip-components 1 -xzf #{node[:drupal][:src]}/drupal-#{node[:drupal][:version]}.tar.gz"
creates "#{node[:drupal][:dir]}/index.php"
execute "download-and-install-drupal" do
cwd File.dirname(node[:drupal][:dir])
command "#{node[:drupal][:drush][:dir]}/drush -y dl drupal-#{node[:drupal][:version]} --destination=#{File.dirname(node[:drupal][:dir])} --drupal-project-rename=#{File.basename(node[:drupal][:dir])} && \
#{node[:drupal][:drush][:dir]}/drush -y site-install -r #{node[:drupal][:dir]} --account-name=admin --account-pass=mdtest --site-name=Drupal \
--db-url=mysql://#{node[:drupal][:db][:user]}:'#{node[:drupal][:db][:password]}'@localhost/#{node[:drupal][:db][:database]}"
not_if "#{node[:drupal][:drush][:dir]}/drush -r #{node[:drupal][:dir]} status | grep #{node[:drupal][:version]}"
end

if node.has_key?("ec2")
Expand All @@ -77,24 +80,39 @@
server_fqdn = node.fqdn
end

log "Navigate to 'http://#{server_fqdn}/install.php' to complete the drupal installation" do
action :nothing
end
#log "Navigate to 'http://#{server_fqdn}/install.php' to complete the drupal installation" do
# action :nothing
#end

directory "#{node[:drupal][:dir]}/sites/default/files" do
mode "0777"
action :create
end

template "#{node[:drupal][:dir]}/sites/default/settings.php" do
source "settings.php.erb"
mode "0644"
variables(
:database => node[:drupal][:db][:database],
:user => node[:drupal][:db][:user],
:password => node[:drupal][:db][:password]
)
notifies :write, resources(:log => "Navigate to 'http://#{server_fqdn}/install.php' to complete the drupal installation")
#template "#{node[:drupal][:dir]}/sites/default/settings.php" do
# source "settings.php.erb"
# mode "0644"
# variables(
# :database => node[:drupal][:db][:database],
# :user => node[:drupal][:db][:user],
# :password => node[:drupal][:db][:password]
# )
# notifies :write, resources(:log => "Navigate to 'http://#{server_fqdn}/install.php' to complete the drupal installation")
#end

if node[:drupal][:modules]
node[:drupal][:modules].each do |m|
if m.is_a?Array
drupal_module m.first do
version m.last
dir node[:drupal][:dir]
end
else
drupal_module m do
dir node[:drupal][:dir]
end
end
end
end

web_app "drupal" do
Expand Down

0 comments on commit c44b2d8

Please sign in to comment.