Skip to content

Commit

Permalink
Update to Mojolicious 3.43
Browse files Browse the repository at this point in the history
  • Loading branch information
Akron committed Sep 26, 2012
1 parent 0244735 commit d64d49d
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 21 deletions.
3 changes: 3 additions & 0 deletions Changes
@@ -1,3 +1,6 @@
0.23 2012-09-26
- Update Sojolicious for Mojolicious 3.43.

0.22 2012-07-04
- Added 'on_oro_connect' event to M::P::Oro.
- Update Sojolicious for Mojolicious 3.0.
Expand Down
2 changes: 1 addition & 1 deletion Makefile.PL
Expand Up @@ -9,7 +9,7 @@ WriteMakefile(
NAME => 'Sojolicious',
AUTHOR => 'Nils Diewald',
PREREQ_PM => {
'Mojolicious' => 2.40,
'Mojolicious' => 3.43,
'DBIx::Oro' => 0.21
},
test => {TESTS => 't/*.t t/*/*.t t/*/*/*.t t/*/*/*/*.t'}
Expand Down
8 changes: 6 additions & 2 deletions lib/Mojolicious/Plugin/CHI.pm
Expand Up @@ -15,17 +15,21 @@ sub register {
};

# Hash of cache handles
my $caches = $mojo->attr('chi_handles');
my $caches;

# No databases attached
unless ($caches) {
unless ($mojo->can('chi_handles')) {
$caches = {};
$mojo->attr(
chi_handles => sub {
return $caches;
});
}
else {
$caches = $mojo->chi_handles;
};


# Init databases
Mojo::IOLoop->timer(
0 => sub {
Expand Down
9 changes: 6 additions & 3 deletions lib/Mojolicious/Plugin/Oro.pm
Expand Up @@ -15,15 +15,18 @@ sub register {
};

# Hash of database handles
my $databases = $mojo->attr('oro_handles');
my $databases;

# No databases attached
unless ($databases) {
unless ($mojo->can('oro_handles')) {
$databases = {};
$mojo->attr(
oro_handles => sub {
return $databases;
});
}
else {
$databases = $mojo->oro_handles;
};

# Add oro_init command
Expand All @@ -44,7 +47,7 @@ sub register {
%$db,
on_connect => sub {
my $oro = shift;
$mojo->log->info( 'Connect from ' . $$ );
$mojo->log->info( 'Connect ' . $name . ' from ' . $$ );

# Emit on_oro_connect hook
$mojo->plugins->emit_hook(
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Plugin/Oro/oro_init.pm
Expand Up @@ -25,7 +25,7 @@ sub run {

my $app = $self->app;

my $databases = $app->attr('oro_handles') || {};
my $databases = $app->can('oro_handles') ? $app->oro_handles : {};

@ARGV = keys %$databases unless @ARGV;

Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Plugin/PubSubHubbub.pm
Expand Up @@ -8,10 +8,10 @@ use constant ATOM_NS => 'http://www.w3.org/2005/Atom';

# Todo: Support Link-Headers for discovery-Method,
# when subscribing to html, rss without hub etc.

# Test with http://push-pub.appspot.com/

# Default lease seconds before automatic subscription refreshing
has 'lease_seconds' => ( 30 * 24 * 60 * 60 );
has lease_seconds => ( 30 * 24 * 60 * 60 );
has 'hub';

# Character set for challenge
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojolicious/Plugin/Util/Endpoint/endpoints.pm
@@ -1,5 +1,5 @@
package Mojolicious::Plugin::Util::Endpoint::endpoints;
use Mojo::Base 'Mojo::Command';
use Mojo::Base 'Mojolicious::Command';

use Getopt::Long qw/GetOptions :config no_auto_abbrev no_ignore_case/;

Expand Down
8 changes: 4 additions & 4 deletions t/HostMeta.t
Expand Up @@ -4,7 +4,7 @@ use warnings;

$|++;

use lib '../lib';
use lib ('lib', '../lib');

use Test::More tests => 52;
use Test::Mojo;
Expand Down Expand Up @@ -52,7 +52,7 @@ $t->get_ok('/.well-known/host-meta')
->element_exists('XRD[xsi]')
->element_exists_not('Link')
->element_exists_not('Property')
->element_exists('Host')->text_is($hm_host);
->element_exists('Host')->text_is(Host => $hm_host);

$app->hook(
'before_serving_hostmeta' => sub {
Expand All @@ -71,8 +71,8 @@ $t->get_ok('/.well-known/host-meta')
->element_exists_not('Link')
->element_exists('Property')
->element_exists('Property[type="foo"]')
->text_is('bar')
->element_exists('Host')->text_is($hm_host);
->text_is('Property[type="foo"]' => 'bar')
->element_exists('Host')->text_is(Host => $hm_host);

$app->hook('before_fetching_hostmeta',
=> sub {
Expand Down
2 changes: 1 addition & 1 deletion t/Oro.t
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
use Mojolicious::Lite;
use Test::More tests => 25;
use Test::More tests => 27;
use Test::Mojo;
use Data::Dumper;

Expand Down
6 changes: 3 additions & 3 deletions t/Util/Endpoint.t
Expand Up @@ -147,15 +147,15 @@ is($app->endpoint('test6' =>
{
'?' => undef
}),
'/suggest?c={foo}&d={BAR}&f=%2A',
'/suggest?c={foo}&d={BAR}&f=*',
'endpoint 16');

is($app->endpoint('test6' =>
{
'test:foo' => 'check',
'?' => undef
}),
'/suggest?c={foo}&d={BAR}&e=check&f=%2A',
'/suggest?c={foo}&d={BAR}&e=check&f=*',
'endpoint 17');

my $hash = $app->get_endpoints;
Expand All @@ -181,5 +181,5 @@ is ($hash->{test5},
'hash-test 5');

is ($hash->{test6},
'/suggest?a={foo?}&b={bar?}&c={foo}&d={BAR}&e={test:foo?}&f=%2A',
'/suggest?a={foo?}&b={bar?}&c={foo}&d={BAR}&e={test:foo?}&f=*',
'hash-test 6');
5 changes: 2 additions & 3 deletions t/XML/Atom.t
Expand Up @@ -4,8 +4,7 @@ use warnings;

$|++;

use lib '../lib';
use lib '../../lib';
use lib ('lib', '../lib', '../../lib', '../../../lib');

use Mojo::ByteStream 'b';
use Test::Mojo;
Expand Down Expand Up @@ -356,7 +355,7 @@ is($atom->at('entry > author > name')->text, 'Bender', 'Text');
is($atom->at('content[type]')->text, 'I am Bender!', 'Text');
is($atom->at('content[type="html"]')->text, 'I am <strong>Bender</strong>!', 'Text');
is($atom->at('content[type="xhtml"]')->text, '', 'Text');
is($atom->at('content[type="xhtml"] div')->text, 'I am !', 'Text');
is($atom->at('content[type="xhtml"] div')->text, 'I am!', 'Text');
is($atom->at('content[type="xhtml"] div')->all_text, 'I am Bender!', 'Text');
is($atom->at('content[type="movie"]')->text, 'SSBhbSBCZW5kZXIh', 'Text');

Expand Down

0 comments on commit d64d49d

Please sign in to comment.