parent
28806d99bf
commit
5d3572d881
3 changed files with 2 additions and 54 deletions
@ -1,41 +0,0 @@ |
||||
package MJB::Web::Task::CreateBlog; |
||||
use Mojo::Base 'MJB::Web::Task', -signatures; |
||||
use Mojo::File qw( tempdir ); |
||||
use File::Copy::Recursive qw( dircopy ); |
||||
|
||||
sub run ( $job, $blog_id ) { |
||||
my $blog = $job->app->db->blog( $blog_id ); |
||||
$job->note( _mds_template => 'create_blog' ); |
||||
|
||||
|
||||
my $dir = tempdir->make_path; |
||||
|
||||
$job->system_command( [qw( podman run -ti --rm -v .:/srv/jekyll -e JEKYLL_ROOTLESS=1 docker.io/jekyll/jekyll jekyll new blog ) ], { |
||||
chdir => $dir->to_string, |
||||
}); |
||||
|
||||
my $blog_root = $dir->child('blog'); |
||||
|
||||
$job->system_command( [ qw( git init ) ], { |
||||
chdir => $blog_root->to_string, |
||||
}); |
||||
|
||||
$job->system_command( [ qw( git remote add origin ), $blog->repo->url ], { |
||||
chdir => $blog_root->to_string, |
||||
}); |
||||
|
||||
$job->system_command( [ qw( git add * ) ], { |
||||
chdir => $blog_root->to_string, |
||||
}); |
||||
|
||||
$job->system_command( [ qw( git commit -m ), "Created blog!" ], { |
||||
chdir => $blog_root->to_string, |
||||
}); |
||||
|
||||
$job->system_command( [ qw( git push origin master ) ], { |
||||
chdir => $blog_root->to_string, |
||||
}); |
||||
|
||||
} |
||||
|
||||
1; |
||||
Loading…
Reference in new issue