wp-capistrano3 0.0.4 → 0.0.5

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: 5179e44e2c944df4a90551c7360aa71be3e96aa137322496ee9407b5951086d4
4
- data.tar.gz: 853646832db6c551396c822c8f2a02c38345b4e1f9494fc8ecab89e7081b57de
3
+ metadata.gz: a8593a1a18682c86eb81ce1af3f9a5dc6e4187db0ff46cb133d5457a7b6c85f7
4
+ data.tar.gz: ac95853e70f624b9820105a9aaa7b2dd147d576d2103709e13864a6ca32f816e
5
5
  SHA512:
6
- metadata.gz: 9bf50a931e3fc2bee91a4d1fe08da852cf8698918cddc7ad50910d5da23fb5331816aa493215ed01a126a54d62884d1dc72ed1fe5163e37eba6566f76b23b81a
7
- data.tar.gz: 910752b6842817f2fe3b6af869654eb30e88dee84f46c7b6ca882533facddc8fed3a1f079ee5ff99f71b8e031b06d92087d71bec29c7d888e6bf19f79d149173
6
+ metadata.gz: c04c3109d03a94385b49f5b018a2634eb5664830138a8b4f13be58d991bfeb7e4aafdcd5b8b9711ee98c0290027de093d3392000168b4206b56d26decb006d44
7
+ data.tar.gz: 040c925479561eea944c090cacbf803b1448b51350bae6cdfc51b2b60b085d7bc99c616550c1c751310622a174da27ff7a5e169aabc98bb829163c21dcc35b8a
@@ -2,9 +2,9 @@ namespace "wp-capistrano" do
2
2
  desc 'Download wordpress'
3
3
  task :download_wordpress do
4
4
  on roles(:app) do
5
- execute "wget http://wordpress.org/latest.tar.gz -P /tmp/"
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
- execute "wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -P /tmp/"
7
+ execute "wget -N https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -P /tmp/"
8
8
  end
9
9
  end
10
10
  end
@@ -0,0 +1,75 @@
1
+ namespace "wp-capistrano" do
2
+ desc 'Install wordpress plugins'
3
+ task :install_plugins do
4
+ on roles(:app) do
5
+ bashScript = <<BASH
6
+ #!/bin/bash
7
+
8
+ Help()
9
+ {
10
+ # Display Help
11
+ echo "Download installed wordpress plugins"
12
+ echo
13
+ echo "Syntax: install_plugins [-c|n|h|v]"
14
+ echo "options:"
15
+ echo "-c | --current_path Current wordpress path."
16
+ echo "-n | --new_path Path of release currently in deployment."
17
+ echo "-h | --help Print this Help."
18
+ echo "-v | --verbose Verbose mode."
19
+ echo
20
+ }
21
+
22
+ while [ "$1" != "" ]; do
23
+ case $1 in
24
+ -c | --current_path ) shift
25
+ current_path="$1"
26
+ ;;
27
+ -n | --new_path ) shift
28
+ new_path="$1"
29
+ ;;
30
+ -h | --help ) Help
31
+ exit
32
+ ;;
33
+ * ) Help
34
+ exit 1
35
+ esac
36
+ shift
37
+ done
38
+
39
+
40
+ if [ -z $new_path ];
41
+ then
42
+ echo -e "\e[31mArgument -n | --new_path is mandatory\e[0m"
43
+ exit 1
44
+ fi
45
+
46
+ if [ -z $current_path ];
47
+ then
48
+ echo -e "\e[32mArgument -c | --current_path not defined. Plugin installation skipped.\e[0m"
49
+ exit
50
+ fi
51
+
52
+ echo -e "\e[32mInstalling plugins ...\e[0m"
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
74
+ end
75
+ end
@@ -1,5 +1,5 @@
1
1
  namespace "wp-capistrano" do
2
- desc 'Download wordpress'
2
+ desc 'Install wordpress'
3
3
  task :install_wordpress do
4
4
  on roles(:app), filter: :no_release do
5
5
  execute "rm #{shared_path}/wp-config.php"
@@ -3,7 +3,7 @@ load File.expand_path("../tasks/create_wp_config.rake", __FILE__)
3
3
  load File.expand_path("../tasks/download_wordpress.rake", __FILE__)
4
4
  load File.expand_path("../tasks/install_wordpress.rake", __FILE__)
5
5
  load File.expand_path("../tasks/update_wordpress.rake", __FILE__)
6
-
6
+ load File.expand_path("../tasks/install_plugins.rake", __FILE__)
7
7
 
8
8
  namespace :load do
9
9
  task :defaults do
@@ -2,5 +2,6 @@
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:download_wordpress', 'wp-capistrano:update_wordpress'
5
+ after 'wp-capistrano:download_wordpress', 'wp-capistrano:install_wordpress'
6
+ after 'wp-capistrano:install_wordpress', 'wp-capistrano:install_plugins'
6
7
  #before 'deploy:updated', 'wp-capistrano:deploy-theme'
@@ -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.4'
7
+ spec.version = '0.0.5'
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
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicolas RENAULT
@@ -68,6 +68,7 @@ files:
68
68
  - lib/capistrano/tasks/create_wp_config.rake
69
69
  - lib/capistrano/tasks/deploy-theme.rake
70
70
  - lib/capistrano/tasks/download_wordpress.rake
71
+ - lib/capistrano/tasks/install_plugins.rake
71
72
  - lib/capistrano/tasks/install_wordpress.rake
72
73
  - lib/capistrano/tasks/update_wordpress.rake
73
74
  - lib/capistrano/wp-capistrano.rb
@@ -93,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
94
  - !ruby/object:Gem::Version
94
95
  version: '0'
95
96
  requirements: []
96
- rubygems_version: 3.1.2
97
+ rubygems_version: 3.2.15
97
98
  signing_key:
98
99
  specification_version: 4
99
100
  summary: Wordpress tasks for Capistrano 3.x