view release on metacpan or search on metacpan
inc/Menlo/Sqitch.pm view on Meta::CPAN
sub new {
my %deps;
while (<DATA>) {
last if /^Build-only dependencies/;
}
while (<DATA>) {
chomp;
last unless s/^\s+//;
$deps{$_} = 1;
}
shift->SUPER::new(
@_,
_remove => [],
_bld_deps => \%deps,
);
}
sub find_prereqs {
my ($self, $dist) = @_;
# Menlo defaults to config, test, runtime. We just want to bundle runtime.
$dist->{want_phases} = ['runtime'];
return $self->SUPER::find_prereqs($dist);
}
sub configure {
my $self = shift;
my $cmd = $_[0];
return $self->SUPER::configure(@_) if ref $cmd ne 'ARRAY';
# Always use vendor install dirs. Hack for
# https://github.com/miyagawa/cpanminus/issues/581.
if ($cmd->[1] eq 'Makefile.PL') {
push @{ $cmd } => 'INSTALLDIRS=vendor';
} elsif ($cmd->[1] eq 'Build.PL') {
push @{ $cmd } => '--installdirs', 'vendor';
}
return $self->SUPER::configure(@_);
}
sub save_meta {
my $self = shift;
my ($module, $dist) = @_;
# Record if we've installed a build-only dependency.
my $dname = $dist->{meta}{name};
push @{ $self->{_remove} } => $module if $self->{_bld_deps}{$dname};
$self->SUPER::save_meta(@_);
}
sub remove_build_dependencies {
# Uninstall modules for distributions not actually needed to run Sqitch.
my $self = shift;
local $self->{force} = 1;
my @fail;
for my $mod (reverse @{ $self->{_remove} }) {
$self->uninstall_module($mod) or push @fail, $mod;
}
inc/Module/Build/Sqitch.pm view on Meta::CPAN
$p{requires}{'DateTime::TimeZone::Local::Win32'} = 0;
}
if (eval { require Hash::Merge; 1 } && $Hash::Merge::VERSION eq '0.298') {
warn join "\n", (
'**************************************************************',
'* You have Hash::Merge $Hash::Merge::VERSION, which is broken.',
"**************************************************************\n",
);
$p{requires}{'Hash::Merge'} = '0.299';
}
my $self = $class->SUPER::new(%p);
$self->add_build_element('etc');
$self->add_build_element('mo');
$self->add_build_element('sql');
return $self;
}
sub _getetc {
my $self = shift;
my $prefix;
inc/Module/Build/Sqitch.pm view on Meta::CPAN
# verify.tmpl -> verify/$engine.tmpl #
# #
#################################################################
} . "\n");
}
}
sub ACTION_install {
my ($self, @params) = @_;
$self->depends_on('move_old_templates');
$self->SUPER::ACTION_install(@_);
}
sub process_etc_files {
my $self = shift;
my $etc = $self->_getetc;
$self->install_path( etc => $etc );
if (my $ddir = $self->destdir) {
# Need to search the final destination directory.
$etc = File::Spec->catdir($ddir, $etc);
inc/Module/Build/Sqitch.pm view on Meta::CPAN
$self->copy_if_modified(
from => $file,
to => File::Spec->catfile( $self->blib, $dest )
);
}
}
sub process_pm_files {
my $self = shift;
my $ret = $self->SUPER::process_pm_files(@_);
my $pm = File::Spec->catfile(qw(blib lib App Sqitch Config.pm));
my $etc = $self->installed_etcdir || $self->_getetc;
$self->do_system(
$self->perl, '-i.bak', '-pe',
qq{s{my \\\$SYSTEM_DIR = undef}{my \\\$SYSTEM_DIR = q{\Q$etc\E}}},
$pm,
);
unlink "$pm.bak";
return $ret;
}
sub fix_shebang_line {
my $self = shift;
# Noting to do after 5.10.0.
return $self->SUPER::fix_shebang_line(@_) if $] > 5.010000;
# Remove -C from the shebang line.
for my $file (@_) {
my $FIXIN = IO::File->new($file) or die "Can't process '$file': $!";
local $/ = "\n";
chomp(my $line = <$FIXIN>);
next unless $line =~ s/^\s*\#!\s*//; # Not a shebang file.
my ($cmd, $arg) = (split(' ', $line, 2), '');
next unless $cmd =~ /perl/i && $arg =~ s/ -C\w+//;
inc/Module/Build/Sqitch.pm view on Meta::CPAN
or die "Can't rename $file to $file.bak: $!";
rename("$file.new", $file)
or die "Can't rename $file.new to $file: $!";
$self->delete_filetree("$file.bak")
or $self->log_warn("Couldn't clean up $file.bak, leaving it there");
}
# Back at it now.
return $self->SUPER::fix_shebang_line(@_);
}
sub ACTION_bundle {
my ($self, @params) = @_;
my $base = $self->install_base or die "No --install_base specified\n";
# XXX Consider replacing with a Carton or Carmel-based solution?
SHHH: {
local $SIG{__WARN__} = sub {}; # Menlo has noisy warnings.
local $ENV{PERL_CPANM_OPT}; # Override cpanm options.
lib/App/Sqitch/Command/log.pm view on Meta::CPAN
# Determine how to handle ANSI colors.
my $color = delete $opt->{no_color} ? 'never'
: delete $opt->{color} || $config->get(key => 'log.color');
$opt->{formatter} = App::Sqitch::ItemFormatter->new(
( $date_format ? ( date_format => $date_format ) : () ),
( $color ? ( color => $color ) : () ),
( $opt->{abbrev} ? ( abbrev => delete $opt->{abbrev} ) : () ),
);
return $class->SUPER::configure( $config, $opt );
}
sub execute {
my $self = shift;
my ($targets) = $self->parse_args(
target => $self->target,
args => \@_,
);
# Warn on multiple targets.
lib/App/Sqitch/Command/plan.pm view on Meta::CPAN
# Determine how to handle ANSI colors.
my $color = delete $opt->{no_color} ? 'never'
: delete $opt->{color} || $config->get(key => 'plan.color');
$opt->{formatter} = App::Sqitch::ItemFormatter->new(
( $date_format ? ( date_format => $date_format ) : () ),
( $color ? ( color => $color ) : () ),
( $opt->{abbrev} ? ( abbrev => delete $opt->{abbrev} ) : () ),
);
return $class->SUPER::configure( $config, $opt );
}
sub execute {
my $self = shift;
my ($targets) = $self->parse_args(
target => $self->target,
args => \@_,
);
# Warn on multiple targets.
lib/App/Sqitch/Command/show.pm view on Meta::CPAN
return qw(
target|t=s
exists|e!
);
}
sub configure {
my ( $class, $config, $opt ) = @_;
$opt->{exists_only} = delete $opt->{exists}
if exists $opt->{exists};
return $class->SUPER::configure( $config, $opt );
}
sub execute {
my ( $self, $type, $key ) = @_;
$self->usage unless $type && $key;
require App::Sqitch::Target;
my $target = $self->target ? App::Sqitch::Target->new(
$self->target_params,
name => $self->target,
lib/App/Sqitch/Command/status.pm view on Meta::CPAN
App::Sqitch::DateTime->validate_as_string_format($format);
}
# Set boolean options from config.
for my $key (qw(show_changes show_tags)) {
next if exists $opt->{$key};
my $val = $config->get(key => "status.$key", as => 'bool') // next;
$opt->{$key} = $val;
}
my $ret = $class->SUPER::configure( $config, $opt );
$ret->{target_name} = delete $ret->{target} if exists $ret->{target};
return $ret;
}
sub emit_state {
my ( $self, $state ) = @_;
$self->comment(__x(
'Project: {project}',
project => $state->{project},
));
lib/App/Sqitch/Config.pm view on Meta::CPAN
sub initialized {
my $self = shift;
$self->load unless $self->is_loaded;
return $self->{_initialized};
}
sub load_dirs {
my $self = shift;
local $self->{__loading_dirs} = 1;
$self->SUPER::load_dirs(@_);
}
sub load_file {
my $self = shift;
$self->{_initialized} ||= $self->{__loading_dirs};
$self->SUPER::load_file(@_);
}
1;
=head1 Name
App::Sqitch::Config - Sqitch configuration management
=head1 Synopsis
lib/App/Sqitch/Engine/mysql.pm view on Meta::CPAN
extends 'App::Sqitch::Engine';
our $VERSION = 'v1.5.2'; # VERSION
has uri => (
is => 'ro',
isa => URIDB,
lazy => 1,
default => sub {
my $self = shift;
my $uri = $self->SUPER::uri;
$uri->host($ENV{MYSQL_HOST}) if !$uri->host && $ENV{MYSQL_HOST};
$uri->port($ENV{MYSQL_TCP_PORT}) if !$uri->_port && $ENV{MYSQL_TCP_PORT};
return $uri;
},
);
has registry_uri => (
is => 'ro',
isa => URIDB,
lazy => 1,
lib/App/Sqitch/Engine/snowflake.pm view on Meta::CPAN
return $cfg;
},
);
has uri => (
is => 'ro',
isa => URIDB,
lazy => 1,
default => sub {
my $self = shift;
my $uri = $self->SUPER::uri;
# Set defaults in the URI.
$uri->host($self->_host($uri));
$uri->dbname(
$ENV{SNOWSQL_DATABASE}
|| $self->_snowcfg->{dbname}
|| $self->username
) if !$uri->dbname;
return $uri;
},
lib/App/Sqitch/Plan/Change.pm view on Meta::CPAN
$self->plan->open_script($self->revert_file);
}
sub verify_handle {
my $self = shift;
$self->plan->open_script($self->verify_file);
}
sub format_content {
my $self = shift;
return $self->SUPER::format_content . $self->pspace . join (
' ',
($self->format_dependencies || ()),
$self->timestamp->as_string,
$self->format_planner
);
}
sub requires_changes {
my $self = shift;
my $plan = $self->plan;
lib/App/Sqitch/Plan/Tag.pm view on Meta::CPAN
);
sub format_planner {
my $self = shift;
return join ' ', $self->planner_name, '<' . $self->planner_email . '>';
}
sub format_content {
my $self = shift;
return join ' ',
$self->SUPER::format_content,
$self->timestamp->as_string,
$self->format_planner;
}
1;
__END__
=head1 Name
t/lib/TestConfig.pm view on Meta::CPAN
# App::Sqitch::Config. Sets nonexistent values for the file locations and
# calls update() on remaining args.
#
# my $config = TestConfig->new(
# 'core.engine' => 'sqlite',
# 'add.all' => 1,
# 'deploy.variables' => { _prefix => 'test_', user => 'bob' }
# 'foo.bar' => [qw(one two three)],
# );
sub new {
my $self = shift->SUPER::new;
$self->{test_local_file} = 'nonexistent.local';
$self->{test_user_file} = 'nonexistent.user';
$self->{test_system_file} = 'nonexistent.system';
$self->update(@_);
return $self;
}
# Pass in key/value pairs to set the data. Does not clear existing data. Keys
# should be "$section.$name". Values can be scalars, arrays, or hashes.
# Scalars are simply set as-is, unless the value is `undef`, in which case the
t/lib/TestConfig.pm view on Meta::CPAN
# value. Once the files are set, the data is loaded from the files and the
# TestObject returned.
#
# my $config = TestObject->from(
# local => 'test.conf',
# user => 'user.conf',
# system => 'system.conf',
# );
sub from {
my ($class, %p) = @_;
my $self = shift->SUPER::new;
for my $level (qw(local user system)) {
$self->{"test_${level}_file"} = $p{$level} || "nonexistent.$level";
}
$self->load;
return $self;
}
# Creates and returns a Test::MockModule object that can be used to mock
# methods on the TestConfig class. Pass pairs of parameters to be passed on to
# the mock() method of the Test::MockModule object before returning.
t/lib/TestConfig.pm view on Meta::CPAN
sub load_dirs {
my $self = shift;
# Exclude files in parent directories.
$self->load_file($self->local_file);
}
# Parses the specified configuration file and returns a hash reference. May be
# called as either a class or instance method; in neither case is the data
# stored anywhere other than the returned hash reference.
sub data_from {
my $conf = shift->SUPER::new;
$conf->load_file(shift);
$conf->data;
}
1;