App-Puppet-Environment-Updater
view release on metacpan or search on metacpan
lib/App/Puppet/Environment/Updater.pm view on Meta::CPAN
package App::Puppet::Environment::Updater;
$App::Puppet::Environment::Updater::VERSION = '0.001002';
# ABSTRACT: Update a Puppet environment in a Git branch
use Moose;
use MooseX::FollowPBP;
with 'MooseX::Getopt';
use Carp;
use Git::Wrapper;
use File::pushd;
use Path::Class::Dir;
use MooseX::Types::Path::Class;
use Log::Dispatchouli;
use List::MoreUtils qw(any);
use Term::ANSIColor qw(:constants);
use Try::Tiny;
use namespace::autoclean;
has 'from' => (
is => 'ro',
isa => 'Str',
required => 1,
documentation => 'Environment/branch which should be merged',
);
has 'environment' => (
is => 'ro',
isa => 'Str',
required => 1,
documentation => 'Environment/branch which should be updated',
);
has 'remote' => (
is => 'ro',
isa => 'Str',
documentation => 'Git remote to fetch latest changes from, defaults to "origin"',
default => 'origin',
);
has 'workdir' => (
is => 'ro',
isa => 'Path::Class::Dir',
coerce => 1,
documentation => 'Directory to work in, should be the directory with the environment that should be updated',
default => sub {
return Path::Class::Dir->new('.')->absolute();
},
);
has 'git' => (
is => 'ro',
isa => 'Git::Wrapper',
traits => ['NoGetopt'],
lazy => 1,
default => sub {
my ($self) = @_;
return Git::Wrapper->new(
$self->get_workdir()->absolute()->resolve()->stringify()
);
},
);
has 'logger' => (
is => 'ro',
isa => 'Log::Dispatchouli',
traits => ['NoGetopt'],
lazy => 1,
default => sub {
my ($self) = @_;
my $logger = Log::Dispatchouli->new({
ident => 'environment-updater',
to_stderr => 1,
log_pid => 0,
});
$logger->set_prefix('[update-'.$self->get_environment().'] ');
( run in 1.940 second using v1.01-cache-2.11-cpan-39bf76dae61 )