Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

FC001: Use strings in preference to symbols to access node attributes

  • Loading branch information...
commit 0756a411670edcc98dfed42375bd62edfd8e878e 1 parent 607e877
@mdxp mdxp authored
View
28 attributes/default.rb
@@ -18,23 +18,23 @@
# limitations under the License.
#
-default[:drupal][:version] = "7.10"
-default[:drupal][:checksum] = "de648c9944ef00ccf6af0fd7cee19a950eae613e1fa7c75dacbe56e4820c8eba"
-default[:drupal][:dir] = "/var/www/drupal"
-default[:drupal][:db][:database] = "drupal"
-default[:drupal][:db][:user] = "drupal"
-default[:drupal][:site][:admin] = "admin"
-default[:drupal][:site][:pass] = "drupaladmin"
-default[:drupal][:site][:name] = "Drupal7"
+default['drupal']['version'] = "7.10"
+default['drupal']['checksum'] = "de648c9944ef00ccf6af0fd7cee19a950eae613e1fa7c75dacbe56e4820c8eba"
+default['drupal']['dir'] = "/var/www/drupal"
+default['drupal']['db']['database'] = "drupal"
+default['drupal']['db']['user'] = "drupal"
+default['drupal']['site']['admin'] = "admin"
+default['drupal']['site']['pass'] = "drupaladmin"
+default['drupal']['site']['name'] = "Drupal7"
::Chef::Node.send(:include, Opscode::OpenSSL::Password)
-set_unless[:drupal][:db][:password] = secure_password
-default[:drupal][:src] = Chef::Config[:file_cache_path]
+set_unless['drupal']['db']['password'] = secure_password
+default['drupal']['src'] = Chef::Config[:file_cache_path]
-default[:drupal][:drush][:version] = "4.x-dev"
-default[:drupal][:drush][:checksum] = "86bf384f5d70793a6f41d0e4a0d25fa1dceaccb17c9f7db1c5bf0397be6ab64a"
-default[:drupal][:drush][:dir] = "/usr/local/drush"
+default['drupal']['drush']['version'] = "4.x-dev"
+default['drupal']['drush']['checksum'] = "86bf384f5d70793a6f41d0e4a0d25fa1dceaccb17c9f7db1c5bf0397be6ab64a"
+default['drupal']['drush']['dir'] = "/usr/local/drush"
-default[:drupal][:modules] = ["views", "webform"]
+default['drupal']['modules'] = ["views", "webform"]
View
8 definitions/drupal_module.rb
@@ -27,13 +27,13 @@
end
execute "drush_dl_module #{params[:name]}" do
cwd params[:dir]
- command "#{node[:drupal][:drush][:dir]}/drush -y dl #{params[:name]}"
- not_if "#{node[:drupal][:drush][:dir]}/drush -r #{params[:dir]} pm-list |grep '(#{params[:name]})' |grep '#{params[:version]}'"
+ command "#{node['drupal']['drush']['dir']}/drush -y dl #{params[:name]}"
+ not_if "#{node['drupal']['drush']['dir']}/drush -r #{params[:dir]} pm-list |grep '(#{params[:name]})' |grep '#{params[:version]}'"
end
execute "drush_en_module #{params[:name]}" do
cwd params[:dir]
- command "#{node[:drupal][:drush][:dir]}/drush -y en #{params[:name]}"
- not_if "#{node[:drupal][:drush][:dir]}/drush -r #{params[:dir]} pm-list |grep '(#{params[:name]})' |grep -i 'enabled'"
+ command "#{node['drupal']['drush']['dir']}/drush -y en #{params[:name]}"
+ not_if "#{node['drupal']['drush']['dir']}/drush -r #{params[:dir]} pm-list |grep '(#{params[:name]})' |grep -i 'enabled'"
end
else
log "drupal_source action #{params[:name]} is unrecognized."
View
4 recipes/cron.rb
@@ -19,7 +19,7 @@
#
cron "drupal hourly cron" do
- command "cd #{node[:drupal][:dir]}; /usr/bin/php cron.php"
+ command "cd #{node['drupal']['dir']}; /usr/bin/php cron.php"
minute "0"
- only_if { File.exist?("#{node[:drupal][:dir]}/cron.php") }
+ only_if { File.exist?("#{node['drupal']['dir']}/cron.php") }
end
View
42 recipes/default.rb
@@ -24,7 +24,7 @@
include_recipe "mysql::server"
execute "mysql-install-drupal-privileges" do
- command "/usr/bin/mysql -u root -p#{node[:mysql][:server_root_password]} < /etc/mysql/drupal-grants.sql"
+ command "/usr/bin/mysql -u root -p#{node['mysql']['server_root_password']} < /etc/mysql/drupal-grants.sql"
action :nothing
end
@@ -35,47 +35,47 @@
group "root"
mode "0600"
variables(
- :user => node[:drupal][:db][:user],
- :password => node[:drupal][:db][:password],
- :database => node[:drupal][:db][:database]
+ :user => node['drupal']['db']['user'],
+ :password => node['drupal']['db']['password'],
+ :database => node['drupal']['db']['database']
)
notifies :run, resources(:execute => "mysql-install-drupal-privileges"), :immediately
end
-execute "create #{node[:drupal][:db][:database]} database" do
- command "/usr/bin/mysqladmin -u root -p#{node[:mysql][:server_root_password]} create #{node[:drupal][:db][:database]}"
- not_if "mysql -u root -p#{node[:mysql][:server_root_password]} --silent --skip-column-names --execute=\"show databases like '#{node[:drupal][:db][:database]}'\" | grep #{node[:drupal][:db][:database]}"
+execute "create #{node['drupal']['db']['database']} database" do
+ command "/usr/bin/mysqladmin -u root -p#{node['mysql']['server_root_password']} create #{node['drupal']['db']['database']}"
+ not_if "mysql -u root -p#{node['mysql']['server_root_password']} --silent --skip-column-names --execute=\"show databases like '#{node['drupal']['db']['database']}'\" | grep #{node['drupal']['db']['database']}"
end
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=#{node[:drupal][:site][:admin]} --account-pass=#{node[:drupal][:site][:pass]} --site-name=#{node[:drupal][:site][:name]} \
- --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]}"
+ 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=#{node['drupal']['site']['admin']} --account-pass=#{node['drupal']['site']['pass']} --site-name=#{node['drupal']['site']['name']} \
+ --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")
- server_fqdn = node.ec2.public_hostname
+ server_fqdn = node['ec2']['public_hostname']
else
- server_fqdn = node.fqdn
+ server_fqdn = node['fqdn']
end
-directory "#{node[:drupal][:dir]}/sites/default/files" do
+directory "#{node['drupal']['dir']}/sites/default/files" do
mode "0777"
action :create
end
-if node[:drupal][:modules]
- node[:drupal][:modules].each do |m|
+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]
+ dir node['drupal']['dir']
end
else
drupal_module m do
- dir node[:drupal][:dir]
+ dir node['drupal']['dir']
end
end
end
@@ -83,9 +83,9 @@
web_app "drupal" do
template "drupal.conf.erb"
- docroot "#{node[:drupal][:dir]}"
+ docroot node['drupal']['dir']
server_name server_fqdn
- server_aliases node.fqdn
+ server_aliases node['fqdn']
end
include_recipe "drupal::cron"
View
18 recipes/drush.rb
@@ -20,13 +20,13 @@
include_recipe %w{php php::module_mysql php::module_gd}
-remote_file "#{node[:drupal][:src]}/drush-All-versions-#{node[:drupal][:drush][:version]}.tar.gz" do
- checksum node[:drupal][:drush][:checksum]
- source "http://ftp.drupal.org/files/projects/drush-All-versions-#{node[:drupal][:drush][:version]}.tar.gz"
+remote_file "#{node['drupal']['src']}/drush-All-versions-#{node['drupal']['drush']['version']}.tar.gz" do
+ checksum node['drupal']['drush']['checksum']
+ source "http://ftp.drupal.org/files/projects/drush-All-versions-#{node['drupal']['drush']['version']}.tar.gz"
mode "0644"
end
-directory "#{node[:drupal][:drush][:dir]}" do
+directory node['drupal']['drush']['dir'] do
owner "root"
group "root"
mode "0755"
@@ -34,17 +34,17 @@
end
execute "untar-drush" do
- cwd node[:drupal][:drush][:dir]
- command "tar --strip-components 1 -xzf #{node[:drupal][:src]}/drush-All-versions-#{node[:drupal][:drush][:version]}.tar.gz"
- not_if "/usr/local/bin/drush status drush-version --pipe | grep #{node[:drupal][:drush][:version]}"
+ cwd node['drupal']['drush']['dir']
+ command "tar --strip-components 1 -xzf #{node['drupal']['src']}/drush-All-versions-#{node['drupal']['drush']['version']}.tar.gz"
+ not_if "/usr/local/bin/drush status drush-version --pipe | grep #{node['drupal']['drush']['version']}"
end
link "/usr/local/bin/drush" do
- to "#{node[:drupal][:drush][:dir]}/drush"
+ to "#{node['drupal']['drush']['dir']}/drush"
end
#execute "install-drush-make" do
-# cwd node[:drupal][:drush][:dir]
+# cwd node['drupal']['drush']['dir']
# command "/usr/local/bin/drush dl drush_make"
# not_if { File.directory?("/root/.drush/drush_make")}
#end
Please sign in to comment.
Something went wrong with that request. Please try again.