Skip to content

Commit 1687438

Browse files
committed
Rename maven plugin goal names
1 parent 242716d commit 1687438

File tree

18 files changed

+112
-112
lines changed

18 files changed

+112
-112
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=pepperkit_git-hooks-maven-plugin&metric=security_rating)](https://sonarcloud.io/dashboard?id=pepperkit_git-hooks-maven-plugin)
77

88
Maven plugin for easy git hooks configuration. Provides three goals to work with git hooks:
9-
1. `init` - installs configured git hooks;
10-
2. `validate` - prints all or specific hooks installed at the moment, to make sure that the plugin was configured correctly;
11-
3. `test` - executes all or specific hooks installed at the moment, to make sure that the hooks work as expected,
9+
1. `initHooks` - installs configured git hooks;
10+
2. `printHooks` - prints all or specific hooks installed at the moment, to make sure that the plugin was configured correctly;
11+
3. `executeHooks` - executes all or specific hooks installed at the moment, to make sure that the hooks work as expected,
1212
without the need to actually trigger the hook with git action.
1313

1414
## Usage
@@ -26,7 +26,7 @@ The example with *pre-commit* and *pre-push* hooks configured, will look like it
2626
<!-- It will automatically trigger `init` goal at each initialize project maven phase. -->
2727
<execution>
2828
<goals>
29-
<goal>init</goal>
29+
<goal>initHooks</goal>
3030
</goals>
3131
</execution>
3232
</executions>
@@ -44,11 +44,11 @@ Hook's content is any command line script, which is considered successful if exi
4444
If execution of the script is successful, git action will be proceeded, if not - it will be cancelled.
4545

4646
Then you can execute one of the following goals manually:
47-
1. `mvn io.github.pepperkit:git-hooks-maven-plugin:init` - to manually install configured git hooks;
48-
2. `mvn io.github.pepperkit:git-hooks-maven-plugin:validate` - print all the installed hooks to the console;
49-
3. `mvn -DhookName=<hookName> io.github.pepperkit:git-hooks-maven-plugin:validate` - print only the specified hook;
50-
4. `mvn io.github.pepperkit:git-hooks-maven-plugin:test` - execute all the installed hooks;
51-
5. `mvn -DhookName=<hookName> io.github.pepperkit:git-hooks-maven-plugin:test` - execute only the specified hook.
47+
1. `mvn io.github.pepperkit:git-hooks-maven-plugin:initHooks` - to manually install configured git hooks;
48+
2. `mvn io.github.pepperkit:git-hooks-maven-plugin:printHooks` - print all the installed hooks to the console;
49+
3. `mvn -DhookName=<hookName> io.github.pepperkit:git-hooks-maven-plugin:printHooks` - print only the specified hook;
50+
4. `mvn io.github.pepperkit:git-hooks-maven-plugin:executeHooks` - execute all the installed hooks;
51+
5. `mvn -DhookName=<hookName> io.github.pepperkit:git-hooks-maven-plugin:executeHooks` - execute only the specified hook.
5252

5353
## Project's structure
5454
```

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.pepperkit</groupId>
88
<artifactId>git-hooks-maven-plugin</artifactId>
9-
<version>0.9.0-SNAPSHOT</version>
9+
<version>1.0.0-SNAPSHOT</version>
1010
<packaging>maven-plugin</packaging>
1111
<name>Git Hooks Maven Plugin</name>
1212
<description>Maven plugin, which enables control on git hooks via easy configuration.</description>

src/main/java/io/github/pepperkit/githooks/TestMojo.java renamed to src/main/java/io/github/pepperkit/githooks/ExecuteHooksMojo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
* Executes all or specific hooks installed at the moment, to make sure that the hooks work as expected,
1616
* without the need to actually trigger the hook with git action.
1717
*/
18-
@Mojo(name = "test")
19-
public class TestMojo extends AbstractMojo {
18+
@Mojo(name = "executeHooks")
19+
public class ExecuteHooksMojo extends AbstractMojo {
2020

2121
/**
2222
* The name of the hook to be tested. If not provided, all the hooks will be tested.

src/main/java/io/github/pepperkit/githooks/GitHooksActionProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void processHooks(GitHooksAction action, String hookName, Log logger) thr
3939
}
4040
if (hooksProcessed == 0) {
4141
logger.info("No hooks are configured. Make sure you have correctly configured plugin "
42-
+ "and ran init goal first to install the hooks.");
42+
+ "and ran initHooks goal first to install the hooks.");
4343
}
4444
} else {
4545
hookNameBeingProcessed = hookName;

src/main/java/io/github/pepperkit/githooks/InitMojo.java renamed to src/main/java/io/github/pepperkit/githooks/InitHooksMojo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
/**
2121
* The main Mojo, installs configured git hooks.
2222
*/
23-
@Mojo(name = "init", defaultPhase = LifecyclePhase.INITIALIZE)
24-
public class InitMojo extends AbstractMojo {
23+
@Mojo(name = "initHooks", defaultPhase = LifecyclePhase.INITIALIZE)
24+
public class InitHooksMojo extends AbstractMojo {
2525

2626
/**
2727
* Hooks configured by the user.

src/main/java/io/github/pepperkit/githooks/ValidateMojo.java renamed to src/main/java/io/github/pepperkit/githooks/PrintHooksMojo.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
/**
1515
* Prints all or specific hooks installed at the moment, to make sure that the plugin was configured correctly.
1616
*/
17-
@Mojo(name = "validate")
18-
public class ValidateMojo extends AbstractMojo {
17+
@Mojo(name = "printHooks")
18+
public class PrintHooksMojo extends AbstractMojo {
1919

2020
/**
2121
* The name of the hook to be validated. If not provided, all the hooks will be validated.

src/system-test/java/io/github/pepperkit/githooks/steps/BaseMojoSysTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@
1111
import org.testcontainers.containers.GenericContainer;
1212
import org.testcontainers.containers.startupcheck.IsRunningStartupCheckStrategy;
1313
import org.testcontainers.images.builder.ImageFromDockerfile;
14-
import org.testcontainers.junit.jupiter.Container;
1514
import org.testcontainers.junit.jupiter.Testcontainers;
1615

1716
@Testcontainers
1817
public class BaseMojoSysTest {
1918

2019
public static org.testcontainers.containers.Container.ExecResult cmdResult;
2120

22-
public static GenericContainer<?> container = new GenericContainer<>(new ImageFromDockerfile()
23-
.withFileFromPath(".", Paths.get(".")))
24-
.withWorkingDirectory("/test-projects")
25-
.withStartupCheckStrategy(new IsRunningStartupCheckStrategy())
26-
.withCreateContainerCmdModifier(cmd -> cmd
27-
.withStdinOpen(true)
28-
.withTty(true)
29-
.withCmd("/bin/sh"));
21+
public static GenericContainer<?> container = new GenericContainer<>(
22+
new ImageFromDockerfile("git-hooks-maven-plugin-test", true)
23+
.withFileFromPath(".", Paths.get(".")))
24+
.withWorkingDirectory("/test-projects")
25+
.withStartupCheckStrategy(new IsRunningStartupCheckStrategy())
26+
.withCreateContainerCmdModifier(cmd -> cmd
27+
.withStdinOpen(true)
28+
.withTty(true)
29+
.withCmd("/bin/sh"));
3030
}

src/system-test/java/io/github/pepperkit/githooks/steps/GivenStepDefinitions.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public void repoIsSetUp() throws IOException, InterruptedException {
2929
container.execInContainer("git", "init");
3030
}
3131

32-
@Given("init goal was launched before with hooks presented in configuration")
33-
@Given("init goal was launched before with the specified hook presented in configuration")
32+
@Given("initHooks goal was launched before with hooks presented in configuration")
33+
@Given("initHooks goal was launched before with the specified hook presented in configuration")
3434
public void initWithHooksConfigured() throws IOException, InterruptedException {
3535
cmdResult = container.execInContainer("mvn", "-f", "pre_commit_push_hooks-pom.xml",
36-
"io.github.pepperkit:git-hooks-maven-plugin:init");
36+
"io.github.pepperkit:git-hooks-maven-plugin:initHooks");
3737
assertThat(cmdResult.getStdout())
3838
.contains("BUILD SUCCESS");
3939

@@ -42,11 +42,11 @@ public void initWithHooksConfigured() throws IOException, InterruptedException {
4242
.contains("pre-commit hook is invoked");
4343
}
4444

45-
@Given("init goal was launched before with no hooks presented in configuration")
46-
@Given("init goal was launched before with the specified hook not presented in configuration")
45+
@Given("initHooks goal was launched before with no hooks presented in configuration")
46+
@Given("initHooks goal was launched before with the specified hook not presented in configuration")
4747
public void initWithNoHooksConfigured() throws IOException, InterruptedException {
4848
cmdResult = container.execInContainer("mvn", "-f", "no_hooks-pom.xml",
49-
"io.github.pepperkit:git-hooks-maven-plugin:init");
49+
"io.github.pepperkit:git-hooks-maven-plugin:initHooks");
5050
assertThat(cmdResult.getStdout())
5151
.contains("BUILD SUCCESS");
5252
}

src/system-test/java/io/github/pepperkit/githooks/steps/ThenStepDefinitions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void printsAllHooksInstalled() {
7373
public void printsNoHooksConfigured() {
7474
assertThat(cmdResult.getStdout())
7575
.contains("No hooks are configured. Make sure you have correctly configured plugin and "
76-
+ "ran init goal first to install the hooks.")
76+
+ "ran initHooks goal first to install the hooks.")
7777
.contains("BUILD SUCCESS");
7878
}
7979

src/system-test/java/io/github/pepperkit/githooks/steps/WhenStepDefinitions.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,45 @@
1111
import io.cucumber.java.en.When;
1212

1313
import static org.assertj.core.api.Assertions.assertThat;
14-
import static org.junit.jupiter.api.Assertions.assertTrue;
1514

1615
public class WhenStepDefinitions extends BaseMojoSysTest {
1716

18-
@When("init goal of the plugin is launched with hooks presented in plugin's configuration")
17+
@When("initHooks goal of the plugin is launched with hooks presented in plugin's configuration")
1918
public void initGoalIsLaunchedWithHooks() throws IOException, InterruptedException {
2019
cmdResult = container.execInContainer("mvn", "-f", "pre_commit_push_hooks-pom.xml",
21-
"io.github.pepperkit:git-hooks-maven-plugin:init");
20+
"io.github.pepperkit:git-hooks-maven-plugin:initHooks");
2221
}
2322

24-
@When("init goal of the plugin is launched with hooks deleted from plugin's configuration")
25-
@When("init goal of the plugin is launched with another plugin's configuration")
23+
@When("initHooks goal of the plugin is launched with hooks deleted from plugin's configuration")
24+
@When("initHooks goal of the plugin is launched with another plugin's configuration")
2625
public void hooksDeletedFromPom() throws IOException, InterruptedException {
2726
cmdResult = container.execInContainer("mvn", "-f", "no_hooks-pom.xml",
28-
"io.github.pepperkit:git-hooks-maven-plugin:init");
27+
"io.github.pepperkit:git-hooks-maven-plugin:initHooks");
2928
assertThat(cmdResult.getStdout())
3029
.contains("BUILD SUCCESS");
3130
}
3231

33-
@When("validate goal of plugin is launched without specifying a particular hook")
32+
@When("printHooks goal of plugin is launched without specifying a particular hook")
3433
public void validateGoalLaunchedWithoutSpecificHooks() throws IOException, InterruptedException {
3534
cmdResult = container.execInContainer("mvn", "-f", "pre_commit_push_hooks-pom.xml",
36-
"io.github.pepperkit:git-hooks-maven-plugin:validate");
35+
"io.github.pepperkit:git-hooks-maven-plugin:printHooks");
3736
}
3837

39-
@When("validate goal of plugin is launched with the specific hook name provided")
38+
@When("printHooks goal of plugin is launched with the specific hook name provided")
4039
public void validateGoalLaunchedWithPreCommitHookSpecified() throws IOException, InterruptedException {
4140
cmdResult = container.execInContainer("mvn", "-f", "pre_commit_push_hooks-pom.xml",
42-
"-DhookName=pre-commit", "io.github.pepperkit:git-hooks-maven-plugin:validate");
41+
"-DhookName=pre-commit", "io.github.pepperkit:git-hooks-maven-plugin:printHooks");
4342
}
4443

45-
@When("test goal of plugin is launched without specifying a particular hook")
44+
@When("executeHooks goal of plugin is launched without specifying a particular hook")
4645
public void testGoalLaunchedWithoutSpecificHooks() throws IOException, InterruptedException {
4746
cmdResult = container.execInContainer("mvn", "-f", "pre_commit_push_hooks-pom.xml",
48-
"io.github.pepperkit:git-hooks-maven-plugin:test");
47+
"io.github.pepperkit:git-hooks-maven-plugin:executeHooks");
4948
}
5049

51-
@When("test goal of plugin is launched with the specific hook name provided")
50+
@When("executeHooks goal of plugin is launched with the specific hook name provided")
5251
public void testGoalLaunchedWithPrePushHookSpecified() throws IOException, InterruptedException {
5352
cmdResult = container.execInContainer("mvn", "-f", "pre_commit_push_hooks-pom.xml",
54-
"-DhookName=pre-push", "io.github.pepperkit:git-hooks-maven-plugin:test");
53+
"-DhookName=pre-push", "io.github.pepperkit:git-hooks-maven-plugin:executeHooks");
5554
}
5655
}

0 commit comments

Comments
 (0)