Alien-ActiveMQ
view release on metacpan or search on metacpan
lib/Alien/ActiveMQ.pm view on Meta::CPAN
package Alien::ActiveMQ;
use Moose;
use MooseX::Types::Path::Class;
use Method::Signatures::Simple;
use File::ShareDir qw/dist_dir/;
use Path::Class qw/file dir/;
use Scope::Guard;
use IPC::Run qw/start run/;
use Net::Stomp;
use Sort::Versions;
use namespace::autoclean;
our $VERSION = '0.00005';
# Note: Many of the methods in this class need to be usable as class methods.
# This means you can't use Moose attributes, because they try and store data
# on the class name, which fails. Only normal methods here.
# To make mocking easier.
sub _dist_dir {
return dir( dist_dir('Alien-ActiveMQ') );
}
method _output {
my $msg = "@_\n";
return warn($msg);
}
method startup_timeout {
return 300;
}
method get_installed_versions {
my @dirs = $self->_dist_dir->children;
my @versions = ();
foreach my $dir (@dirs) {
if ( $dir->basename =~ /^\d[\d.]+$/ ) {
push @versions, $dir->basename;
}
}
return ( sort { versioncmp( $b, $a ); } @versions );
}
method get_version_dir($version) {
if ( !$version ) {
$version = ( $self->get_installed_versions )[0];
}
if ($version) {
return dir( $self->_dist_dir, $version );
}
return;
}
method is_version_installed($version) {
return $self->get_version_dir($version)
&& ( -d $self->get_version_dir($version) );
}
method get_license_filename($version) {
my $dir = $self->get_version_dir($version);
return file( $dir, 'LICENSE' );
}
method get_licence_filename($version) {
return $self->get_license_filename($version);
}
method run_server($version) {
my $dir = $self->get_version_dir($version);
my @cmd = ( file( $dir, 'bin', 'activemq' ) );
( run in 1.530 second using v1.01-cache-2.11-cpan-e93a5daba3e )