This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
e2061be9fbff0173a90e670c1cf7421125b419f9
[perl5.git] / cpan / CPAN-Meta-YAML / t / 12_plagger.t
1 #!/usr/bin/perl
2
3 # Testing Plagger config samples from Miyagawa-san's YAPC::NA 2006 talk
4
5 use strict;
6 BEGIN {
7         $|  = 1;
8         $^W = 1;
9 }
10
11 use File::Spec::Functions ':ALL';
12 use t::lib::Test;
13 use Test::More tests(2);
14 use CPAN::Meta::YAML;
15
16
17
18
19
20 #####################################################################
21 # Example Plagger Configuration 1
22
23 yaml_ok(
24         <<'END_YAML',
25 plugins:
26   - module: Subscription::Bloglines
27     config:
28       username: you@example.pl
29       password: foobar
30       mark_read: 1
31
32   - module: Publish::Gmail
33     config:
34       mailto: example@gmail.com
35       mailfrom: miyagawa@example.com
36       mailroute:
37         via: smtp
38         host: smtp.example.com
39 END_YAML
40         [ { plugins => [
41                 {
42                         module => 'Subscription::Bloglines',
43                         config => {
44                                 username  => 'you@example.pl',
45                                 password  => 'foobar',
46                                 mark_read => 1,
47                         },
48                 },
49                 {
50                         module => 'Publish::Gmail',
51                         config => {
52                                 mailto    => 'example@gmail.com',
53                                 mailfrom  => 'miyagawa@example.com',
54                                 mailroute => {
55                                         via  => 'smtp',
56                                         host => 'smtp.example.com',
57                                 },
58                         },
59                 },
60         ] } ],
61         'Plagger',
62 );
63
64
65
66
67
68 #####################################################################
69 # Example Plagger Configuration 2
70
71 yaml_ok(
72         <<'END_YAML',
73 plugins:
74  - module: Subscription::Config
75    config:
76      feed:
77         # Trac's feed for changesets
78         - http://plagger.org/.../rss
79
80  # I don't like to be notified of the same items
81  # more than once
82  - module: Filter::Rule
83    rule:
84      module: Fresh
85      mtime:
86        path: /tmp/rssbot.time
87        autoupdate: 1
88
89  - module: Notify::IRC
90    config:
91      daemon_port: 9999
92      nickname: plaggerbot
93      server_host: chat.freenode.net
94      server_channels:
95        - '#plagger-ja'
96        - '#plagger'
97
98    
99 END_YAML
100         [ { plugins => [ {
101                 module => 'Subscription::Config',
102                 config => {
103                         feed => [ 'http://plagger.org/.../rss' ],
104                 },
105         }, {
106                 module => 'Filter::Rule',
107                 rule   => {
108                         module => 'Fresh',
109                         mtime  => {
110                                 path => '/tmp/rssbot.time',
111                                 autoupdate => 1,
112                         },
113                 },
114         }, {
115                 module => 'Notify::IRC',
116                 config => {
117                         daemon_port     => 9999,
118                         nickname        => 'plaggerbot',
119                         server_host     => 'chat.freenode.net',
120                         server_channels => [
121                                 '#plagger-ja',
122                                 '#plagger',
123                         ],
124                 },
125         } ] } ],
126         'plagger2',
127 );