Skip to content

Commit

Permalink
fix: Addition of .gitignore.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Jan 5, 2023
1 parent 7664fad commit 3ff816c
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/katana_cli/lib/code/github_actions/android.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class GithubActionsAndroidCliCode extends CliCode {
@override
String body(String path, String baseName, String className) {
return r"""
name: Production Workflow
name: Android Production Workflow
on:
# This workflow runs when there is a push on the publish branch.
Expand Down
2 changes: 1 addition & 1 deletion packages/katana_cli/lib/code/github_actions/ios.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class GithubActionsIOSCliCode extends CliCode {
@override
String body(String path, String baseName, String className) {
return r"""
name: Production Workflow
name: IOS Production Workflow
on:
# This workflow runs when there is a push on the publish branch.
Expand Down
3 changes: 3 additions & 0 deletions packages/katana_cli/lib/command/app/keystore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ class AppKeystoreCliCommand extends CliCommand {
if (!gitignores.any((e) => e.startsWith("**/*.p12"))) {
gitignores.add("**/*.p12");
}
if (!gitignores.any((e) => e.startsWith("*.json"))) {
gitignores.add("*.json");
}
if (!gitignores.any((e) => e.startsWith("**/appkey_fingerprint.txt"))) {
gitignores.add("**/appkey_fingerprint.txt");
}
Expand Down
53 changes: 53 additions & 0 deletions packages/katana_cli/lib/command/github/action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,27 @@ class GithubActionCliCommand extends CliCommand {
);
await const GithubActionsAndroidCliCode()
.generateFile("build_android.yaml");
label("Rewrite `.gitignore`.");
final gitignore = File("android/.gitignore");
if (!gitignore.existsSync()) {
print("Cannot find `android/.gitignore`. Project is broken.");
return;
}
final gitignores = await gitignore.readAsLines();
if (!gitignores.any((e) => e.startsWith("**/*.p12"))) {
gitignores.add("**/*.p12");
}
if (!gitignores.any((e) => e.startsWith("*.json"))) {
gitignores.add("*.json");
}
if (!gitignores
.any((e) => e.startsWith("**/appkey_fingerprint.txt"))) {
gitignores.add("**/appkey_fingerprint.txt");
}
if (!gitignores.any((e) => e.startsWith("**/appkey_password.key"))) {
gitignores.add("**/appkey_password.key");
}
await gitignore.writeAsString(gitignores.join("\n"));
break;
// IOS.
case "ios":
Expand Down Expand Up @@ -249,6 +270,38 @@ class GithubActionCliCommand extends CliCommand {
],
);
await const GithubActionsIOSCliCode().generateFile("build_ios.yaml");
label("Rewrite `.gitignore`.");
final gitignore = File("ios/.gitignore");
if (!gitignore.existsSync()) {
print("Cannot find `ios/.gitignore`. Project is broken.");
return;
}
final gitignores = await gitignore.readAsLines();
if (!gitignores.any((e) => e.startsWith("**/*.p12"))) {
gitignores.add("**/*.p12");
}
if (!gitignores.any((e) => e.startsWith("**/*.p8"))) {
gitignores.add("**/*.p8");
}
if (!gitignores.any((e) => e.startsWith("**/*.mobileprovision"))) {
gitignores.add("**/*.mobileprovision");
}
if (!gitignores.any((e) => e.startsWith("**/*.pem"))) {
gitignores.add("**/*.pem");
}
if (!gitignores.any((e) => e.startsWith("**/*.cer"))) {
gitignores.add("**/*.cer");
}
if (!gitignores.any((e) => e.startsWith("**/*.certSigningRequest"))) {
gitignores.add("**/*.certSigningRequest");
}
if (!gitignores
.any((e) => e.startsWith("**/ios_certificate_password.key"))) {
gitignores.add("**/ios_certificate_password.key");
}
if (!gitignores.any((e) => e.startsWith("**/ios_enterprise.key"))) {
gitignores.add("**/ios_enterprise.key");
}
break;
}
}
Expand Down

0 comments on commit 3ff816c

Please sign in to comment.