Closed EdHurtig closed 9 years ago
LWRPs would indeed be a good feature. In my wrapper cookbook I have automated plugin and theme installation/deletion by using wp-cli:
remote_file "/usr/local/bin/wp" do
action :create_if_missing
source "https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar"
owner "root"
group "root"
mode 0755
end
# Install and activate plugins
if node['wordpress']['plugins'] then
node['wordpress']['plugins'].each do |name, version|
execute "wp plugin #{name}" do
command "wp plugin install #{name} --version=#{version} --activate"
cwd node['wordpress']['dir']
user node['wordpress']['install']['user']
action :run
not_if "wp plugin is-installed #{name}"
end
end
end
# Delete some of the default themes
%w{twentythirteen twentytwelve}.each do |name|
execute "wp theme delete #{name}" do
command "wp theme delete #{name}"
cwd node['wordpress']['dir']
user node['wordpress']['install']['user']
action :run
end
end
I hope this helps.
:+1: on wp-cli, it's a fantastic tool for this type of thing. We use wp-cli as well.
There is a community wp-cli cookbook that provides a library for doing anything you'd like to do with wp-cli, which can include installing plugins to an existing WordPress installation.
It would probably be best to keep wp-cli as it's own cookbook.
That works for me, Thanks!
It would be really awesome if Plugins and Themes could be installed and activated using a LWRP. Has anyone put some thought into this?
Thoughts
Plugins
Themes
very similar setup for themes but also the possibility of adding theme mod support
Examples