dirmangle 0.0.1 → 0.0.2
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/bin/dirmangle +1 -31
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f165dd9ecfb428952708886eddb01d20d884d778
|
4
|
+
data.tar.gz: f4aaadfdc67cbb635ef7208e13fc2eade90f2118
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0fee6b084ffdf323559c300ba9e890273f80f638d9e2b2d8c4cc783c1445a93fddb4a6b3668f821040883eb7ce88a02c67768e63288024f0f4b4613cf7de895
|
7
|
+
data.tar.gz: cce0033ad3693ee8ceea357851e4cdbd8b2c7b3207f970fb0738ec1124df016c092beb951e09b6149d7957c110c8d295e874af915455412ac096076487dfff48
|
data/bin/dirmangle
CHANGED
@@ -163,6 +163,7 @@ class Dirmangle
|
|
163
163
|
destination = File.join(@destination_root, destination)
|
164
164
|
|
165
165
|
# add this path translation rule to the processing stack
|
166
|
+
Dirmangle.log("Adding source #{source}", :debug)
|
166
167
|
add_path(title, source, destination, config)
|
167
168
|
end
|
168
169
|
end
|
@@ -232,39 +233,8 @@ class Dirmangle
|
|
232
233
|
next
|
233
234
|
end
|
234
235
|
end
|
235
|
-
|
236
|
-
# prune empty directories from target
|
237
|
-
prune_empty_directories(@destination_root)
|
238
|
-
end
|
239
|
-
|
240
|
-
|
241
|
-
def prune_empty_directories(root, options={})
|
242
|
-
root = File.expand_path(root)
|
243
|
-
|
244
|
-
# proc for removing an empty directory
|
245
|
-
remover = Proc.new do |dir|
|
246
|
-
if File.directory?(dir)
|
247
|
-
if Dir.entries(dir).empty?
|
248
|
-
Dirmangle.log("Pruning empty directory #{dir}", :debug)
|
249
|
-
FileUtils.rmdir(dir, {
|
250
|
-
:noop => @options[:noop]
|
251
|
-
})
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end
|
255
|
-
|
256
|
-
# remove all empty subdirectories
|
257
|
-
Dir[File.join(root, '**', '*')].sort.reverse.each do |entry|
|
258
|
-
remover.call(entry)
|
259
|
-
end
|
260
|
-
|
261
|
-
# remove an empty root directory (if specified)
|
262
|
-
if options[:remove_root]
|
263
|
-
remover.call(root)
|
264
|
-
end
|
265
236
|
end
|
266
237
|
|
267
|
-
|
268
238
|
def add_path(rule, source, destination, options={})
|
269
239
|
# push a new path pair to have some operation performed upon it
|
270
240
|
if source && destination
|