Skip to content

Commit

Permalink
Merge pull request #41655 from Thevakumar-Luheerathan/update-gitignor…
Browse files Browse the repository at this point in the history
…e-with-comments

Update .gitignore template with comments
  • Loading branch information
Thevakumar-Luheerathan authored Nov 8, 2023
2 parents 90eacfe + 370ccde commit 4f4b7fd
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 7 deletions.
12 changes: 10 additions & 2 deletions cli/ballerina-cli/src/main/resources/new_cmd_defaults/gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
target
generated
# Ballerina generates this directory during the compilation of a package.
# It contains compiler-generated artifacts and the final executable if this is an application package.
target/

# Ballerina maintains the compiler-generated source code here.
# Remove this if you want to commit generated sources.
generated/

# Contains configuration values used during development time.
# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.
Config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,16 @@ public void testNewCommand() throws IOException {
Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME)));
String gitignoreContent = Files.readString(
packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME), StandardCharsets.UTF_8);
String expectedGitignoreContent = "target\ngenerated\n" +
String expectedGitignoreContent = "# Ballerina generates this directory during the compilation of a package. " +
"\n# It contains compiler-generated artifacts and the final executable if this is an application " +
"package.\ntarget/\n" +
"\n" +
"# Ballerina maintains the compiler-generated source code here.\n" +
"# Remove this if you want to commit generated sources.\n" +
"generated/\n" +
"\n" +
"# Contains configuration values used during development time.\n" +
"# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.\n" +
"Config.toml\n";
Assert.assertEquals(gitignoreContent.trim(), expectedGitignoreContent.trim());
Assert.assertTrue(readOutput().contains("Created new package"));
Expand Down Expand Up @@ -158,7 +167,16 @@ public void testNewCommandInExistingDirectory() throws IOException {
Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME)));
String gitignoreContent = Files.readString(
packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME), StandardCharsets.UTF_8);
String expectedGitignoreContent = "target\ngenerated\n" +
String expectedGitignoreContent = "# Ballerina generates this directory during the compilation of a package. " +
"\n# It contains compiler-generated artifacts and the final executable if this is an application " +
"package.\ntarget/\n" +
"\n" +
"# Ballerina maintains the compiler-generated source code here.\n" +
"# Remove this if you want to commit generated sources.\n" +
"generated/\n" +
"\n" +
"# Contains configuration values used during development time.\n" +
"# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.\n" +
"Config.toml\n";
Assert.assertEquals(gitignoreContent.trim(), expectedGitignoreContent.trim());
Assert.assertTrue(readOutput().contains("Created new package"));
Expand Down Expand Up @@ -201,7 +219,16 @@ public void testNewCommandInExistingDirectoryWithExistingBalFilesForDefaultTempl
Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME)));
String gitignoreContent = Files.readString(
packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME), StandardCharsets.UTF_8);
String expectedGitignoreContent = "target\ngenerated\n" +
String expectedGitignoreContent = "# Ballerina generates this directory during the compilation of a package. " +
"\n# It contains compiler-generated artifacts and the final executable if this is an application " +
"package.\ntarget/\n" +
"\n" +
"# Ballerina maintains the compiler-generated source code here.\n" +
"# Remove this if you want to commit generated sources.\n" +
"generated/\n" +
"\n" +
"# Contains configuration values used during development time.\n" +
"# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.\n" +
"Config.toml\n";
Assert.assertEquals(gitignoreContent.trim(), expectedGitignoreContent.trim());
Assert.assertTrue(readOutput().contains("Created new package"));
Expand Down Expand Up @@ -332,7 +359,16 @@ public void testNewCommandInExistingDirectoryWithInvalidName() throws IOExceptio
Assert.assertTrue(Files.exists(packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME)));
String gitignoreContent = Files.readString(
packageDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME), StandardCharsets.UTF_8);
String expectedGitignoreContent = "target\ngenerated\n" +
String expectedGitignoreContent = "# Ballerina generates this directory during the compilation of a package. " +
"\n# It contains compiler-generated artifacts and the final executable if this is an application " +
"package.\ntarget/\n" +
"\n" +
"# Ballerina maintains the compiler-generated source code here.\n" +
"# Remove this if you want to commit generated sources.\n" +
"generated/\n" +
"\n" +
"# Contains configuration values used during development time.\n" +
"# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.\n" +
"Config.toml\n";
Assert.assertEquals(gitignoreContent.trim(), expectedGitignoreContent.trim());
Assert.assertTrue(readOutput().contains("Created new package"));
Expand Down Expand Up @@ -382,7 +418,16 @@ public void testNewCommandWithRelativePath() throws IOException {
Assert.assertTrue(Files.exists(relativeToCurrentDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME)));
String gitignoreContent = Files.readString(
relativeToCurrentDir.resolve(ProjectConstants.GITIGNORE_FILE_NAME), StandardCharsets.UTF_8);
String expectedGitignoreContent = "target\ngenerated\n" +
String expectedGitignoreContent = "# Ballerina generates this directory during the compilation of a package. " +
"\n# It contains compiler-generated artifacts and the final executable if this is an application " +
"package.\ntarget/\n" +
"\n" +
"# Ballerina maintains the compiler-generated source code here.\n" +
"# Remove this if you want to commit generated sources.\n" +
"generated/\n" +
"\n" +
"# Contains configuration values used during development time.\n" +
"# See https://ballerina.io/learn/provide-values-to-configurable-variables/ for more details.\n" +
"Config.toml\n";
Assert.assertEquals(gitignoreContent.trim(), expectedGitignoreContent.trim());
Assert.assertTrue(readOutput().contains("Created new package"));
Expand Down

0 comments on commit 4f4b7fd

Please sign in to comment.