You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1021 B
31 lines
1021 B
package MJB::Web::Task::SyncBlogMedia;
|
|
use Mojo::Base 'MJB::Web::Task', -signatures;
|
|
use Mojo::File qw( curfile );
|
|
use File::Copy::Recursive qw( dircopy );
|
|
use IPC::Run3;
|
|
|
|
sub run ( $job, $blog_id ) {
|
|
$job->note( _mds_template => 'build_static' );
|
|
|
|
my $build_dir = $job->checkout_repo( $blog_id );
|
|
my $blog = $job->app->db->blog( $blog_id );
|
|
|
|
$job->note( is_clone_complete => 1 );
|
|
|
|
# Show the user the commit we're on.
|
|
$job->system_command( [ 'git', '-C', $build_dir->child('src')->to_string, 'log', '-1' ] );
|
|
|
|
$job->note( is_build_complete => 1 );
|
|
|
|
my $domain = $blog->domain->name;
|
|
|
|
foreach my $host ( qw( root@web-west.myjekyllblog.net root@web-east.myjekyllblog.net ) ) {
|
|
$job->system_command( [ qw( rsync -vrLptgoD --delete -e ), 'ssh -o StrictHostKeyChecking=no', $build_dir->child('src')->child('assets')->child('media')->to_string . "/", "$host:/var/www/$domain/html/assets/media" ] );
|
|
}
|
|
|
|
$job->note( is_deploy_complete => 1 );
|
|
|
|
$job->finish( );
|
|
}
|
|
|
|
1;
|
|
|