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