App-Sqitch
view release on metacpan or search on metacpan
lib/App/Sqitch.pm view on Meta::CPAN
use Try::Tiny;
use List::Util qw(first);
use IPC::System::Simple 1.17 qw(runx capturex $EXITVAL);
use namespace::autoclean 0.16;
use constant ISWIN => $^O eq 'MSWin32';
our $VERSION = 'v1.5.2'; # VERSION
BEGIN {
# Force Locale::TextDomain to encode in UTF-8 and to decode all messages.
$ENV{OUTPUT_CHARSET} = 'UTF-8';
bind_textdomain_filter 'App-Sqitch' => \&Encode::decode_utf8, Encode::FB_DEFAULT;
}
# Okay to load Sqitch classes now that types are created.
use App::Sqitch::Config;
use App::Sqitch::Command;
use App::Sqitch::Plan;
has options => (
is => 'ro',
lib/App/Sqitch/Engine/snowflake.pm view on Meta::CPAN
my $dbh = shift;
my $role = $self->role;
# Use LITERAL(), but not for WAREHOUSE, which might be
# database-qualified (db.wh). Details on IDENTIFIER():
# https://docs.snowflake.com/en/sql-reference/identifier-literal
$dbh->do($_) or return for (
($role ? ('USE ROLE IDENTIFIER(' . $dbh->quote($role) . ')') : ()),
"ALTER WAREHOUSE $wh RESUME IF SUSPENDED",
"USE WAREHOUSE $wh",
'ALTER SESSION SET TIMESTAMP_TYPE_MAPPING=TIMESTAMP_LTZ',
"ALTER SESSION SET TIMESTAMP_OUTPUT_FORMAT='YYYY-MM-DD HH24:MI:SS'",
"ALTER SESSION SET TIMEZONE='UTC'",
);
$dbh->do('USE SCHEMA IDENTIFIER(' . $dbh->quote($self->registry) . ')')
or $self->_handle_no_registry($dbh);
return;
},
disconnect => sub {
my $dbh = shift;
$dbh->do("ALTER WAREHOUSE $wh SUSPEND");
return;
lib/App/Sqitch/ItemFormatter.pm view on Meta::CPAN
use List::Util qw(max);
use Moo;
use Types::Standard qw(Str Int);
use Type::Utils qw(enum class_type);
use String::Formatter;
use namespace::autoclean;
use Try::Tiny;
use Term::ANSIColor 2.02 qw(colorvalid);
my $encolor = \&Term::ANSIColor::color;
use constant CAN_OUTPUT_COLOR => $^O eq 'MSWin32'
? try { require Win32::Console::ANSI }
: -t *STDOUT;
BEGIN {
$ENV{ANSI_COLORS_DISABLED} = 1 unless CAN_OUTPUT_COLOR;
}
our $VERSION = 'v1.5.2'; # VERSION
has abbrev => (
is => 'ro',
isa => Int,
default => 0,
);
t/lib/MockOutput.pm view on Meta::CPAN
vent
vent_literal
warn
warn_literal
page
page_literal
prompt
ask_yes_no
);
my $INPUT;
sub prompt_returns { $INPUT = $_[1]; }
my $Y_N;
sub ask_yes_no_returns { $Y_N = $_[1]; }
my %CAPTURED;
__PACKAGE__->clear;
for my $meth (@mocked) {
$MOCK->mock($meth => sub {
t/lib/MockOutput.pm view on Meta::CPAN
return $ret;
};
no strict 'refs';
*{"get_$meth"} = $get;
}
$MOCK->mock(prompt => sub {
shift;
push @{ $CAPTURED{prompt} } => [@_];
return $INPUT;
});
$MOCK->mock(ask_yes_no => sub {
shift;
push @{ $CAPTURED{ask_yes_no} } => [@_];
return $Y_N;
});
sub clear {
%CAPTURED = map { $_ => [] } @mocked;
$^O = 'MSWin32';
}
use strict;
use warnings;
use Test::More tests => 2;
use Try::Tiny;
use App::Sqitch::ItemFormatter;
is $^O, 'MSWin32', 'Should have "MSWin32"';
is App::Sqitch::ItemFormatter::CAN_OUTPUT_COLOR,
try { require Win32::Console::ANSI },
'CAN_OUTPUT_COLOR should be set properly';
( run in 0.388 second using v1.01-cache-2.11-cpan-64827b87656 )