parent
98528e5a10
commit
8cef7d4b42
3 changed files with 42 additions and 2 deletions
@ -0,0 +1,31 @@ |
||||
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')->to_string . "/", "$host:/var/www/$domain/html/assets" ] ); |
||||
} |
||||
|
||||
$job->note( is_deploy_complete => 1 ); |
||||
|
||||
$job->finish( ); |
||||
} |
||||
|
||||
1; |
||||
Loading…
Reference in new issue