capistrano-wp 0.4.10 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 98be3e324966ecf9c84649b23e8b54ad86767dfb
4
- data.tar.gz: fc2e875f93cfa6029b1e70472e9bc4fe49285e6c
3
+ metadata.gz: 147bfeb0ee55815c2458736e43b0efc700aff339
4
+ data.tar.gz: 27322fe3e00cb12a1a9d94438f2c1cf06af2494a
5
5
  SHA512:
6
- metadata.gz: 9a8b81e7f6cd17f17b092ad1fdcbbaec23893fa0705203d5682f8b02196e0529a1e7b19f7c355d5e35c3fd9568d3da27f0722d342fbb4ee29de98eeb39125578
7
- data.tar.gz: 07ccb73f9b3bd6090b1f11f8d9f5c5ec2c379b182bd1ef8e0f3080b5ba0f176159c7bad8d6e992cf9e8283f3dc4162c3c981ba0605190e1482a9739dbdad57e7
6
+ metadata.gz: 99bed1c708ae020cdecc6cdd3c257da94ad48a63aa9c8370e447a8504e10cfdda21ea6671048fd0d91e3fc4e10c9996b63cb93dc4126b98b80a6595ae375aa2a
7
+ data.tar.gz: cbef8e57a17e0e52bc8568f5ae03499647c39a5608b980727bdd9234b35143f94925f61fd92dbdfbd22e0d5d0cf39eb0c20974c0473c11752389184bfd1cbf6b
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.11
1
+ 0.5.0
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: capistrano-wp 0.4.10 ruby lib
5
+ # stub: capistrano-wp 0.5.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "capistrano-wp"
9
- s.version = "0.4.10"
9
+ s.version = "0.5.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Crowd Favorite"]
14
- s.date = "2014-09-23"
14
+ s.date = "2014-10-22"
15
15
  s.description = "Recipes for deploying and maintaining remote WordPress installations with\nCapistrano. Pulls in WordPress from SVN, optionally using a local or\nremote cache, and supports a number of common operations and tasks towards\nthe care and feeding of sites that may not be 100% maintained through\nversion control.\n"
16
16
  s.executables = ["capify-wp"]
17
17
  s.extra_rdoc_files = [
@@ -110,48 +110,57 @@ module CrowdFavorite::Tasks::LocalChanges
110
110
  set(:snapshot_force, true)
111
111
  snapshot
112
112
 
113
- # Hand-tooled diff-parsing - handles either shasum-style or ls -ld output
114
- # Hashes store filename => [host, host, host]
113
+ # Hand-tooled file diffs - handles either shasum-style or ls -ld output
114
+ # Hashes store filename => {host => hash, host => hash, host => hash}
115
115
  left = {}
116
116
  right = {}
117
117
  changed = {}
118
- run("diff " + default_hash_path + " " + snapshot_hash_path + " || true") do |channel, stream, data|
119
- data.each_line do |line|
120
- line.strip!
121
- if line.match(/^\s*[<>]/)
122
- parts = line.split(/\s+/)
123
- if hash_creation.match(/ls -ld/)
124
- # > -rw-rw-r-- 1 example example 41 Sep 19 14:58 index.php
125
- parts.slice!(0, 9)
126
- else
127
- # < 198ed94e9f1e5c69e159e8ba6d4420bb9c039715 index.php
128
- parts.slice!(0,2)
129
- end
130
118
 
131
- bucket = line.match(/^\s*</) ? left : right
132
- filename = parts.join('')
119
+ [default_hash_path, snapshot_hash_path].each do |hashpath|
120
+ Dir.mktmpdir do |hashdownload|
121
+ download(hashpath, File.join(hashdownload, "$CAPISTRANO:HOST$"))
122
+ Dir.foreach(hashdownload) do |servername|
123
+ if not File.directory?(File.join(hashdownload, servername)) then
124
+ File.open(File.join(hashdownload, servername)) do |serverfile|
125
+ serverfile.each_line do |line|
126
+ line.strip!
127
+ parts = line.split(/\s+/)
128
+ if hash_creation.match(/ls -ld/)
129
+ # -rw-rw-r-- 1 example example 41 Sep 19 14:58 index.php
130
+ hash_result = parts.slice!(0, 8)
131
+ else
132
+ # 198ed94e9f1e5c69e159e8ba6d4420bb9c039715 index.php
133
+ hash_result = parts.slice!(0, 1)
134
+ end
133
135
 
134
- bucket[filename] ||= []
135
- bucket[filename].push(channel[:host])
136
+ bucket = (hashpath == default_hash_path) ? left : right
137
+ filename = parts.join('')
138
+ bucket[filename] ||= {}
139
+ bucket[filename][servername] = hash_result
140
+ end
141
+ end
142
+ end
136
143
  end
137
144
  end
138
145
  end
146
+
139
147
  if !(left.empty? && right.empty?)
140
148
  left.each do |filename, servers|
141
149
  if right.has_key?(filename)
142
- servers.each do |host|
143
- if right[filename].delete(host)
144
- changed[filename] ||= []
145
- changed[filename].push(host)
146
- left[filename].delete(host)
150
+ servers.each do |host, hash_result|
151
+ right_hash_result = right[filename].delete(host)
152
+ if right_hash_result and right_hash_result != hash_result
153
+ changed[filename] ||= {}
154
+ changed[filename][host] = true
147
155
  end
156
+ left[filename].delete(host)
148
157
  end
149
-
150
158
  left.delete(filename) if left[filename].empty?
151
159
  right.delete(filename) if right[filename].empty?
152
160
  end
153
161
  end
154
162
  end
163
+
155
164
  excludes = fetch(:localchanges_excludes)
156
165
  excludes[:any] ||= []
157
166
  logger.important "Excluding from #{current_release}: #{excludes.inspect}"
@@ -160,6 +169,9 @@ module CrowdFavorite::Tasks::LocalChanges
160
169
  [[left, :deleted], [right, :created], [changed, :changed]].each do |filegroup, excluder|
161
170
  excludes[excluder] ||= []
162
171
  filegroup.each do |filename, servers|
172
+ if servers.respond_to? :keys
173
+ servers = servers.keys
174
+ end
163
175
  if excludes[excluder].detect {|f| f == filename or File.join(current_release, f) == filename} or
164
176
  excludes[:any].detect {|f| f == filename or File.join(current_release, f) == filename}
165
177
  found_exclusion = true
@@ -198,7 +210,7 @@ module CrowdFavorite::Tasks::LocalChanges
198
210
  if filename.start_with? current_release
199
211
  filename = thefile.slice(current_release.length..-1)
200
212
  end
201
- logger.important "#{File.basename filename} in #{File.dirname filename} (on #{servers.inspect})"
213
+ logger.important "#{File.basename filename} in #{File.dirname filename} (on #{servers.keys.inspect})"
202
214
  end
203
215
  end
204
216
  end
@@ -216,7 +228,7 @@ module CrowdFavorite::Tasks::LocalChanges
216
228
  logger.important "deleted: " + results[:left].inspect
217
229
  logger.important "created: " + results[:right].inspect
218
230
  logger.important "changed: " + results[:changed].inspect
219
- if results.has_key?[:excluded]
231
+ if results.has_key? :excluded
220
232
  logger.important "excluded: " + results[:excluded].inspect
221
233
  end
222
234
  return true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-wp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.10
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Crowd Favorite
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-23 00:00:00.000000000 Z
11
+ date: 2014-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano