rservicebus 0.0.43 → 0.0.44
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rservicebus/ConfigureMonitor.rb +1 -1
- data/lib/rservicebus/Monitor/Dir.rb +28 -5
- metadata +2 -2
@@ -1,18 +1,34 @@
|
|
1
|
+
require 'cgi'
|
1
2
|
|
2
3
|
class Monitor_Dir<Monitor
|
3
4
|
|
4
5
|
@Path
|
5
|
-
|
6
|
+
@ArchiveDir
|
7
|
+
|
6
8
|
def connect(uri)
|
7
9
|
#Pass the path through the Dir object to check syntax on startup
|
8
10
|
inputDir = Dir.new( uri.path )
|
9
11
|
@Path = inputDir.path
|
12
|
+
|
13
|
+
return if uri.query.nil?
|
14
|
+
parts = CGI.parse(uri.query)
|
15
|
+
return if parts["archive"].nil?
|
16
|
+
|
17
|
+
archiveUri = URI.parse( parts["archive"][0] )
|
18
|
+
if !File.directory?( archiveUri.path ) then
|
19
|
+
puts "***** Archive file name templating not yet supported."
|
20
|
+
puts "***** Directory's only."
|
21
|
+
abort()
|
22
|
+
end
|
23
|
+
|
24
|
+
@ArchiveDir = archiveUri.path
|
25
|
+
|
10
26
|
end
|
11
|
-
|
27
|
+
|
12
28
|
def ProcessPath( path )
|
13
29
|
return IO.read( path )
|
14
30
|
end
|
15
|
-
|
31
|
+
|
16
32
|
def ProcessFile( file )
|
17
33
|
payload = self.ProcessPath( file )
|
18
34
|
|
@@ -23,9 +39,16 @@ class Monitor_Dir<Monitor
|
|
23
39
|
Dir.glob( "#{@Path}/*" ).each do |file|
|
24
40
|
self.ProcessFile( file )
|
25
41
|
|
26
|
-
|
42
|
+
if @ArchiveDir.nil? then
|
43
|
+
File.unlink( file )
|
44
|
+
else
|
45
|
+
basename = File.basename( file )
|
46
|
+
newFilePath = @ArchiveDir + "/" + basename + "." + DateTime.now.strftime( "%Y%m%d%H%M%S%L")
|
47
|
+
@Bus.log "Writing to archive, #{newFilePath}", true
|
48
|
+
File.rename( file, newFilePath )
|
49
|
+
end
|
27
50
|
end
|
28
51
|
|
29
52
|
end
|
30
|
-
|
53
|
+
|
31
54
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rservicebus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.44
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-03-
|
12
|
+
date: 2013-03-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby interpretation of NServiceBus
|
15
15
|
email: guy@guyirvine.com
|