ffilewatch 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/filewatch/watch.rb +16 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f676a022d59f3b2eaff4b98f1009235c30415b76
4
- data.tar.gz: 4eb6b4ae97db37102500968a429365b25ad6523e
3
+ metadata.gz: e4f2b8df761168ebf67eee7cef93d3f9aa4ee8bc
4
+ data.tar.gz: 2c5cc2a05ee5ca432fe7fbe6e3f25ae11897fa78
5
5
  SHA512:
6
- metadata.gz: 37db768459c9fdeca113bd204688b1d19fbe22e92aa573cc3750def2724db7ff849db9809e62de53d80faf367ad92ae664a98d34a5338d9f3af0755030818bd2
7
- data.tar.gz: 795ab6d6a1c79d55f71dc3cb104357caebf81bd038c29bce2bafff8b6cc410e316e0c456dac8ee5b04c1b88166160899ee87bbfc7cea1db3639c2bac0870c125
6
+ metadata.gz: a50d0e9fca7d1b86bc376b09c552fea749fc128db180556160cbe68f65bf195862373849616018fb855f001accffecdf871ec838d4bdbf00726109969ab29847
7
+ data.tar.gz: 9cf98aa71dd6edd08ed3eda7c1f3809a947ee14536c2b670e450dd81878a1fdf5e4c7cbff49e53ee850e9b30ff353f1447518b2fcabe7fef4eb7a7764de9b2dd
@@ -138,13 +138,7 @@ module FileWatch
138
138
 
139
139
  private
140
140
  def _discover_file(path, initial=false)
141
- globbed_dirs = Dir.glob(path)
142
- @logger.debug("_discover_file_glob: #{path}: glob is: #{globbed_dirs}")
143
- if globbed_dirs.empty? && File.file?(path)
144
- globbed_dirs = [path]
145
- @logger.debug("_discover_file_glob: #{path}: glob is: #{globbed_dirs} because glob did not work")
146
- end
147
- globbed_dirs.each do |file|
141
+ expand_glob(path).each do |file|
148
142
  next if @files.member?(file)
149
143
  next unless File.file?(file)
150
144
 
@@ -181,6 +175,21 @@ module FileWatch
181
175
  end
182
176
  end # def _discover_file
183
177
 
178
+
179
+ def expand_glob glob
180
+ dir_glob = File.dirname(glob)
181
+ file_glob = File.basename(glob)
182
+ files = []
183
+ Dir.glob(dir_glob).each do |dir|
184
+ Dir.foreach(dir) do |fname|
185
+ next if fname == '.' || fname == '..'
186
+ next unless File.fnmatch?(file_glob, fname)
187
+ files << File.join(dir, fname)
188
+ end
189
+ end
190
+ files
191
+ end
192
+
184
193
  public
185
194
  def quit
186
195
  @quit = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffilewatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Sissel
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-06 00:00:00.000000000 Z
12
+ date: 2014-08-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: buftok