right_data 0.5.7 → 0.5.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/main.rb +8 -4
- metadata +3 -3
data/lib/main.rb
CHANGED
@@ -47,6 +47,12 @@ require 'find'
|
|
47
47
|
module RightData
|
48
48
|
|
49
49
|
BLOCK_SIZE = 1024*8
|
50
|
+
IGNORE_FILES = [".DS_Store", ".typeAttributes.dict", "empty-file"]
|
51
|
+
def self.ignore_test(f)
|
52
|
+
IGNORE_FILES.include?(File.basename(f)) || (File.size(f) == 0) || # Ignore empty files
|
53
|
+
File.basename(f).downcase =~ /\.tmp$/ ||
|
54
|
+
File.basename(f).downcase =~ /\.swp$/
|
55
|
+
end
|
50
56
|
|
51
57
|
def self.each_set_of_duplicates(*paths, &block)
|
52
58
|
sizes = Hash.new {|h, k| h[k] = [] }
|
@@ -91,13 +97,11 @@ module RightData
|
|
91
97
|
return possible_duplicates
|
92
98
|
end
|
93
99
|
|
94
|
-
IGNORE_FILES = [".DS_Store", ".typeAttributes.dict", "empty-file"]
|
95
|
-
|
96
100
|
def self.index_by_size(*paths)
|
97
101
|
sizes = Hash.new {|h, k| h[k] = [] }
|
98
102
|
count = 0
|
99
103
|
Find.find(*paths) { |f|
|
100
|
-
sizes[File.size(f)] << f if File.file?(f) && !
|
104
|
+
sizes[File.size(f)] << f if File.file?(f) && !ignore_test(f)
|
101
105
|
count += 1
|
102
106
|
}
|
103
107
|
puts "Indexed #{count} files."
|
@@ -207,7 +211,7 @@ module RightData
|
|
207
211
|
tree.traverse do |n|
|
208
212
|
next true if File.directory?(n.path)
|
209
213
|
count += 1
|
210
|
-
if
|
214
|
+
if ignore_test(n.path)
|
211
215
|
n.ignorable = true
|
212
216
|
n.parent.increment_ignorable_children
|
213
217
|
else
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 5
|
9
|
-
-
|
10
|
-
version: 0.5.
|
9
|
+
- 8
|
10
|
+
version: 0.5.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonathan Siegel
|