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 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
- ### Why can't ```filter_with``` be a proc?
120
+ ## Why can't ```filter_with``` be a proc?
121
121
 
122
- Because procs and lambdas aren't Marshal-able, and I didn't want to use something scary like ruby2ruby and eval.
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
- * 0.0.4 Added custom filters for ```next_file()``` and singular aliases for ```add_extension``` and ```add_pattern```
127
- * 0.0.3 Fixed gemfile packaging
128
- * 0.0.2 Added scalable Bloom filter so ```Iterator#rescan``` is possible
129
- * 0.0.1 First `find`
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
@@ -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(ENV['HOME'])
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 "next file: #{nxt}"
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 |s|
6
- s.name = "findler"
7
- s.version = Findler::VERSION
8
- s.authors = ["Matthew McEachen"]
9
- s.email = ["matthew+github@mceachen.org"]
10
- s.homepage = "https://github.com/mceachen/findler/"
11
- s.summary = %q{Findler is a stateful filesystem iterator}
12
- s.description = %q{Findler is designed for very large filesystem hierarchies,
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
- s.rubyforge_project = "findler"
17
-
18
- s.files = `git ls-files`.split("\n")
19
- s.test_files = `git ls-files -- {test,test,features}/*`.split("\n")
20
- s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
- s.require_paths = ["lib"]
22
- s.add_development_dependency "rake"
23
- s.add_development_dependency "yard"
24
- s.add_development_dependency "minitest"
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(*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(*extensions)
34
+ def add_extensions(extensions)
35
35
  extensions.each { |ea| add_extension(ea) }
36
36
  end
37
37
 
@@ -1,3 +1,3 @@
1
1
  class Findler
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/test/filters_test.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'test_helper'
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
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require 'minitest_helper'
2
2
 
3
3
  class Findler::Filters
4
4
  def self.non_empty_files(children)
@@ -5,14 +5,7 @@ require 'tmpdir'
5
5
  require 'fileutils'
6
6
  require 'findler'
7
7
 
8
- MiniTest::Unit.runner = MiniTest::SuiteRunner.new
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
- hash: 23
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
- date: 2012-03-28 00:00:00 -07:00
19
- default_executable:
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
- version_requirements: *id001
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
- hash: 3
43
- segments:
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
- version_requirements: *id002
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
- hash: 3
57
- segments:
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
- version_requirements: *id003
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
- hash: 3
71
- segments:
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
- version_requirements: *id004
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
- hash: 3
85
- segments:
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
- version_requirements: *id005
91
- description: |-
92
- Findler is designed for very large filesystem hierarchies,
93
- where simple block processing, or returning an array of matches, just isn't feasible.
94
- Usage instructions are available in the README.
95
- email:
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/test_helper.rb
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
- hash: 3
135
- segments:
127
+ requirements:
128
+ - - ! '>='
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ segments:
136
132
  - 0
137
- version: "0"
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
- hash: 3
144
- segments:
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ segments:
145
141
  - 0
146
- version: "0"
142
+ hash: -249993079478696622
147
143
  requirements: []
148
-
149
- rubyforge_project: findler
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/test_helper.rb
152
+ - test/minitest_helper.rb
153
+ has_rdoc: