updated pod + tests
Brian Cassidy [Tue, 23 May 2006 12:59:48 +0000 (12:59 +0000)]
19 files changed:
MANIFEST
lib/Catalyst/Plugin/ConfigLoader/INI.pm
lib/Catalyst/Plugin/ConfigLoader/JSON.pm
lib/Catalyst/Plugin/ConfigLoader/Perl.pm
lib/Catalyst/Plugin/ConfigLoader/YAML.pm
t/01-use.t
t/10-live_auto.t
t/50-general.t [new file with mode: 0644]
t/51-ini.t [new file with mode: 0644]
t/52-json.t [new file with mode: 0644]
t/53-perl.t [new file with mode: 0644]
t/54-xml.t [new file with mode: 0644]
t/55-yaml.t [new file with mode: 0644]
t/conf/conf.general [new file with mode: 0644]
t/conf/conf.ini [new file with mode: 0644]
t/conf/conf.json [new file with mode: 0644]
t/conf/conf.pl [new file with mode: 0644]
t/conf/conf.xml [new file with mode: 0644]
t/conf/conf.yml [new file with mode: 0644]

index cba3554..de5b36b 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -11,8 +11,20 @@ MANIFEST
 META.yml\r
 t/01-use.t\r
 t/10-live_auto.t\r
+t/50-general.t\r
+t/51-ini.t\r
+t/52-json.t\r
+t/53-perl.t\r
+t/54-xml.t\r
+t/55-yaml.t\r
 t/98-pod_coverage.t\r
 t/99-pod.t\r
+t/conf/conf.general\r
+t/conf/conf.ini\r
+t/conf/conf.json\r
+t/conf/conf.pl\r
+t/conf/conf.xml\r
+t/conf/conf.yml\r
 t/lib/TestApp.pm\r
 t/lib/TestApp/testapp.pl\r
 t/lib/TestApp/Controller/Config.pm\r
index f254e86..9c24cab 100644 (file)
@@ -15,6 +15,9 @@ Loads INI files. Example:
     \r
     [Controller::Foo]\r
     foo=bar\r
+    \r
+    [Model::Baz]\r
+    qux=xyzzy\r
 \r
 =head1 METHODS\r
 \r
index 3a8b539..1c100ce 100644 (file)
@@ -15,6 +15,9 @@ Loads JSON files. Example:
         "name": "TestApp",\r
         "Controller::Foo": {\r
             "foo": "bar"\r
+        },\r
+        "Model::Baz": {\r
+            "qux": "xyzzy"\r
         }\r
     }\r
 \r
index 6cfec00..5796dfd 100644 (file)
@@ -15,6 +15,9 @@ Loads Perl files. Example:
         name => 'TestApp',\r
         Controller::Foo => {\r
             foo => 'bar'\r
+        },\r
+        Model::Baz => {\r
+            qux => 'xyzzy'\r
         }\r
     }\r
 \r
index 3e521ff..f1e6a86 100644 (file)
@@ -15,6 +15,9 @@ Loads YAML files. Example:
     name: TestApp\r
     Controller::Foo:\r
         foo: bar\r
+    Model::Baz:\r
+        qux: xyzzy\r
+    \r
 \r
 =head1 METHODS\r
 \r
index 0399513..322f0ef 100644 (file)
@@ -1,10 +1,10 @@
 use Test::More tests => 6;\r
 \r
 BEGIN { \r
-       use_ok( 'Catalyst::Plugin::ConfigLoader' );\r
-       use_ok( 'Catalyst::Plugin::ConfigLoader::INI' );\r
-       use_ok( 'Catalyst::Plugin::ConfigLoader::JSON' );\r
-       use_ok( 'Catalyst::Plugin::ConfigLoader::Perl' );\r
-       use_ok( 'Catalyst::Plugin::ConfigLoader::XML' );\r
-       use_ok( 'Catalyst::Plugin::ConfigLoader::YAML' );\r
+    use_ok( 'Catalyst::Plugin::ConfigLoader' );\r
+    use_ok( 'Catalyst::Plugin::ConfigLoader::INI' );\r
+    use_ok( 'Catalyst::Plugin::ConfigLoader::JSON' );\r
+    use_ok( 'Catalyst::Plugin::ConfigLoader::Perl' );\r
+    use_ok( 'Catalyst::Plugin::ConfigLoader::XML' );\r
+    use_ok( 'Catalyst::Plugin::ConfigLoader::YAML' );\r
 }\r
