wp-capistrano3 0.0.5 → 0.0.10
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 +4 -4
- data/README.md +18 -0
- data/lib/capistrano/tasks/install_plugins.rake +57 -68
- data/lib/capistrano/wp-capistrano.rb +0 -1
- data/lib/capistrano/wp-capistrano/defaults.rb +2 -3
- data/wp-capistrano.gemspec +1 -1
- metadata +2 -4
- data/lib/capistrano/Rakefile +0 -1
- data/lib/capistrano/tasks/deploy-theme.rake +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 263a4ead8871a0d4cc8eecc3d392a0f3dfe4eeafc07a6449813d0f0e3387a3a9
|
4
|
+
data.tar.gz: 829b6c086104992b75220d2feee2e4cc737e785a4e265365f865cf57f6a3055f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6a1539259798412c14cb6b08d65d22625cb368559fff02ced34e62bc83c2c3b928801cc7a9c1a53a203830e1ddad7244efbfa93e1efff0be85e656e1b426d23
|
7
|
+
data.tar.gz: 71ac0c91fb2f3935f6c4e3bd82dd0dac7414df2e46d998e293e035ca97dcdef134b566c1b18c7a31809d5ec879479dc340a3fdcc9d069e232b4a633745873c62
|
data/README.md
CHANGED
@@ -18,6 +18,23 @@ Then run
|
|
18
18
|
bundle install
|
19
19
|
#or bundle update
|
20
20
|
```
|
21
|
+
set following variables in your deploy.rb
|
22
|
+
These variables will be used to generate wp_config.php at first deployment.
|
23
|
+
And will install an empty wordpress
|
24
|
+
```ruby
|
25
|
+
set :wp_db_name, "wp_db_name"
|
26
|
+
set :wp_db_password, "wp_db_password"
|
27
|
+
set :wp_db_user, "wp_db_user"
|
28
|
+
set :wp_db_host, "127.0.0.1"
|
29
|
+
#ADMIN LOCALE
|
30
|
+
set :wp_locale, "en_GB"
|
31
|
+
|
32
|
+
set :wp_url, "wp_domain"
|
33
|
+
set :wp_title, "wp site name"
|
34
|
+
set :wp_admin_user, "admin"
|
35
|
+
set :wp_admin_password, "password"
|
36
|
+
set :wp_admin_email, "admin@xxxx.com"
|
37
|
+
```
|
21
38
|
|
22
39
|
## Workflow
|
23
40
|
|
@@ -28,4 +45,5 @@ before 'deploy:check:linked_files', 'wp-capistrano:create_wp_config'
|
|
28
45
|
before 'deploy:updating', 'wp-capistrano:download_wordpress'
|
29
46
|
after 'wp-capistrano:download_wordpress', 'wp-capistrano:install_wordpress'
|
30
47
|
after 'wp-capistrano:download_wordpress', 'wp-capistrano:update_wordpress'
|
48
|
+
after 'wp-capistrano:install_wordpress', 'wp-capistrano:install_plugins'
|
31
49
|
```
|
@@ -1,75 +1,64 @@
|
|
1
|
+
require 'json'
|
1
2
|
namespace "wp-capistrano" do
|
2
3
|
desc 'Install wordpress plugins'
|
3
4
|
task :install_plugins do
|
4
|
-
on roles(:app) do
|
5
|
-
|
6
|
-
|
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
|
7
31
|
|
8
|
-
|
9
|
-
{
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
echo "-h | --help Print this Help."
|
18
|
-
echo "-v | --verbose Verbose mode."
|
19
|
-
echo
|
20
|
-
}
|
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 => "activate" }
|
38
|
+
plugins.push(pluginInfo)
|
39
|
+
end
|
40
|
+
end
|
21
41
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
new_path="$1"
|
29
|
-
;;
|
30
|
-
-h | --help ) Help
|
31
|
-
exit
|
32
|
-
;;
|
33
|
-
* ) Help
|
34
|
-
exit 1
|
35
|
-
esac
|
36
|
-
shift
|
37
|
-
done
|
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
|
38
48
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
plugins=($(/usr/local/bin/php /tmp/wp-cli.phar plugin list --path=$current_path |awk '{ print $1 }'))
|
55
|
-
nbPlugins=$((${#plugins[@]} - 1))
|
56
|
-
plugins_status=($(/usr/local/bin/php /tmp/wp-cli.phar plugin list --path=$current_path |awk '{ print $2 }'))
|
57
|
-
for i in `seq 1 $nbPlugins`;
|
58
|
-
do
|
59
|
-
/usr/local/bin/php /tmp/wp-cli.phar plugin install ${plugins[i]} --path=$new_path
|
60
|
-
echo /usr/local/bin/php /tmp/wp-cli.phar plugin install ${plugins[i]} --path=$new_path
|
61
|
-
if [ ${plugins_status[i]} = "active" ];
|
62
|
-
then
|
63
|
-
/usr/local/bin/php /tmp/wp-cli.phar plugin activate ${plugins[i]} --path=$new_path
|
64
|
-
else
|
65
|
-
/usr/local/bin/php /tmp/wp-cli.phar plugin deactivate ${plugins[i]} --path=$new_path
|
66
|
-
fi
|
67
|
-
done
|
68
|
-
BASH
|
69
|
-
|
70
|
-
upload! StringIO.new(bashScript), "/tmp/install_plugins.sh"
|
71
|
-
execute "/usr/local/bin/php -v"
|
72
|
-
execute "/bin/bash /tmp/install_plugins.sh -c \"#{current_path}\" -n #{release_path}"
|
73
|
-
end
|
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
|
61
|
+
end
|
62
|
+
end
|
74
63
|
end
|
75
|
-
end
|
64
|
+
end
|
@@ -2,6 +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 '
|
7
|
-
#before 'deploy:updated', 'wp-capistrano:deploy-theme'
|
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.10'
|
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.10
|
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-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -64,9 +64,7 @@ files:
|
|
64
64
|
- README.md
|
65
65
|
- Rakefile
|
66
66
|
- gemfile
|
67
|
-
- lib/capistrano/Rakefile
|
68
67
|
- lib/capistrano/tasks/create_wp_config.rake
|
69
|
-
- lib/capistrano/tasks/deploy-theme.rake
|
70
68
|
- lib/capistrano/tasks/download_wordpress.rake
|
71
69
|
- lib/capistrano/tasks/install_plugins.rake
|
72
70
|
- lib/capistrano/tasks/install_wordpress.rake
|
data/lib/capistrano/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
@@ -1,15 +0,0 @@
|
|
1
|
-
namespace "wp-capistrano" do
|
2
|
-
desc 'upload theme compiled files'
|
3
|
-
task :deploy-theme do
|
4
|
-
run_locally do
|
5
|
-
role_properties(:app) do |server|
|
6
|
-
ssh_options = server.ssh_options
|
7
|
-
fetch(:themes_to_deploy).each do |theme|
|
8
|
-
themesParentDir = theme.split("/")
|
9
|
-
themesParentDir.pop()
|
10
|
-
execute "scp -r -P #{server.ssh_options[:port]} #{ENV['SOURCE_PATH']}/#{theme} #{server.user}@#{server.hostname}:#{release_path}/#{themesParentDir.join("/")}"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|