Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Compat with mojo 5.0 + README.md #4

Closed
wants to merge 8 commits into from

2 participants

This page is out of date. Refresh to see the latest.
Showing with 60 additions and 2 deletions.
  1. +50 −0 README.md
  2. +10 −2 t/30-yaml_config_lite_app.t
View
50 README.md
@@ -0,0 +1,50 @@
+# NAME
+
+Mojolicious::Plugin::YamlConfig - YAML Configuration Plugin
+
+# SYNOPSIS
+
+ # myapp.yaml
+ --
+ foo: "bar"
+ music_dir: "<%= app->home->rel_dir('music') %>"
+
+ # Mojolicious
+ $self->plugin('yaml_config');
+
+ # Mojolicious::Lite
+ plugin 'yaml_config';
+
+ # Reads myapp.yaml by default and puts the parsed version into the stash
+ my $config = $self->stash('config');
+
+ # Everything can be customized with options
+ plugin yaml_config => {
+ file => '/etc/myapp.conf',
+ stash_key => 'conf',
+ class => 'YAML::XS'
+ };
+
+# DESCRIPTION
+
+Look at Mojolicious::Plugin::JSONConfig and replace "JSONConfig" with
+"yaml_config" and you should be fine. :)
+
+# LIMITATIONS
+
+YAML::Tiny is the default parser. It doesn't even try to implement the
+full YAML spec. Currently you can use YAML::XS, YAML::Old and YAML via
+the "class" option to parse the data with a more advanced YAML parser.
+
+# AUTHOR
+
+Danijel Tasov <data@cpan.org>
+
+# SEE ALSO
+
+[Mojolicious](https://metacpan.org/pod/Mojolicious)
+
+[Mojolicious::Plugin::JSONConfig](https://metacpan.org/pod/Mojolicious::Plugin::JSONConfig)
+
+[Mojolicious::Guides](https://metacpan.org/pod/Mojolicious::Guides)
+
View
12 t/30-yaml_config_lite_app.t
@@ -13,10 +13,18 @@ BEGIN { $ENV{MOJO_POLL} = $ENV{MOJO_NO_IPV6} = 1 }
use Mojo::IOLoop;
use Test::More;
+use Mojolicious;
# Make sure sockets are working
-plan skip_all => 'working sockets required for this test!'
- unless Mojo::IOLoop->new->generate_port;
+my $mojo_version = $Mojolicious::VERSION;
+if ( $mojo_version < 5.0 ) {
+ plan skip_all => 'working sockets required for this test!'
+ unless Mojo::IOLoop->new->generate_port;
+}
+else {
+ plan skip_all => 'working sockets required for this test!'
+ unless Mojo::IOLoop::Server->new->generate_port;
+}
plan tests => 12;
# Oh, I always feared he might run off like this.
Something went wrong with that request. Please try again.