App-PFT
view release on metacpan or search on metacpan
bin/pft-pub view on Meta::CPAN
my $method = $methods{$conf->{publish}{method}} || do {
say STDERR 'Unknown method ', $conf->{publish}{method};
exit 5;
};
$method->($tree);
exit 0;
sub check {
foreach (@_) {
unless(defined $conf->{publish}{$_}) {
say STDERR 'Cannot use publish.', $_,
': missing publish.', $_, ' in ',
$PFT::Conf::CONF_NAME;
exit 6
}
}
}
sub rsync_ssh {
my $tree = shift;
defined $tree || return qw/user host path/;
check qw/user host path/;
my $src = File::Spec->catfile($tree->dir_build, '');
my $publish = $conf->{publish};
my $dst = "$publish->{user}\@$publish->{host}:$publish->{path}";
my $port = $publish->{port} || 22;
local $, = "\n\t";
say STDERR 'Sending with RSync', "from $src", "to $dst";
system('rsync',
'-e', "ssh -p $port",
'--recursive',
'--verbose',
'--copy-links',
'--times',
'--delete',
'--human-readable',
'--progress',
$src, $dst,
);
}
sub install {
my $tree = shift;
defined $tree || return qw/path/;
check qw/path/;
my $dst = File::Spec->rel2abs($conf->{publish}{path}, $tree->dir_base);
remove_tree $dst, { verbose => 0 };
make_path $dst, { verbose => 0 };
local $File::Copy::Recursive::CopyLink = 0;
File::Copy::Recursive::rcopy_glob(
encode(locale => File::Spec->catfile($tree->dir_build, '*')),
encode(locale => $dst),
);
}
( run in 0.802 second using v1.01-cache-2.11-cpan-ceb78f64989 )