Merge pull request #864 from govi20

* pr/864:
  Polish "Add gitignore for VS Code"
  Add gitignore for VS Code
This commit is contained in:
Stephane Nicoll
2019-03-15 11:41:21 +01:00
3 changed files with 10 additions and 2 deletions

View File

@@ -39,17 +39,20 @@ public class GitIgnore {
private final GitIgnoreSection netBeans = new GitIgnoreSection("NetBeans"); private final GitIgnoreSection netBeans = new GitIgnoreSection("NetBeans");
private final GitIgnoreSection vscode = new GitIgnoreSection("VS Code");
public void write(PrintWriter writer) throws IOException { public void write(PrintWriter writer) throws IOException {
this.general.write(writer); this.general.write(writer);
this.sts.write(writer); this.sts.write(writer);
this.intellijIdea.write(writer); this.intellijIdea.write(writer);
this.netBeans.write(writer); this.netBeans.write(writer);
this.vscode.write(writer);
} }
public boolean isEmpty() { public boolean isEmpty() {
return this.general.getItems().isEmpty() && this.sts.getItems().isEmpty() return this.general.getItems().isEmpty() && this.sts.getItems().isEmpty()
&& this.intellijIdea.getItems().isEmpty() && this.intellijIdea.getItems().isEmpty()
&& this.netBeans.getItems().isEmpty(); && this.netBeans.getItems().isEmpty() && this.vscode.getItems().isEmpty();
} }
public GitIgnoreSection getGeneral() { public GitIgnoreSection getGeneral() {
@@ -68,6 +71,10 @@ public class GitIgnore {
return this.netBeans; return this.netBeans;
} }
public GitIgnoreSection getVscode() {
return this.vscode;
}
/** /**
* Representation of a section of a {@code .gitignore} file. * Representation of a section of a {@code .gitignore} file.
*/ */

View File

@@ -72,6 +72,7 @@ public class GitProjectGenerationConfiguration {
gitIgnore.getIntellijIdea().add(".idea", "*.iws", "*.iml", "*.ipr"); gitIgnore.getIntellijIdea().add(".idea", "*.iws", "*.iml", "*.ipr");
gitIgnore.getNetBeans().add("/nbproject/private/", "/nbbuild/", "/dist/", gitIgnore.getNetBeans().add("/nbproject/private/", "/nbbuild/", "/dist/",
"/nbdist/", "/.nb-gradle/"); "/nbdist/", "/.nb-gradle/");
gitIgnore.getVscode().add(".vscode/");
return gitIgnore; return gitIgnore;
} }

View File

@@ -61,7 +61,7 @@ class GitProjectGenerationConfigurationTests {
ProjectDescription description = new ProjectDescription(); ProjectDescription description = new ProjectDescription();
description.setBuildSystem(new GradleBuildSystem()); description.setBuildSystem(new GradleBuildSystem());
assertThat(generateGitIgnore(description)).contains("### STS ###", assertThat(generateGitIgnore(description)).contains("### STS ###",
"### IntelliJ IDEA ###", "### NetBeans ###"); "### IntelliJ IDEA ###", "### NetBeans ###", "### VS Code ###");
} }
@Test @Test