index e497bff..e0be92f 100644 (file)
@@ -13,9 +13,9 @@ use Catalyst::Test 'TestApp';
     ok( $response = request('http://localhost/config/'), 'request ok' );\r
     is( $response->content, 'foo', 'config ok' );\r
 \r
-       $response = request('http://localhost/appconfig/cache');\r
-       ok( $response->content !~ /^__HOME__/, 'home dir substituted in config var' );\r
+    $response = request('http://localhost/appconfig/cache');\r
+    ok( $response->content !~ /^__HOME__/, 'home dir substituted in config var' );\r
 \r
-       $response = request('http://localhost/appconfig/foo');\r
-       is( $response->content, 'bar', 'app finalize_config works' );\r
+    $response = request('http://localhost/appconfig/foo');\r
+    is( $response->content, 'bar', 'app finalize_config works' );\r
 }\r
diff --git a/t/50-general.t b/t/50-general.t
new file mode 100644 (file)
index 0000000..c308c3f
--- /dev/null
@@ -0,0 +1,11 @@
+use Test::More tests => 2;\r
+\r
+use Catalyst::Plugin::ConfigLoader::General;\r
+\r
+my $config = eval { Catalyst::Plugin::ConfigLoader::General->load( 't/conf/conf.general' ) };\r
+\r
+SKIP: {\r
+    skip "Couldn't Load Config::General plugin", 2 if $@;\r
+    ok( $config );\r
+    is( $config->{ name }, 'TestApp' );\r
+}\r
diff --git a/t/51-ini.t b/t/51-ini.t
new file mode 100644 (file)
index 0000000..ad88549
--- /dev/null
@@ -0,0 +1,11 @@
+use Test::More tests => 2;\r
+\r
+use Catalyst::Plugin::ConfigLoader::INI;\r
+\r
+my $config = eval { Catalyst::Plugin::ConfigLoader::INI->load( 't/conf/conf.ini' ) };\r
+\r
+SKIP: {\r
+    skip "Couldn't Load INI plugin", 2 if $@;\r
+    ok( $config );\r
+    is( $config->{ name }, 'TestApp' );\r
+}
\ No newline at end of file
diff --git a/t/52-json.t b/t/52-json.t
new file mode 100644 (file)
index 0000000..2481d05
--- /dev/null
@@ -0,0 +1,11 @@
+use Test::More tests => 2;\r
+\r
+use Catalyst::Plugin::ConfigLoader::JSON;\r
+\r
+my $config = eval { Catalyst::Plugin::ConfigLoader::JSON->load( 't/conf/conf.json' ) };\r
+\r
+SKIP: {\r
+    skip "Couldn't Load JSON plugin", 2 if $@;\r
+    ok( $config );\r
+    is( $config->{ name }, 'TestApp' );\r
+}\r
diff --git a/t/53-perl.t b/t/53-perl.t
new file mode 100644 (file)
index 0000000..e3385b0
--- /dev/null
@@ -0,0 +1,11 @@
+use Test::More tests => 2;\r
+\r
+use Catalyst::Plugin::ConfigLoader::Perl;\r
+\r
+my $config = eval { Catalyst::Plugin::ConfigLoader::Perl->load( 't/conf/conf.pl' ) };\r
+\r
+SKIP: {\r
+    skip "Couldn't Load Perl plugin", 2 if $@;\r
+    ok( $config );\r
+    is( $config->{ name }, 'TestApp' );\r
+}\r
diff --git a/t/54-xml.t b/t/54-xml.t
new file mode 100644 (file)
index 0000000..8be701b
--- /dev/null
@@ -0,0 +1,11 @@
+use Test::More tests => 2;\r
+\r
+use Catalyst::Plugin::ConfigLoader::XML;\r
+\r
+my $config = eval { Catalyst::Plugin::ConfigLoader::XML->load( 't/conf/conf.xml' ) };\r
+\r
+SKIP: {\r
+    skip "Couldn't Load XML plugin", 2 if $@;\r
+    ok( $config );\r
+    is( $config->{ name }, 'TestApp' );\r
+}\r
diff --git a/t/55-yaml.t b/t/55-yaml.t
new file mode 100644 (file)
index 0000000..630d1f9
--- /dev/null
@@ -0,0 +1,11 @@
+use Test::More tests => 2;\r
+\r
+use Catalyst::Plugin::ConfigLoader::YAML;\r
+\r
+my $config = eval { Catalyst::Plugin::ConfigLoader::YAML->load( 't/conf/conf.yml' ) };\r
+\r
+SKIP: {\r
+    skip "Couldn't Load YAML plugin", 2 if $@;\r
+    ok( $config );\r
+    is( $config->{ name }, 'TestApp' );\r
+}\r
diff --git a/t/conf/conf.general b/t/conf/conf.general
new file mode 100644 (file)
index 0000000..3f22055
--- /dev/null
@@ -0,0 +1,7 @@
+name = TestApp\r
+<Component Controller::Foo>\r
+    foo bar\r
+</Component>\r
+<Model Baz>\r
+    qux xyzzy\r
+</Model>
\ No newline at end of file
diff --git a/t/conf/conf.ini b/t/conf/conf.ini
new file mode 100644 (file)
index 0000000..366619e
--- /dev/null
@@ -0,0 +1,7 @@
+name=TestApp\r
+    \r
+[Controller::Foo]\r
+foo=bar\r
+\r
+[Model::Baz]\r
+qux=xyzzy\r
diff --git a/t/conf/conf.json b/t/conf/conf.json
new file mode 100644 (file)
index 0000000..0afd4bd
--- /dev/null
@@ -0,0 +1,9 @@
+{\r
+    "name": "TestApp",\r
+    "Controller::Foo": {\r
+        "foo": "bar"\r
+    },\r
+    "Model::Baz": {\r
+        "qux": "xyzzy"\r
+    }\r
+}
\ No newline at end of file
diff --git a/t/conf/conf.pl b/t/conf/conf.pl
new file mode 100644 (file)
index 0000000..04707ad
--- /dev/null
@@ -0,0 +1,9 @@
+{\r
+    name => 'TestApp',\r
+    Controller::Foo => {\r
+        foo => 'bar'\r
+    },\r
+    Model::Baz => {\r
+        qux => 'xyzzy'\r
+    }\r
+}
\ No newline at end of file
diff --git a/t/conf/conf.xml b/t/conf/conf.xml
new file mode 100644 (file)
index 0000000..c9f49ca
--- /dev/null
@@ -0,0 +1,9 @@
+<config>\r
+    <name>TestApp</name>\r
+    <component name="Controller::Foo">\r
+        <foo>bar</foo>\r
+    </component>\r
+    <model name="Baz">\r
+        <qux>xyzzy</qux>\r
+    </model>\r
+</config>
\ No newline at end of file
diff --git a/t/conf/conf.yml b/t/conf/conf.yml
new file mode 100644 (file)
index 0000000..018d216
--- /dev/null
@@ -0,0 +1,6 @@
+---\r
+name: TestApp\r
+Controller::Foo:\r
+    foo: bar\r
+Model::Baz:\r
+    qux: xyzzy\r