Skip to content

Commit

Permalink
Allow civicrm extensions to be installed from a downloaded zip
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Aug 27, 2023
1 parent f62e7bd commit 751a95c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
6 changes: 2 additions & 4 deletions cookbooks/civicrm/attributes/default.rb
Expand Up @@ -11,10 +11,8 @@
default[:civicrm][:extensions][:emailapi][:revision] = "2.9"

# fancy email templates
# Do not update from git! See https://civicrm.stackexchange.com/questions/25763/mosaico-packages-are-missing-beta-4
# default[:civicrm][:extensions][:mosaico][:name] = "uk.co.vedaconsulting.mosaico"
# default[:civicrm][:extensions][:mosaico][:repository] = "https://github.com/veda-consulting-company/uk.co.vedaconsulting.mosaico.git"
# default[:civicrm][:extensions][:mosaico][:revision] = "3.2"
default[:civicrm][:extensions][:mosaico][:name] = "uk.co.vedaconsulting.mosaico"
default[:civicrm][:extensions][:mosaico][:zip] = "https://download.civicrm.org/extension/uk.co.vedaconsulting.mosaico/3.2.1691060437/uk.co.vedaconsulting.mosaico-3.2.1691060437.zip"

# validate that osm username exists, simple check
default[:civicrm][:extensions][:username][:name] = "org.openstreetmap.username"
Expand Down
32 changes: 26 additions & 6 deletions cookbooks/civicrm/recipes/default.rb
Expand Up @@ -161,12 +161,32 @@
end

node[:civicrm][:extensions].each_value do |details|
git "#{extensions_directory}/#{details[:name]}" do
action :sync
repository details[:repository]
revision details[:revision]
user "wordpress"
group "wordpress"
if details[:repository]
git "#{extensions_directory}/#{details[:name]}" do
action :sync
repository details[:repository]
revision details[:revision]
user "wordpress"
group "wordpress"
end
elsif details[:zip]
remote_file "#{cache_dir}/#{details[:name]}.zip" do
source details[:zip]
owner "root"
group "root"
mode "644"
backup false
end

archive_file "#{cache_dir}/#{details[:name]}.zip" do
action :nothing
path "#{extensions_directory}/#{details[:name]}"
strip_components 1
owner "wordpress"
group "wordpress"
overwrite true
subscribes :extract, "remote_file[#{cache_dir}/#{details[:name]}.zip]", :immediately
end
end
end

Expand Down

0 comments on commit 751a95c

Please sign in to comment.