Skip to content

Commit

Permalink
Merge pull request #869 from matthieulapatate/GitInitScript
Browse files Browse the repository at this point in the history
Add git init script when initializing project
  • Loading branch information
pascalgrimaud authored Mar 8, 2022
2 parents 7eedc9c + 669df94 commit fb62525
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,8 @@ public void addEditorConfiguration(Project project) {
public void addPrettier(Project project) {
initService.addPrettier(project);
}

public void gitInit(Project project) {
initService.gitInit(project);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public void init(Project project) {
addEditorConfiguration(project);
addPrettier(project);
addPackageJson(project);
gitInit(project);
}

@Override
Expand Down Expand Up @@ -110,4 +111,9 @@ public void addPrettier(Project project) {
project.addConfig("prettierEndOfLine", CRLF.equals(project.getEndOfLine()) ? "crlf" : "lf");
projectRepository.template(project, SOURCE, ".prettierrc");
}

@Override
public void gitInit(Project project) {
projectRepository.gitInit(project);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ public interface InitService {
void addGitConfiguration(Project project);
void addEditorConfiguration(Project project);
void addPrettier(Project project);
void gitInit(Project project);
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ void shouldInitWithConfig() {
)
);
// @formatter:on
assertFileGitInit(project);
}

@Test
Expand Down Expand Up @@ -128,4 +129,13 @@ void shouldAddPrettier() {

assertFilesPrettier(project);
}

@Test
void shouldGitInit() {
Project project = tmpProject();

initApplicationService.gitInit(project);

assertFileGitInit(project);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,9 @@ public static void assertFilesInit(Project project) {
assertFilesEditorConfiguration(project);
assertFilesPrettier(project);
}

public static void assertFileGitInit(Project project) {
assertFileExist(project, ".git/config");
assertFileExist(project, ".git/HEAD");
}
}

0 comments on commit fb62525

Please sign in to comment.