adrian 1.3.3 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,6 +18,10 @@ module Adrian
18
18
  self
19
19
  end
20
20
 
21
+ def length
22
+ @mutex.synchronize { @array.size }
23
+ end
24
+
21
25
  protected
22
26
 
23
27
  def wrap_item(item)
@@ -43,6 +43,10 @@ module Adrian
43
43
  self
44
44
  end
45
45
 
46
+ def length
47
+ available_files.count { |file| File.file?(file) }
48
+ end
49
+
46
50
  def include?(value)
47
51
  item = wrap_item(value)
48
52
  items.include?(item)
@@ -83,7 +87,7 @@ module Adrian
83
87
  end
84
88
 
85
89
  def default_reserved_path
86
- File.join(File.dirname(@available_path), 'cur')
90
+ File.join(@available_path, 'cur')
87
91
  end
88
92
 
89
93
  end
@@ -41,5 +41,9 @@ module Adrian
41
41
  def push_item(item)
42
42
  raise "#{self.class.name}#push_item is not defined"
43
43
  end
44
+
45
+ def length
46
+ raise "#{self.class.name}#length is not defined"
47
+ end
44
48
  end
45
49
  end
@@ -1,3 +1,3 @@
1
1
  module Adrian
2
- VERSION = '1.3.3'
2
+ VERSION = '1.4.0'
3
3
  end
@@ -21,9 +21,13 @@ describe Adrian::ArrayQueue do
21
21
  q.push(2)
22
22
  q.push(3)
23
23
 
24
+ q.length.must_equal 3
25
+
24
26
  q.pop.value.must_equal 1
25
27
  q.pop.value.must_equal 2
26
28
  q.pop.value.must_equal 3
27
29
  q.pop.must_be_nil
30
+
31
+ q.length.must_equal 0
28
32
  end
29
33
  end
@@ -11,8 +11,8 @@ describe Adrian::DirectoryQueue do
11
11
  end
12
12
 
13
13
  after do
14
- FileUtils.rm_r(@q.available_path, :force => true)
15
- FileUtils.rm_r(@q.reserved_path, :force => true)
14
+ FileUtils.rm_r(@q.available_path, :force => true)
15
+ FileUtils.rm_r(@q.reserved_path, :force => true)
16
16
  end
17
17
 
18
18
  it 'should act as a queue for files' do
@@ -24,10 +24,14 @@ describe Adrian::DirectoryQueue do
24
24
  @q.push(item2)
25
25
  @q.push(item3)
26
26
 
27
+ @q.length.must_equal 3
28
+
27
29
  @q.pop.must_equal Adrian::FileItem.new(item1)
28
30
  @q.pop.must_equal Adrian::FileItem.new(item2)
29
31
  @q.pop.must_equal Adrian::FileItem.new(item3)
30
32
  @q.pop.must_be_nil
33
+
34
+ @q.length.must_equal 0
31
35
  end
32
36
 
33
37
  describe 'file backend' 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.3.3
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-29 00:00:00.000000000 Z
13
+ date: 2013-01-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rake
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  version: '0'
116
116
  requirements: []
117
117
  rubyforge_project:
118
- rubygems_version: 1.8.21
118
+ rubygems_version: 1.8.24
119
119
  signing_key:
120
120
  specification_version: 3
121
121
  summary: Adrian does not do any real work, but is really good at delegating it