wp-capistrano3 0.0.7 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea6d7bcea76690bc3763159325b682fe79d69838c588ab3a620d45c3b6856940
|
4
|
+
data.tar.gz: 8280fab03cc2e2ed940987b1c7bae4729017bc5919d6400b2b03ac2521b71e38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3c63e11c095a653156c9591d94dfdeb81fb39dbba34c2046f1a08613b816803fd361ec899e33fc0a2601b9b463159a6260c7254a2626b9e895741ea70ad4991
|
7
|
+
data.tar.gz: 4b29cb62cad00b9ec4c4c610cdabc1746bebd9c709c7ec9851b05b23ecb26d1e68344719bb60cdb1e62b6a97b9fe7634e8ed61e4275848e0d1fd17d593bdafd5
|
@@ -5,6 +5,7 @@ namespace "wp-capistrano" do
|
|
5
5
|
execute "wget -N http://wordpress.org/latest.tar.gz -P /tmp/"
|
6
6
|
execute "tar xzf /tmp/latest.tar.gz -C #{release_path} wordpress --strip-components=1"
|
7
7
|
execute "wget -N https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -P /tmp/"
|
8
|
+
execute "chmod u+x /tmp/wp-cli.phar"
|
8
9
|
end
|
9
10
|
end
|
10
|
-
end
|
11
|
+
end
|
@@ -2,82 +2,63 @@ require 'json'
|
|
2
2
|
namespace "wp-capistrano" do
|
3
3
|
desc 'Install wordpress plugins'
|
4
4
|
task :install_plugins do
|
5
|
-
on roles(:app) do
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
-n | --new_path ) shift
|
32
|
-
new_path="$1"
|
33
|
-
;;
|
34
|
-
-h | --help ) Help
|
35
|
-
exit
|
36
|
-
;;
|
37
|
-
* ) Help
|
38
|
-
exit 1
|
39
|
-
esac
|
40
|
-
shift
|
41
|
-
done
|
42
|
-
|
43
|
-
|
44
|
-
if [ -z $new_path ];
|
45
|
-
then
|
46
|
-
echo -e "\e[31mArgument -n | --new_path is mandatory\e[0m"
|
47
|
-
exit 1
|
48
|
-
fi
|
49
|
-
|
50
|
-
if [ -z $current_path ];
|
51
|
-
then
|
52
|
-
echo -e "\e[32mArgument -c | --current_path not defined. Plugin installation skipped.\e[0m"
|
53
|
-
exit
|
54
|
-
fi
|
5
|
+
on roles(:app) do
|
6
|
+
info "Check file #{release_path}/plugins.json"
|
7
|
+
if (test("[ -f #{release_path}/plugins.json ]"))
|
8
|
+
debug "#{release_path}/plugins.json exist"
|
9
|
+
pluginsStr = capture("cat #{release_path}/plugins.json")
|
10
|
+
jsonPlugins = JSON.parse(pluginsStr)
|
11
|
+
end
|
12
|
+
|
13
|
+
if(test("[ -L #{current_path} ]"))
|
14
|
+
info "installing pluggins..."
|
15
|
+
installedPlugins = capture("/usr/bin/env php /tmp/wp-cli.phar plugin list --path=#{current_path} |awk '{ print $1 }'")
|
16
|
+
installedPluginsArr = installedPlugins.to_s.gsub(/\n/, '|').split("|")
|
17
|
+
installedPluginsStatus = capture("/usr/bin/env php /tmp/wp-cli.phar plugin list --path=#{current_path} |awk '{ print $2 }'")
|
18
|
+
installedPluginsStatusArr = installedPluginsStatus.to_s.gsub(/\n/, '|').split("|")
|
19
|
+
installedPluginsVersion = capture("/usr/bin/env php /tmp/wp-cli.phar plugin list --path=#{current_path} |awk '{ print $4 }'")
|
20
|
+
installedPluginsVersionArr = installedPluginsVersion.to_s.gsub(/\n/, '|').split("|")
|
21
|
+
|
22
|
+
plugins = [];
|
23
|
+
|
24
|
+
installedPluginsArr.each_with_index do |plugin, index|
|
25
|
+
if(index == 0)
|
26
|
+
next
|
27
|
+
end
|
28
|
+
pluginInfo = {:slug => plugin, :version => installedPluginsVersionArr[index], :status => installedPluginsStatusArr[index] }
|
29
|
+
plugins.push(pluginInfo)
|
30
|
+
end
|
55
31
|
|
56
|
-
|
32
|
+
jsonPlugins.each do |plugin, version|
|
33
|
+
plugginInfo = plugins.detect {|f| f["slug"] == plugin }
|
34
|
+
if(plugginInfo)
|
35
|
+
plugginInfo[:version] = version
|
36
|
+
else
|
37
|
+
pluginInfo = {:slug => plugin, :version => version, :status => "active" }
|
38
|
+
plugins.push(pluginInfo)
|
39
|
+
end
|
40
|
+
end
|
57
41
|
|
58
|
-
|
42
|
+
plugins.each do |plugin|
|
43
|
+
existingPlugins = capture("/usr/bin/env php /tmp/wp-cli.phar plugin search #{plugin[:slug]} --path=#{release_path} --field=slug --per-page=999999")
|
44
|
+
if (existingPlugins.to_s.gsub(/\n/, '|').split("|").include?("#{plugin[:slug]}") == false)
|
45
|
+
warn "Pluggin #{plugin[:slug]} not known in wordpress repository. skip installation"
|
46
|
+
next
|
47
|
+
end
|
59
48
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
/usr/local/bin/php /tmp/wp-cli.phar plugin deactivate ${plugins[i]} --path=$new_path
|
73
|
-
fi
|
74
|
-
done
|
75
|
-
BASH
|
76
|
-
upload! StringIO.new(bashScript), "/tmp/install_plugins.sh"
|
77
|
-
if(File.exist?("#{release_path}/plugins.json"))
|
78
|
-
then plugins = JSON.parse(File.read("#{release_path}/plugins.json"))
|
49
|
+
info "install #{plugin[:slug]}:#{plugin[:version]}"
|
50
|
+
execute "/usr/bin/env php /tmp/wp-cli.phar plugin install #{plugin[:slug]} --path=#{release_path} --version=#{plugin[:version]}"
|
51
|
+
end
|
52
|
+
plugins.each do |plugin|
|
53
|
+
if (plugin[:status] == "active")
|
54
|
+
execute "/usr/bin/env php /tmp/wp-cli.phar plugin activate #{plugin[:slug]} --path=#{release_path}"
|
55
|
+
info "activate #{plugin}"
|
56
|
+
else
|
57
|
+
execute "/usr/bin/env php /tmp/wp-cli.phar plugin deactivate #{plugin[:slug]} --path=#{release_path}"
|
58
|
+
info "deactivate #{plugin[:slug]}"
|
59
|
+
end
|
60
|
+
end
|
79
61
|
end
|
80
|
-
execute "/bin/bash /tmp/install_plugins.sh -c \"#{current_path}\" -n #{release_path} -p #{plugins}"
|
81
62
|
end
|
82
63
|
end
|
83
|
-
end
|
64
|
+
end
|
@@ -2,5 +2,5 @@
|
|
2
2
|
before 'deploy:check:linked_files', 'wp-capistrano:create_wp_config'
|
3
3
|
before 'deploy:updating', 'wp-capistrano:download_wordpress'
|
4
4
|
after 'wp-capistrano:download_wordpress', 'wp-capistrano:install_wordpress'
|
5
|
-
after 'wp-capistrano:
|
6
|
-
after '
|
5
|
+
after 'wp-capistrano:install_wordpress', 'wp-capistrano:update_wordpress'
|
6
|
+
after 'deploy:updating', 'wp-capistrano:install_plugins'
|
data/wp-capistrano.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'wp-capistrano3'
|
7
|
-
spec.version = '0.0.
|
7
|
+
spec.version = '0.0.12'
|
8
8
|
spec.authors = ['Nicolas RENAULT']
|
9
9
|
spec.email = ['nrenault@tangkoko.com']
|
10
10
|
spec.description = %q{Wordpress tasks for Capistrano 3.x}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wp-capistrano3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas RENAULT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|