wp-capistrano3 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/capistrano/tasks/install_plugins.rake +8 -77
- data/wp-capistrano.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f90a13a009316acd1bb220748d0cee8ed5d71adaa03408ce44f075426147929
|
4
|
+
data.tar.gz: c8c0ec23292987328b0d8b6f26380b0e48eddf37c78506b1e19807ca492e3bcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f7c94f2a02743ca55a064af5aa0ee9daf7056f8d240149baec9dd1162ff1d682e5a0fc87df936827ec4d37d394131bf769b0b42e59327aaad661bad8a1516cb
|
7
|
+
data.tar.gz: 6b2f5c85cc3b170ac51cc92e9dea627678f7a1ccfa7940259026ea05be232cc30c79e3cd9c05a3675aa0e3445c717350180eaf5e077f7ce0fe1f37569558f0ef
|
@@ -2,76 +2,7 @@ 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
|
-
bashScript = <<BASH
|
7
|
-
#!/bin/bash
|
8
|
-
|
9
|
-
Help()
|
10
|
-
{
|
11
|
-
# Display Help
|
12
|
-
echo "Download installed wordpress plugins"
|
13
|
-
echo
|
14
|
-
echo "Syntax: install_plugins [-c|n|h|v]"
|
15
|
-
echo "options:"
|
16
|
-
echo "-c | --current_path Current wordpress path."
|
17
|
-
echo "-n | --new_path Path of release currently in deployment."
|
18
|
-
echo "-h | --help Print this Help."
|
19
|
-
echo "-v | --verbose Verbose mode."
|
20
|
-
echo
|
21
|
-
}
|
22
|
-
|
23
|
-
while [ "$1" != "" ]; do
|
24
|
-
case $1 in
|
25
|
-
-c | --current_path ) shift
|
26
|
-
current_path="$1"
|
27
|
-
;;
|
28
|
-
-p | --plugins ) shift
|
29
|
-
plugins="$1"
|
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
|
55
|
-
|
56
|
-
echo -e "\e[32mInstalling plugins ...\e[0m"
|
57
|
-
|
58
|
-
plugins=($(/usr/local/bin/php /tmp/wp-cli.phar plugin list --path=$current_path |awk '{ print $1 }'))
|
59
|
-
nbPlugins=$((${#plugins[@]} - 1))
|
60
|
-
plugins_status=($(/usr/local/bin/php /tmp/wp-cli.phar plugin list --path=$current_path |awk '{ print $2 }'))
|
61
|
-
plugins_versions=($(/usr/local/bin/php /tmp/wp-cli.phar plugin list --path=$current_path |awk '{ print $4 }'))
|
62
|
-
for i in `seq 1 $nbPlugins`;
|
63
|
-
do
|
64
|
-
/usr/local/bin/php /tmp/wp-cli.phar plugin install ${plugins[i]} --path=$new_path --version=${plugins_versions[i]}
|
65
|
-
echo /usr/local/bin/php /tmp/wp-cli.phar plugin install ${plugins[i]} --path=$new_path
|
66
|
-
if [ ${plugins_status[i]} = "active" ];
|
67
|
-
then
|
68
|
-
/usr/local/bin/php /tmp/wp-cli.phar plugin activate ${plugins[i]} --path=$new_path
|
69
|
-
else
|
70
|
-
/usr/local/bin/php /tmp/wp-cli.phar plugin deactivate ${plugins[i]} --path=$new_path
|
71
|
-
fi
|
72
|
-
done
|
73
|
-
BASH
|
74
|
-
|
5
|
+
on roles(:app) do
|
75
6
|
info "Check file #{release_path}/plugins.json"
|
76
7
|
if (test("[ -f #{release_path}/plugins.json ]"))
|
77
8
|
debug "#{release_path}/plugins.json exist"
|
@@ -81,11 +12,11 @@ BASH
|
|
81
12
|
|
82
13
|
if(test("[ -L #{current_path} ]"))
|
83
14
|
info "installing pluggins..."
|
84
|
-
installedPlugins = capture("/usr/
|
15
|
+
installedPlugins = capture("/usr/bin/env php /tmp/wp-cli.phar plugin list --path=#{current_path} |awk '{ print $1 }'")
|
85
16
|
installedPluginsArr = installedPlugins.to_s.gsub(/\n/, '|').split("|")
|
86
|
-
installedPluginsStatus = capture("/usr/
|
17
|
+
installedPluginsStatus = capture("/usr/bin/env php /tmp/wp-cli.phar plugin list --path=#{current_path} |awk '{ print $2 }'")
|
87
18
|
installedPluginsStatusArr = installedPluginsStatus.to_s.gsub(/\n/, '|').split("|")
|
88
|
-
installedPluginsVersion = capture("/usr/
|
19
|
+
installedPluginsVersion = capture("/usr/bin/env php /tmp/wp-cli.phar plugin list --path=#{current_path} |awk '{ print $4 }'")
|
89
20
|
installedPluginsVersionArr = installedPluginsVersion.to_s.gsub(/\n/, '|').split("|")
|
90
21
|
|
91
22
|
plugins = [];
|
@@ -109,19 +40,19 @@ BASH
|
|
109
40
|
end
|
110
41
|
|
111
42
|
plugins.each do |plugin|
|
112
|
-
existingPlugins = capture("/usr/
|
43
|
+
existingPlugins = capture("/usr/bin/env php /tmp/wp-cli.phar plugin search #{plugin[:slug]} --path=#{release_path} --field=slug --per-page=999999")
|
113
44
|
if (existingPlugins.to_s.gsub(/\n/, '|').split("|").include?("#{plugin[:slug]}") == false)
|
114
45
|
warn "Pluggin #{plugin[:slug]} not known in wordpress repository. skip installation"
|
115
46
|
next
|
116
47
|
end
|
117
48
|
|
118
49
|
info "install #{plugin[:slug]}:#{plugin[:version]}"
|
119
|
-
execute "/usr/
|
50
|
+
execute "/usr/bin/env php /tmp/wp-cli.phar plugin install #{plugin[:slug]} --path=#{release_path} --version=#{plugin[:version]}"
|
120
51
|
if (plugin[:status] == "active")
|
121
|
-
execute "/usr/
|
52
|
+
execute "/usr/bin/env php /tmp/wp-cli.phar plugin activate #{plugin[:slug]} --path=#{release_path}"
|
122
53
|
info "activate #{plugin}"
|
123
54
|
else
|
124
|
-
execute "/usr/
|
55
|
+
execute "/usr/bin/env php /tmp/wp-cli.phar plugin deactivate #{plugin[:slug]} --path=#{release_path}"
|
125
56
|
info "deactivate #{plugin[:slug]}"
|
126
57
|
end
|
127
58
|
end
|
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.9'
|
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,7 +1,7 @@
|
|
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.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicolas RENAULT
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
94
|
requirements: []
|
95
|
-
rubygems_version: 3.
|
95
|
+
rubygems_version: 3.2.15
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: Wordpress tasks for Capistrano 3.x
|