broom 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +8 -4
- data/Rakefile +1 -1
- data/lib/broom.rb +3 -1
- metadata +6 -3
data/README.markdown
CHANGED
@@ -1,22 +1,26 @@
|
|
1
1
|
Broom
|
2
2
|
=====
|
3
|
-
A simple module to help monitor a directory for new files and perform an action
|
3
|
+
A simple module to help monitor a directory for new files and perform an action
|
4
4
|
on each new file. Broom periodically sweeps a directory, caching each file and its
|
5
5
|
last modification time. After each sweep, Broom iterates through the cache and
|
6
6
|
yields only the files that have a current modification time that matches the cached
|
7
7
|
modification time. In the event of an error, Broom gracefully sweeps
|
8
8
|
the file to a failure dustpan. Else, the file is swept to a success dustpan.
|
9
9
|
|
10
|
-
Broom depends on the following directory structure, which can be modified
|
10
|
+
Broom depends on the following directory structure, which can be modified
|
11
11
|
using the 'success_dir' and 'failure_dir' options.
|
12
12
|
|
13
13
|
/path/to/directory
|
14
14
|
/path/to/directory/_success
|
15
15
|
/path/to/directory/_failure
|
16
|
-
|
16
|
+
|
17
|
+
Installation
|
18
|
+
============
|
19
|
+
gem install broom
|
20
|
+
|
17
21
|
Examples
|
18
22
|
========
|
19
23
|
|
20
24
|
Broom.sweep('/tmp', :pattern => '*.pdf') do |file|
|
21
|
-
|
25
|
+
Resque.enqueue(Job, file)
|
22
26
|
end
|
data/Rakefile
CHANGED
data/lib/broom.rb
CHANGED
@@ -7,7 +7,7 @@ end
|
|
7
7
|
|
8
8
|
module Broom
|
9
9
|
|
10
|
-
VERSION = '0.3.
|
10
|
+
VERSION = '0.3.1'
|
11
11
|
|
12
12
|
class Directory
|
13
13
|
|
@@ -47,6 +47,8 @@ module Broom
|
|
47
47
|
begin
|
48
48
|
yield(file)
|
49
49
|
rescue Object => boom
|
50
|
+
puts "#{Time.now} : #{boom.class}: #{boom.message}"
|
51
|
+
puts boom.backtrace.join("\n")
|
50
52
|
FileUtils.mv(file, dir.failure_dir)
|
51
53
|
else
|
52
54
|
FileUtils.mv(file, dir.success_dir)
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: broom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 17
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 3
|
8
|
-
-
|
9
|
-
version: 0.3.
|
9
|
+
- 1
|
10
|
+
version: 0.3.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Daniel Johnston
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2011-01-08 00:00:00 -06:00
|
18
19
|
default_executable:
|
19
20
|
dependencies: []
|
20
21
|
|
@@ -45,6 +46,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
45
46
|
requirements:
|
46
47
|
- - ">="
|
47
48
|
- !ruby/object:Gem::Version
|
49
|
+
hash: 3
|
48
50
|
segments:
|
49
51
|
- 0
|
50
52
|
version: "0"
|
@@ -53,6 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
55
|
requirements:
|
54
56
|
- - ">="
|
55
57
|
- !ruby/object:Gem::Version
|
58
|
+
hash: 3
|
56
59
|
segments:
|
57
60
|
- 0
|
58
61
|
version: "0"
|