|
|
|
|
@ -44,6 +44,14 @@ has repo => ( |
|
|
|
|
required => 1, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
#== |
|
|
|
|
# When set to true, push the repo after any action that changes it. |
|
|
|
|
#== |
|
|
|
|
has push_on_change => ( |
|
|
|
|
is => 'ro', |
|
|
|
|
default => sub { 1 }, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
#== |
|
|
|
|
# The full local path (i.e. /var/repos/domain.com ) to the git repository that we will execute git commands in. |
|
|
|
|
#== |
|
|
|
|
@ -117,7 +125,7 @@ sub init { |
|
|
|
|
# Push the repo to the store |
|
|
|
|
$self->system_command( [ qw( git push origin master ) ], { |
|
|
|
|
chdir => $self->repo_path, |
|
|
|
|
}); |
|
|
|
|
}) if $self->push_on_change; |
|
|
|
|
|
|
|
|
|
return $self; |
|
|
|
|
} |
|
|
|
|
@ -206,7 +214,7 @@ sub remove_markdown_file { |
|
|
|
|
# Push the changes |
|
|
|
|
$self->system_command( [ qw( git push origin master ) ], { |
|
|
|
|
chdir => $self->repo_path, |
|
|
|
|
}); |
|
|
|
|
}) if $self->push_on_change; |
|
|
|
|
|
|
|
|
|
return $self; |
|
|
|
|
} |
|
|
|
|
@ -349,7 +357,7 @@ sub write_config { |
|
|
|
|
# Push the repo to the store server |
|
|
|
|
$self->system_command( [ qw( git push origin master ) ], { |
|
|
|
|
chdir => $self->repo_path, |
|
|
|
|
}); |
|
|
|
|
}) if $self->push_on_change; |
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
@ -382,7 +390,7 @@ sub write_post { |
|
|
|
|
# Push the repo to the store server |
|
|
|
|
$self->system_command( [ qw( git push origin master ) ], { |
|
|
|
|
chdir => $self->repo_path, |
|
|
|
|
}); |
|
|
|
|
}) if $self->push_on_change; |
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
@ -412,7 +420,7 @@ sub commit_file { |
|
|
|
|
# Push the repo to the store server |
|
|
|
|
$self->system_command( [ qw( git push origin master ) ], { |
|
|
|
|
chdir => $self->repo_path, |
|
|
|
|
}); |
|
|
|
|
}) if $self->push_on_change; |
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
|
|
@ -443,7 +451,7 @@ sub remove_file { |
|
|
|
|
# Push the repo to the store server |
|
|
|
|
$self->system_command( [ qw( git push origin master ) ], { |
|
|
|
|
chdir => $self->repo_path, |
|
|
|
|
}); |
|
|
|
|
}) if $self->push_on_change; |
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
|
|
@ -471,7 +479,7 @@ sub restore_commit { |
|
|
|
|
# Push the repo to the store server |
|
|
|
|
$self->system_command( [ qw( git push origin master ) ], { |
|
|
|
|
chdir => $self->repo_path, |
|
|
|
|
}); |
|
|
|
|
}) if $self->push_on_change; |
|
|
|
|
|
|
|
|
|
return 1; |
|
|
|
|
|
|
|
|
|
@ -578,11 +586,11 @@ sub system_command { |
|
|
|
|
die "Error: directory " . $settings->{chdir} . "doesn't exist." |
|
|
|
|
unless -d $settings->{chdir}; |
|
|
|
|
|
|
|
|
|
$settings->{return_chdir} = getcwd(); |
|
|
|
|
|
|
|
|
|
# Change to that directory, or die with error. |
|
|
|
|
chdir $settings->{chdir} |
|
|
|
|
or die "Failed to chdir to " . $settings->{chdir} . ": $!"; |
|
|
|
|
|
|
|
|
|
$settings->{return_chdir} = getcwd(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Mask values we don't want exposed in the logs. |
|
|
|
|
@ -634,7 +642,7 @@ sub system_command { |
|
|
|
|
# Return to the directory we started in if we chdir'ed. |
|
|
|
|
if ( $settings->{return_chdir} ) { |
|
|
|
|
chdir $settings->{return_chdir} |
|
|
|
|
or die "Failed to chdir to " . $settings->{chdir} . ": $!"; |
|
|
|
|
or die "Failed to chdir to " . $settings->{return_chdir} . ": $!"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if ( $ENV{MJB_DEBUG} ) { |
|
|
|
|
|