[libanyevent-rabbitmq-perl] 25/151: Move the amqp spec XML somewhere it is installed and can be found. Provide a method to find it

Damyan Ivanov dmn at moszumanska.debian.org
Thu Jan 16 11:03:01 UTC 2014


This is an automated email from the git hooks/post-receive script.

dmn pushed a commit to annotated tag debian/1.12-1
in repository libanyevent-rabbitmq-perl.

commit 9e100def09b63be904df2ca2cbba98c383386df4
Author: Tomas Doran <t0m at button.state51.co.uk>
Date:   Mon Feb 22 21:30:41 2010 +0000

    Move the amqp spec XML somewhere it is installed and can be found. Provide a method to find it
---
 Makefile.PL                                                | 3 ++-
 lib/RabbitFoot.pm                                          | 7 +++++++
 lib/RabbitFoot/Cmd/Role/Command.pm                         | 2 +-
 fixed_amqp0-8.xml => lib/auto/RabbitFoot/fixed_amqp0-8.xml | 0
 xt/04_anyevent.t                                           | 3 ++-
 xt/05_coro.t                                               | 2 +-
 xt/06_multi_channel.t                                      | 2 +-
 7 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index 1f36fba..36a43df 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -7,12 +7,13 @@ requires 'MooseX::AttributeHelpers';
 requires 'MooseX::App::Cmd';
 requires 'MooseX::ConfigFromFile';
 requires 'Config::Any';
-requires 'JSON::Syck';
+requires 'JSON::Syck' => '0.88';
 requires 'List::MoreUtils';
 requires 'Net::AMQP';
 requires 'AnyEvent';
 requires 'Coro';
 requires 'Coro::AnyEvent';
+requires 'File::ShareDir';
 
 tests 't/*.t';
 author_tests 'xt';
diff --git a/lib/RabbitFoot.pm b/lib/RabbitFoot.pm
index ee86a9c..2dbd8fa 100644
--- a/lib/RabbitFoot.pm
+++ b/lib/RabbitFoot.pm
@@ -4,6 +4,8 @@ use AnyEvent::RabbitMQ;
 use Coro;
 use Coro::AnyEvent;
 
+use File::ShareDir ();
+
 use RabbitFoot::Channel;
 
 use Moose;
@@ -44,6 +46,11 @@ sub load_xml_spec {
     return $self;
 }
 
+sub default_amqp_spec {
+    my $dir = File::ShareDir::module_dir(__PACKAGE__);
+    return "$dir/fixed_amqp0-8.xml";
+}
+
 sub open_channel {
     my $self = shift;
     return RabbitFoot::Channel->new(arc => $self->_do('open_channel', @_));
diff --git a/lib/RabbitFoot/Cmd/Role/Command.pm b/lib/RabbitFoot/Cmd/Role/Command.pm
index e6b1eb7..23335c2 100644
--- a/lib/RabbitFoot/Cmd/Role/Command.pm
+++ b/lib/RabbitFoot/Cmd/Role/Command.pm
@@ -10,7 +10,7 @@ requires qw(_run);
 has spec => (
     isa => 'Str',
     is  => 'rw',
-    default       => $FindBin::Bin . '/fixed_amqp0-8.xml',
+    default       => RabbitFoot::default_amqp_spec(),
     metaclass     => 'MooseX::Getopt::Meta::Attribute',
     cmd_aliases   => 's',
     documentation => 'AMQP specification',
diff --git a/fixed_amqp0-8.xml b/lib/auto/RabbitFoot/fixed_amqp0-8.xml
similarity index 100%
rename from fixed_amqp0-8.xml
rename to lib/auto/RabbitFoot/fixed_amqp0-8.xml
diff --git a/xt/04_anyevent.t b/xt/04_anyevent.t
index 5cb0749..21f8c45 100644
--- a/xt/04_anyevent.t
+++ b/xt/04_anyevent.t
@@ -23,12 +23,13 @@ plan skip_all => 'Connection failure: '
                . $conf->{host} . ':' . $conf->{port} if $@;
 plan tests => 24;
 
+use RabbitFoot ();
 use AnyEvent::RabbitMQ;
 
 my $ar = AnyEvent::RabbitMQ->new();
 
 lives_ok sub {
-    $ar->load_xml_spec($FindBin::Bin . '/../fixed_amqp0-8.xml')
+    $ar->load_xml_spec(RabbitFoot::default_amqp_spec())
 }, 'load xml spec';
 
 my $done = AnyEvent->condvar;
diff --git a/xt/05_coro.t b/xt/05_coro.t
index 9830cd1..e2a86cc 100644
--- a/xt/05_coro.t
+++ b/xt/05_coro.t
@@ -29,7 +29,7 @@ use RabbitFoot;
 my $rf = RabbitFoot->new();
 
 lives_ok sub {
-    $rf->load_xml_spec($FindBin::Bin . '/../fixed_amqp0-8.xml')
+    $rf->load_xml_spec(RabbitFoot::default_amqp_spec())
 }, 'load xml spec';
  
 lives_ok sub {
diff --git a/xt/06_multi_channel.t b/xt/06_multi_channel.t
index d551040..cab40c3 100644
--- a/xt/06_multi_channel.t
+++ b/xt/06_multi_channel.t
@@ -27,7 +27,7 @@ use Coro;
 use RabbitFoot;
 
 my $rf = RabbitFoot->new()->load_xml_spec(
-    $FindBin::Bin . '/../fixed_amqp0-8.xml',
+    RabbitFoot::default_amqp_spec()
 )->connect(
     (map {$_ => $conf->{$_}} qw(host port user pass vhost)),
     timeout => 1,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libanyevent-rabbitmq-perl.git



More information about the Pkg-perl-cvs-commits mailing list