App-SFDC-Metadata
view release on metacpan or search on metacpan
lib/App/SFDC/Command/Deploy.pm view on Meta::CPAN
if ($self->all) {
find(
sub {
push @filelist, $File::Find::name
unless (-d or /(package\.xml|destructiveChanges(Pre|Post)?\.xml|\.bak)/)
},
'src'
);
} else {
INFO 'Reading files from STDIN';
@filelist = <STDIN>;
chomp @filelist;
@filelist = grep {$_} @filelist;
}
DEBUG "File list for deployment: ". Dumper(\@filelist);
return \@filelist;
};
option 'rollback',
is => 'ro',
default => 1,
negativable => 1;
option 'runtests',
doc => 'Defaults to off, turn on by setting to 1',
short => 't',
is => 'ro',
default => 0;
option 'testoutput',
format => 's',
short => 'o',
is => 'ro';
option 'validate',
is => 'ro',
short => 'v',
default => 0;
option 'zipfile',
is => 'ro',
short => 'z',
isa => sub {
LOGDIE "The specified zipfile, $_[0], doesn't exist!" unless -e $_[0];
};
has '_zipFile',
lazy => 1,
is => 'rw',
default => sub {
my $self = shift;
return $self->zipfile
? do {
open my $FH, '<', $self->zipfile;
binmode $FH;
local $/;
<$FH>;
}
: WWW::SFDC::Zip::makezip(
'src/',
$self->_manifest->getFileList,
'package.xml',
(
$self->deletions
? ('destructiveChangesPre.xml', 'destructiveChangesPost.xml')
: ()
)
);
};
has '_manifest',
is => 'ro',
lazy => 1,
default => sub {
my $self = shift;
WWW::SFDC::Manifest->new(
constants => $self->_session->Constants,
apiVersion => $self->_session->apiVersion,
)->addList(@{$self->files})->writeToFile('src/package.xml');
};
has '_result',
is => 'ro',
lazy => 1,
default => sub {
my $self = shift;
$self->_session->Metadata->deployMetadata(
$self->_zipFile,
{
singlePackage => 'true',
($self->rollback ? (rollbackOnError => 'true') : ()),
($self->validate ? (checkOnly => 'true') : ()),
($self->runtests ? (testLevel => 'RunLocalTests') : ()),
}
);
};
sub _JUnitOutput {
my $self = shift;
return unless $self->testoutput and ($self->_result->result->{runTestsEnabled} eq 'true');
Role::Tiny->apply_roles_to_object(
$self->_result,
'App::SFDC::Role::DeployResult::JUnitOutput'
);
$self->_result->printToJUnit($self->testoutput);
}
sub execute {
my $self = shift;
unless (scalar @{$self->files} or $self->zipfile) {
INFO "Nothing to deploy; exiting";
return 1; # truthy
}
( run in 1.074 second using v1.01-cache-2.11-cpan-39bf76dae61 )