AWS-CLIWrapper
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
url => 'https://github.com/hirose31/AWS-CLIWrapper.git',
},
},
},
"test" => {
"TESTS" => "t/*.t"
}
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
my $tr = delete $WriteMakefileArgs{TEST_REQUIRES};
my $br = $WriteMakefileArgs{BUILD_REQUIRES};
for my $mod ( keys %$tr ) {
if ( exists $br->{$mod} ) {
$br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod};
} else {
$br->{$mod} = $tr->{$mod};
}
}
}
unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
my $pp = $WriteMakefileArgs{PREREQ_PM};
for my $mod ( keys %$br ) {
if ( exists $pp->{$mod} ) {
$pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
} else {
$pp->{$mod} = $br->{$mod};
}
}
}
delete $WriteMakefileArgs{META_MERGE}
unless eval { ExtUtils::MakeMaker->VERSION(6.48) };
delete $WriteMakefileArgs{MIN_PERL_VERSION}
unless eval { ExtUtils::MakeMaker->VERSION(6.48) };
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
lib/AWS/CLIWrapper.pm view on Meta::CPAN
sub _handle {
my ($self, $service, $operation, $ret) = @_;
if ($ret->{exit_code} == 0 && $ret->{timeout} == 0) {
my $json = $ret->{stdout};
warn sprintf("%s.%s[%s]: %s\n",
$service, $operation, 'OK', $json,
) if $ENV{AWSCLI_DEBUG};
local $@;
my($ret) = eval {
# aws s3 returns null HTTP body, so failed to parse as JSON
# Temporary disable __DIE__ handler to prevent the
# exception from decode() from catching by outer
# __DIE__ handler.
local $SIG{__DIE__} = sub {};
$self->json->decode($json);
};
if ($@) {
t/04_errors.t view on Meta::CPAN
aws help
aws <command> help
aws <command> <subcommand> help
!ms;
like $AWS::CLIWrapper::Error->{Message}, $want_err_msg, "default error message match";
# Croaking
my $aws_croak = AWS::CLIWrapper->new(croak_on_error => 1);
eval {
$aws_croak->elbv2();
};
like $@, $want_err_msg, "croak on error message match";
t/05_catch_error_options.t view on Meta::CPAN
no warnings 'uninitialized';
use Test::More;
use AWS::CLIWrapper;
my %default_args = (
awscli_path => 't/bin/mock-aws',
nofork => 1,
);
my $tests = eval join "\n", <DATA> or die "$@";
for my $test_name (keys %$tests) {
next if @ARGV and not grep { $_ eq $test_name } @ARGV;
my $test = $tests->{$test_name};
my ($args, $env, $method, $want) = @$test{qw(args env method want)};
$env = {} unless $env;
local @ENV{keys %$env} = values %$env;
t/06_catch_errors.t view on Meta::CPAN
use Test::More;
use File::Temp 'tempfile';
use AWS::CLIWrapper;
my %default_wrapper_args = (
awscli_path => 't/bin/mock-aws',
nofork => 1,
);
my $tests = eval join "\n", <DATA> or die "$@";
for my $test_name (keys %$tests) {
next if @ARGV and not grep { $_ eq $test_name } @ARGV;
my $test = $tests->{$test_name};
my ($wrapper_args, $env, $command, $subcommand, $cmd_args)
= @$test{qw(wrapper_args env command subcommand cmd_args)};
$env = {} unless $env;
t/06_catch_errors.t view on Meta::CPAN
local $ENV{AWS_CLIWRAPPER_TEST_ERROR_COUNTER_FILE} = $tmp_name;
local $ENV{AWS_CLIWRAPPER_TEST_DIE_WITH_ERROR} = $test->{error_to_die_with}
if $test->{error_to_die_with};
local @ENV{keys %$env} = values %$env;
$AWS::CLIWrapper::Error = { Message => '', Code => '' };
my $aws = AWS::CLIWrapper->new(%default_wrapper_args, %{$wrapper_args || {}});
my $res = eval { $aws->$command($subcommand, @{$cmd_args || []}) };
if ($test->{retries} > 0) {
open my $fh, "<", $tmp_name;
my $counter = <$fh>;
close $fh;
is $counter, 0, "$test_name retry counter exhausted";
}
like "$@", $test->{exception}, "$test_name exception";
t/bin/mock-aws view on Meta::CPAN
#!/usr/bin/perl
eval 'exec /usr/bin/perl -wS $0 ${1+"$@"}'
if 0;
use strict;
use warnings;
no warnings 'uninitialized';
version() if $ARGV[0] eq "--version";
handle_die_with_error() if $ENV{AWS_CLIWRAPPER_TEST_DIE_WITH_ERROR};
xt/01_podspell.t view on Meta::CPAN
use Test::More;
eval q{ use Test::Spelling };
plan skip_all => "Test::Spelling is not installed." if $@;
add_stopwords(map { split /[\s\:\-]/ } <DATA>);
$ENV{LANG} = 'C';
all_pod_files_spelling_ok('lib');
__DATA__
HIROSE Masaaki
hirose31 _at_ gmail.com
AWS::CLIWrapper
arg
aws
xt/02_perlcritic.t view on Meta::CPAN
use strict;
use Test::More;
eval {
require Test::Perl::Critic;
Test::Perl::Critic->import( -profile => 'xt/perlcriticrc');
};
plan skip_all => "Test::Perl::Critic is not installed." if $@;
all_critic_ok('lib');
xt/03_pod.t view on Meta::CPAN
use Test::More;
eval "use Test::Pod 1.00";
plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
all_pod_files_ok();
xt/90_dependencies.t view on Meta::CPAN
# -*- mode: cperl; -*-
use Test::More;
eval "use App::scan_prereqs_cpanfile";
plan skip_all => "App::scan_prereqs_cpanfile required for testing module dependencies"
if $@;
my $diff = `scan-prereqs-cpanfile --ignore junk --diff cpanfile`;
is($diff, "", "diff cpanfile");
done_testing;
( run in 1.592 second using v1.01-cache-2.11-cpan-98e64b0badf )