File: 12_plagger.t

package info (click to toggle)
libyaml-tiny-perl 1.51-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 380 kB
  • sloc: perl: 2,482; makefile: 45
file content (127 lines) | stat: -rw-r--r-- 2,262 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/perl

# Testing Plagger config samples from Miyagawa-san's YAPC::NA 2006 talk

use strict;
BEGIN {
	$|  = 1;
	$^W = 1;
}

use File::Spec::Functions ':ALL';
use t::lib::Test;
use Test::More tests(2);
use YAML::Tiny;





#####################################################################
# Example Plagger Configuration 1

yaml_ok(
	<<'END_YAML',
plugins:
  - module: Subscription::Bloglines
    config:
      username: you@example.pl
      password: foobar
      mark_read: 1

  - module: Publish::Gmail
    config:
      mailto: example@gmail.com
      mailfrom: miyagawa@example.com
      mailroute:
        via: smtp
        host: smtp.example.com
END_YAML
	[ { plugins => [
		{
			module => 'Subscription::Bloglines',
			config => {
				username  => 'you@example.pl',
				password  => 'foobar',
				mark_read => 1,
			},
		},
		{
			module => 'Publish::Gmail',
			config => {
				mailto    => 'example@gmail.com',
				mailfrom  => 'miyagawa@example.com',
				mailroute => {
					via  => 'smtp',
					host => 'smtp.example.com',
				},
			},
		},
	] } ],
	'Plagger',
);





#####################################################################
# Example Plagger Configuration 2

yaml_ok(
	<<'END_YAML',
plugins:
 - module: Subscription::Config
   config:
     feed:
        # Trac's feed for changesets
        - http://plagger.org/.../rss

 # I don't like to be notified of the same items
 # more than once
 - module: Filter::Rule
   rule:
     module: Fresh
     mtime:
       path: /tmp/rssbot.time
       autoupdate: 1

 - module: Notify::IRC
   config:
     daemon_port: 9999
     nickname: plaggerbot
     server_host: chat.freenode.net
     server_channels:
       - '#plagger-ja'
       - '#plagger'

   
END_YAML
	[ { plugins => [ {
		module => 'Subscription::Config',
		config => {
			feed => [ 'http://plagger.org/.../rss' ],
		},
	}, {
		module => 'Filter::Rule',
		rule   => {
			module => 'Fresh',
			mtime  => {
				path => '/tmp/rssbot.time',
				autoupdate => 1,
			},
		},
	}, {
		module => 'Notify::IRC',
		config => {
			daemon_port     => 9999,
			nickname        => 'plaggerbot',
			server_host     => 'chat.freenode.net',
			server_channels => [
				'#plagger-ja',
				'#plagger',
			],
		},
	} ] } ],
	'plagger2',
);