wcc-filelog-notificator 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/wcc-filelog-notificator.rb +44 -0
- metadata +65 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
# Not needed:
|
3
|
+
#require 'wcc'
|
4
|
+
|
5
|
+
class FilelogNotificator
|
6
|
+
# wcc will create an instances of this class while reading the 'recipients'
|
7
|
+
# section of the configuration. If a recipient has 'filelog' as a way to
|
8
|
+
# notify her an instance will be created.
|
9
|
+
def initialize
|
10
|
+
end
|
11
|
+
|
12
|
+
# Will be called when wcc decides to notify a recipient.
|
13
|
+
def notify!(data)
|
14
|
+
# use the :filelog_file stored in the WCC::Conf
|
15
|
+
File.open(WCC::Conf[:filelog_file], 'a') do |f|
|
16
|
+
f.puts "#{data.site.uri.to_s} changed at #{Time.now.to_s}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# wcc will call this while reading the 'conf' section of the configuration.
|
21
|
+
# If there is a 'filelog' entry present the parameter hash (if any) will go here
|
22
|
+
# as conf parameter else it might be nil. This method is awaited to return a hash
|
23
|
+
# which's keys and values (if any) will be stored in WCC::Conf - prefix them!
|
24
|
+
def self.parse_conf(conf)
|
25
|
+
if conf.is_a?(Hash)
|
26
|
+
if conf['file'].nil?
|
27
|
+
WCC.logger.fatal "Missing file log location!"
|
28
|
+
else
|
29
|
+
return {
|
30
|
+
:filelog_file => conf['file']
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
# no defaults
|
35
|
+
{}
|
36
|
+
end
|
37
|
+
|
38
|
+
# wcc will call this directly before terminating the main program.
|
39
|
+
def self.shut_down; end
|
40
|
+
end
|
41
|
+
|
42
|
+
# Registers the FilelogNotificator class under name 'filelog' which makes wcc
|
43
|
+
# use this class whenever a 'filelog' is required.
|
44
|
+
WCC::Notificators.map "filelog", FilelogNotificator
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wcc-filelog-notificator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Christian Nicolai
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-10-22 00:00:00 Z
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description:
|
22
|
+
email: chrnicolai@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files: []
|
28
|
+
|
29
|
+
files:
|
30
|
+
- lib/wcc-filelog-notificator.rb
|
31
|
+
homepage: https://github.com/cmur2/wcc-filelog-notificator
|
32
|
+
licenses: []
|
33
|
+
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 0
|
47
|
+
version: "0"
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
hash: 3
|
54
|
+
segments:
|
55
|
+
- 0
|
56
|
+
version: "0"
|
57
|
+
requirements: []
|
58
|
+
|
59
|
+
rubyforge_project: wcc-filelog-notificator
|
60
|
+
rubygems_version: 1.8.6
|
61
|
+
signing_key:
|
62
|
+
specification_version: 3
|
63
|
+
summary: Filelog notificator plugin for wcc
|
64
|
+
test_files: []
|
65
|
+
|