Skip to content

Commit

Permalink
Add skip parameters to mojos
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart Reilly authored and rudikershaw committed Aug 31, 2023
1 parent 8d59d99 commit 1d66b65
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/com/rudikershaw/gitbuildhook/GitConfigMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,17 @@ public class GitConfigMojo extends GitRepositoryValidator {
@Parameter
private Map<String, String> gitConfig;

/** Skip specifying custom git config settings. */
@Parameter(property = "gitbuildhook.gitconfig.skip", defaultValue = "false")
private boolean skip;

@Override
public void execute() throws MojoFailureException {
if (skip) {
getLog().debug("Skipping");
return;
}

// This goal requires the project to have a git repository initialized.
validateGitRepository(project);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,17 @@ public class InitialiseMojo extends AbstractMojo {
@Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;

/** Skip initialising the git repo. */
@Parameter(property = "gitbuildhook.init.skip", defaultValue = "false")
private boolean skip;

@Override
public void execute() throws MojoFailureException {
if (skip) {
getLog().debug("Skipping");
return;
}

if (!isGitRepoInitialised()) {
initialiseGitRepository();
} else {
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/com/rudikershaw/gitbuildhook/InstallMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,17 @@ public class InstallMojo extends GitRepositoryValidator {
@Parameter(defaultValue = "${project}", readonly = true, required = true)
private MavenProject project;

/** Skip installing hooks. */
@Parameter(property = "gitbuildhook.install.skip", defaultValue = "false")
private boolean skip;

@Override
public void execute() throws MojoFailureException {
if (skip) {
getLog().debug("Skipping");
return;
}

// This goal requires the project to have a git repository initialized.
validateGitRepository(project);

Expand Down

0 comments on commit 1d66b65

Please sign in to comment.