findler 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +20 -8
- data/examples/find_exif_files +3 -3
- data/findler.gemspec +17 -19
- data/lib/findler.rb +2 -2
- data/lib/findler/version.rb +1 -1
- data/test/filters_test.rb +2 -2
- data/test/findler_test.rb +1 -1
- data/test/{test_helper.rb → minitest_helper.rb} +1 -8
- metadata +99 -103
data/README.md
CHANGED
@@ -96,8 +96,8 @@ require 'exiftoolr'
|
|
96
96
|
# Monkey-patch Filters to add our custom filter:
|
97
97
|
class Findler::Filters
|
98
98
|
def self.exif_only(children)
|
99
|
-
child_files = children.select{|ea|ea.file?}
|
100
|
-
child_dirs = children.select{|ea|ea.directory?}
|
99
|
+
child_files = children.select { |ea| ea.file? }
|
100
|
+
child_dirs = children.select { |ea| ea.directory? }
|
101
101
|
e = Exiftoolr.new(child_files)
|
102
102
|
e.files_with_results + child_dirs
|
103
103
|
end
|
@@ -117,13 +117,25 @@ f.add_filter(:exif_only)
|
|
117
117
|
* if you want to be notified when new directories are walked into, and you want to do a bulk operation within that directory,
|
118
118
|
this gives you that hook–-just remember to return the children array at the end of your block.
|
119
119
|
|
120
|
-
|
120
|
+
## Why can't ```filter_with``` be a proc?
|
121
121
|
|
122
|
-
Because procs and lambdas aren't Marshal
|
122
|
+
Because procs and lambdas aren't ```Marshal```able, and I didn't want to use something scary like ruby2ruby and eval.
|
123
123
|
|
124
124
|
## Changelog
|
125
125
|
|
126
|
-
|
127
|
-
*
|
128
|
-
|
129
|
-
|
126
|
+
### 0.0.5
|
127
|
+
* ```add_patterns``` and ```add_extensions``` take an array, not a glob
|
128
|
+
|
129
|
+
### 0.0.4
|
130
|
+
* Added custom filters for ```next_file()```
|
131
|
+
* Added singular aliases for ```add_extension``` and ```add_pattern```
|
132
|
+
|
133
|
+
### 0.0.3
|
134
|
+
* Switch to minitest
|
135
|
+
* Gemfile packaging fix
|
136
|
+
|
137
|
+
### 0.0.2
|
138
|
+
* Added scalable Bloom filter so ```Iterator#rescan``` is possible
|
139
|
+
|
140
|
+
### 0.0.1
|
141
|
+
* Support for ```Marshal```ing and simple filters
|
data/examples/find_exif_files
CHANGED
@@ -6,7 +6,7 @@ require 'findler'
|
|
6
6
|
|
7
7
|
class Findler::Filters
|
8
8
|
def self.with_exif(children)
|
9
|
-
child_files = children.select { |ea| ea.file? }
|
9
|
+
child_files = children.select { |ea| ea.file? }.collect { |ea| ea.to_s }
|
10
10
|
child_dirs = children.select { |ea| ea.directory? }
|
11
11
|
e = Exiftoolr.new(child_files)
|
12
12
|
good = e.files_with_results
|
@@ -16,12 +16,12 @@ class Findler::Filters
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
f = Findler.new(
|
19
|
+
f = Findler.new(".")
|
20
20
|
f.add_extensions ".jpg", ".jpeg", ".cr2", ".nef"
|
21
21
|
f.add_filter :with_exif
|
22
22
|
f.case_insensitive!
|
23
23
|
iter = f.iterator
|
24
24
|
|
25
25
|
while nxt = iter.next_file
|
26
|
-
puts "
|
26
|
+
puts "Found file with valid EXIF header: #{nxt}"
|
27
27
|
end
|
data/findler.gemspec
CHANGED
@@ -2,26 +2,24 @@
|
|
2
2
|
$:.push File.expand_path("../lib", __FILE__)
|
3
3
|
require "findler/version"
|
4
4
|
|
5
|
-
Gem::Specification.new do |
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "findler"
|
7
|
+
gem.version = Findler::VERSION
|
8
|
+
gem.authors = ["Matthew McEachen"]
|
9
|
+
gem.email = ["matthew+github@mceachen.org"]
|
10
|
+
gem.homepage = "https://github.com/mceachen/findler/"
|
11
|
+
gem.summary = %q{Findler is a stateful filesystem iterator}
|
12
|
+
gem.description = %q{Findler is designed for very large filesystem hierarchies,
|
13
13
|
where simple block processing, or returning an array of matches, just isn't feasible.
|
14
14
|
Usage instructions are available in the README.}
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
s.add_development_dependency "minitest-reporters"
|
26
|
-
s.add_dependency "bloomer"
|
16
|
+
gem.files = `git ls-files`.split("\n")
|
17
|
+
gem.test_files = `git ls-files -- {test,features}/*`.split("\n")
|
18
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
gem.add_development_dependency "rake"
|
21
|
+
gem.add_development_dependency "yard"
|
22
|
+
gem.add_development_dependency "minitest"
|
23
|
+
gem.add_development_dependency "minitest-reporters"
|
24
|
+
gem.add_dependency "bloomer"
|
27
25
|
end
|
data/lib/findler.rb
CHANGED
@@ -19,7 +19,7 @@ class Findler
|
|
19
19
|
@patterns ||= []
|
20
20
|
end
|
21
21
|
|
22
|
-
def add_patterns(
|
22
|
+
def add_patterns(patterns)
|
23
23
|
self.patterns += patterns
|
24
24
|
end
|
25
25
|
|
@@ -31,7 +31,7 @@ class Findler
|
|
31
31
|
add_pattern "*#{normalize_extension(extension)}"
|
32
32
|
end
|
33
33
|
|
34
|
-
def add_extensions(
|
34
|
+
def add_extensions(extensions)
|
35
35
|
extensions.each { |ea| add_extension(ea) }
|
36
36
|
end
|
37
37
|
|
data/lib/findler/version.rb
CHANGED
data/test/filters_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'minitest_helper'
|
2
2
|
|
3
3
|
describe Findler::Filters do
|
4
4
|
it "should preserve sort order with no result" do
|
@@ -12,4 +12,4 @@ describe Findler::Filters do
|
|
12
12
|
b = Findler::Filters.preserve_sort_by(a) { |ea| ea.to_i }
|
13
13
|
b.must_equal [1.1, 1.5, 1.3, 2.0, 3.5, 3.1]
|
14
14
|
end
|
15
|
-
end
|
15
|
+
end
|
data/test/findler_test.rb
CHANGED
@@ -5,14 +5,7 @@ require 'tmpdir'
|
|
5
5
|
require 'fileutils'
|
6
6
|
require 'findler'
|
7
7
|
|
8
|
-
MiniTest::
|
9
|
-
if ENV["RM_INFO"] || ENV["TEAMCITY_VERSION"]
|
10
|
-
MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMineReporter.new
|
11
|
-
elsif ENV['TM_PID']
|
12
|
-
MiniTest::Unit.runner.reporters << MiniTest::Reporters::RubyMateReporter.new
|
13
|
-
else
|
14
|
-
MiniTest::Unit.runner.reporters << MiniTest::Reporters::ProgressReporter.new
|
15
|
-
end
|
8
|
+
MiniTest::Reporters.use!
|
16
9
|
|
17
10
|
def with_tmp_dir(&block)
|
18
11
|
cwd = Dir.pwd
|
metadata
CHANGED
@@ -1,106 +1,105 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: findler
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 4
|
10
|
-
version: 0.0.4
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Matthew McEachen
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
type: :development
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
version: "0"
|
32
|
-
prerelease: false
|
12
|
+
date: 2012-12-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
33
15
|
name: rake
|
34
|
-
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
type: :development
|
37
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
38
17
|
none: false
|
39
|
-
requirements:
|
40
|
-
- -
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
|
44
|
-
- 0
|
45
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
46
23
|
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
47
31
|
name: yard
|
48
|
-
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
type: :development
|
51
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
52
33
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
|
58
|
-
- 0
|
59
|
-
version: "0"
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
60
39
|
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
61
47
|
name: minitest
|
62
|
-
|
63
|
-
- !ruby/object:Gem::Dependency
|
64
|
-
type: :development
|
65
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
66
49
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
|
71
|
-
|
72
|
-
- 0
|
73
|
-
version: "0"
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :development
|
74
55
|
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
75
63
|
name: minitest-reporters
|
76
|
-
|
77
|
-
- !ruby/object:Gem::Dependency
|
78
|
-
type: :runtime
|
79
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
80
65
|
none: false
|
81
|
-
requirements:
|
82
|
-
- -
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
|
85
|
-
|
86
|
-
- 0
|
87
|
-
version: "0"
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
88
71
|
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
89
79
|
name: bloomer
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
description: ! "Findler is designed for very large filesystem hierarchies,\n where
|
95
|
+
simple block processing, or returning an array of matches, just isn't feasible.\n
|
96
|
+
\ Usage instructions are available in the README."
|
97
|
+
email:
|
96
98
|
- matthew+github@mceachen.org
|
97
99
|
executables: []
|
98
|
-
|
99
100
|
extensions: []
|
100
|
-
|
101
101
|
extra_rdoc_files: []
|
102
|
-
|
103
|
-
files:
|
102
|
+
files:
|
104
103
|
- .gitignore
|
105
104
|
- .travis.yml
|
106
105
|
- Gemfile
|
@@ -116,42 +115,39 @@ files:
|
|
116
115
|
- lib/findler/version.rb
|
117
116
|
- test/filters_test.rb
|
118
117
|
- test/findler_test.rb
|
119
|
-
- test/
|
120
|
-
has_rdoc: true
|
118
|
+
- test/minitest_helper.rb
|
121
119
|
homepage: https://github.com/mceachen/findler/
|
122
120
|
licenses: []
|
123
|
-
|
124
121
|
post_install_message:
|
125
122
|
rdoc_options: []
|
126
|
-
|
127
|
-
require_paths:
|
123
|
+
require_paths:
|
128
124
|
- lib
|
129
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
126
|
none: false
|
131
|
-
requirements:
|
132
|
-
- -
|
133
|
-
- !ruby/object:Gem::Version
|
134
|
-
|
135
|
-
segments:
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
segments:
|
136
132
|
- 0
|
137
|
-
|
138
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
hash: -249993079478696622
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
135
|
none: false
|
140
|
-
requirements:
|
141
|
-
- -
|
142
|
-
- !ruby/object:Gem::Version
|
143
|
-
|
144
|
-
segments:
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
segments:
|
145
141
|
- 0
|
146
|
-
|
142
|
+
hash: -249993079478696622
|
147
143
|
requirements: []
|
148
|
-
|
149
|
-
|
150
|
-
rubygems_version: 1.6.2
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 1.8.23
|
151
146
|
signing_key:
|
152
147
|
specification_version: 3
|
153
148
|
summary: Findler is a stateful filesystem iterator
|
154
|
-
test_files:
|
149
|
+
test_files:
|
155
150
|
- test/filters_test.rb
|
156
151
|
- test/findler_test.rb
|
157
|
-
- test/
|
152
|
+
- test/minitest_helper.rb
|
153
|
+
has_rdoc:
|