adrian 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -61,7 +61,7 @@ module Adrian
61
61
 
62
62
  def items
63
63
  items = files.map { |file| FileItem.new(file) }
64
- items.reject! { |item| filter?(item) }
64
+ items.reject! { |item| !item.exist? || filter?(item) }
65
65
  items.sort_by(&:updated_at)
66
66
  end
67
67
 
@@ -1,6 +1,12 @@
1
1
  module Adrian
2
2
  class FileItem < QueueItem
3
3
 
4
+ def initialize(value, created_at = Time.now)
5
+ @value = value
6
+ @created_at = created_at
7
+ updated_at
8
+ end
9
+
4
10
  def path
5
11
  value
6
12
  end
@@ -27,7 +33,7 @@ module Adrian
27
33
  end
28
34
 
29
35
  def touch(updated_at = Time.new)
30
- @updated_at = nil
36
+ @updated_at = updated_at
31
37
  File.utime(updated_at, updated_at, path)
32
38
  end
33
39
 
@@ -1,3 +1,3 @@
1
1
  module Adrian
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
3
3
  end
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
 
6
6
  describe Adrian::DirectoryQueue do
7
7
  before do
8
- @q = Adrian::DirectoryQueue.create(:path => Dir.mktmpdir('dir_queue_test'))
8
+ @q = Adrian::DirectoryQueue.create(:path => Dir.mktmpdir('dir_queue_test'), :delay => 0)
9
9
  end
10
10
 
11
11
  after do
@@ -68,7 +68,7 @@ describe Adrian::DirectoryQueue do
68
68
 
69
69
  it 'touches the item' do
70
70
  @q.push(@item)
71
- now = Time.new - 100
71
+ now = Time.new + 100
72
72
  item = nil
73
73
  Time.stub(:new, now) { item = @q.pop }
74
74
 
@@ -28,9 +28,9 @@ describe Adrian::FileItem do
28
28
  describe 'updated_at' do
29
29
 
30
30
  it 'is nil when moved by another process' do
31
- File.unlink(@item.path)
32
- assert_equal false, @item.exist?
33
- assert_equal nil, @item.updated_at
31
+ item = Adrian::FileItem.new('moved/during/initialize')
32
+ assert_equal false, item.exist?
33
+ assert_equal nil, item.updated_at
34
34
  end
35
35
 
36
36
  it 'is cached' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adrian
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: