wp-capistrano3 0.0.7 → 0.0.8

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: d1e6df5f94f90b486745d8351692c078263b21e7a3e9338ac2409b60e3633760
4
- data.tar.gz: 2458831aff2c7ae5a1e7b6d3d02b82280d3866f38ebd6d45ee7e4f1f29d1aa65
3
+ metadata.gz: 8336f903cfb0ee08f887749dbc3bae70459856b2cad5cf65821d03c824b6755c
4
+ data.tar.gz: d7a91a8b4fa05be0a02d7f4634b67cdc4b8056c6e1d15f1debbbf69d01c0cc56
5
5
  SHA512:
6
- metadata.gz: dd9508e405ec8a73d99d852939619034a7216e3a6b7d966814a54556301b075cca7fd7a4276b96a83e47e6b470e75590921073dfa5246dd7dd80fbf12a49fe2c
7
- data.tar.gz: f17e06bbeb8cbdeedf73c1e528c1c837e439abc68190e9d051476bb6501311b73776e7f1856b7195260fa0e8554d47c9f89f1f1ee217d72aa6b8744e2ffe49bc
6
+ metadata.gz: 880042cc2e3e98c4ec73c39a5ad298f585198f00c3361738ee6efd377f8668f6b5d3c3128eab36cde0f6714e06ba7a9ded03cd885d8d2bc84313dfc0bd3358c5
7
+ data.tar.gz: bab7bc9c4e5e78e509a1bd74fc305d5792fe14aa8d26f2ae0fdac3eac2014a87fa07df119bfeb8f7bfda160936b615cbeac13bf70ae6518afc7e028fadd128f2
@@ -53,8 +53,6 @@ then
53
53
  exit
54
54
  fi
55
55
 
56
- echo $plugins
57
-
58
56
  echo -e "\e[32mInstalling plugins ...\e[0m"
59
57
 
60
58
  plugins=($(/usr/local/bin/php /tmp/wp-cli.phar plugin list --path=$current_path |awk '{ print $1 }'))
@@ -73,11 +71,61 @@ do
73
71
  fi
74
72
  done
75
73
  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"))
74
+
75
+ info "Check file #{release_path}/plugins.json"
76
+ if (test("[ -f #{release_path}/plugins.json ]"))
77
+ debug "#{release_path}/plugins.json exist"
78
+ pluginsStr = capture("cat #{release_path}/plugins.json")
79
+ jsonPlugins = JSON.parse(pluginsStr)
80
+ end
81
+
82
+ if(test("[ -L #{current_path} ]"))
83
+ info "installing pluggins..."
84
+ installedPlugins = capture("/usr/local/bin/php /tmp/wp-cli.phar plugin list --path=#{current_path} |awk '{ print $1 }'")
85
+ installedPluginsArr = installedPlugins.to_s.gsub(/\n/, '|').split("|")
86
+ installedPluginsStatus = capture("/usr/local/bin/php /tmp/wp-cli.phar plugin list --path=#{current_path} |awk '{ print $2 }'")
87
+ installedPluginsStatusArr = installedPluginsStatus.to_s.gsub(/\n/, '|').split("|")
88
+ installedPluginsVersion = capture("/usr/local/bin/php /tmp/wp-cli.phar plugin list --path=#{current_path} |awk '{ print $4 }'")
89
+ installedPluginsVersionArr = installedPluginsVersion.to_s.gsub(/\n/, '|').split("|")
90
+
91
+ plugins = [];
92
+
93
+ installedPluginsArr.each_with_index do |plugin, index|
94
+ if(index == 0)
95
+ next
96
+ end
97
+ pluginInfo = {:slug => plugin, :version => installedPluginsVersionArr[index], :status => installedPluginsStatusArr[index] }
98
+ plugins.push(pluginInfo)
99
+ end
100
+
101
+ jsonPlugins.each do |plugin, version|
102
+ plugginInfo = plugins.detect {|f| f["slug"] == plugin }
103
+ if(plugginInfo)
104
+ plugginInfo[:version] = version
105
+ else
106
+ pluginInfo = {:slug => plugin, :version => version, :status => "activate" }
107
+ plugins.push(pluginInfo)
108
+ end
109
+ end
110
+
111
+ plugins.each do |plugin|
112
+ existingPlugins = capture("/usr/local/bin/php /tmp/wp-cli.phar plugin search #{plugin[:slug]} --path=#{release_path} --field=slug --per-page=999999")
113
+ if (existingPlugins.to_s.gsub(/\n/, '|').split("|").include?("#{plugin[:slug]}") == false)
114
+ warn "Pluggin #{plugin[:slug]} not known in wordpress repository. skip installation"
115
+ next
116
+ end
117
+
118
+ info "install #{plugin[:slug]}:#{plugin[:version]}"
119
+ execute "/usr/local/bin/php /tmp/wp-cli.phar plugin install #{plugin[:slug]} --path=#{release_path} --version=#{plugin[:version]}"
120
+ if (plugin[:status] == "active")
121
+ execute "/usr/local/bin/php /tmp/wp-cli.phar plugin activate #{plugin[:slug]} --path=#{release_path}"
122
+ info "activate #{plugin}"
123
+ else
124
+ execute "/usr/local/bin/php /tmp/wp-cli.phar plugin deactivate #{plugin[:slug]} --path=#{release_path}"
125
+ info "deactivate #{plugin[:slug]}"
126
+ end
127
+ end
79
128
  end
80
- execute "/bin/bash /tmp/install_plugins.sh -c \"#{current_path}\" -n #{release_path} -p #{plugins}"
81
129
  end
82
130
  end
83
131
  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:download_wordpress', 'wp-capistrano:install_wordpress'
6
- after 'wp-capistrano:install_wordpress', 'wp-capistrano:install_plugins'
5
+ after 'wp-capistrano:install_wordpress', 'wp-capistrano:update_wordpress'
6
+ after 'deploy:updating', 'wp-capistrano:install_plugins'
@@ -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'
7
+ spec.version = '0.0.8'
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.7
4
+ version: 0.0.8
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.2.15
95
+ rubygems_version: 3.1.2
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Wordpress tasks for Capistrano 3.x