feat: add brickgen template

This commit is contained in:
Hugo Pointcheval 2023-01-26 22:48:40 +01:00
parent 43b3df453f
commit 9638a23345
Signed by: hugo
GPG Key ID: 3AAC487E131E00BC
21 changed files with 455 additions and 0 deletions

View File

@ -0,0 +1,23 @@
<!--
* Copyright (C) 2023 WYATT GROUP
* Please see the AUTHORS file for details.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
-->
# Wyatt - Brick Template
> Brickception
Generated with `Brickgen`... to generate other `Brickgen` bricks.

View File

@ -0,0 +1,36 @@
name: wyatt_brick_template
description: Template to create a compilable project that can be converted with Brickgen
version: 0.1.0
vars:
brick_name:
compilable: brick_name
type: string
description: Name of the brick
default: brick_name
prompt: "What is the brick name?"
brick_description:
compilable: brick_description
type: string
description: Description of the brick
default: brick_description
prompt: "What is the brick description?"
hooks:
type: boolean
description: Enables hooks for this brick.
default: false
prompt: "Do you want to enable `hooks` for this brick ?"
brickgen:
path_to_brickify: wyatt_brick_template
hooks: true
ignore:
- .env
boolean_file_system:
hooks:
folders:
on_true:
- hooks

View File

@ -0,0 +1,39 @@
// Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:io';
import 'package:mason/mason.dart';
void removeGitKeepFiles(String targetPath) {
if (!FileSystemEntity.isDirectorySync(targetPath)) {
throw ArgumentError('Target must be a directory', 'targetPath');
}
Directory(targetPath)
.listSync(recursive: true)
.whereType<File>()
.forEach((file) {
if (file.path.contains('.gitkeep')) {
file.deleteSync(recursive: true);
}
});
}
Future<void> run(HookContext context) async {
final workingDirectory = Directory.current.path;
removeGitKeepFiles(workingDirectory);
}

View File

@ -0,0 +1,7 @@
name: hooks
environment:
sdk: ">=2.18.0 <3.0.0"
dependencies:
mason: any

View File

@ -0,0 +1,3 @@
# display_name
Brick generated with `Brickgen`.

View File

@ -0,0 +1,18 @@
<!--
Copyright (C) 2023 WYATT GROUP
Please see the AUTHORS file for details.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->

View File

@ -0,0 +1,16 @@
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -0,0 +1,18 @@
<!--
Copyright (C) 2023 WYATT GROUP
Please see the AUTHORS file for details.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->

View File

@ -0,0 +1,39 @@
name: brick_name
description: brick_description
version: 0.1.0
vars:
display_name:
compilable: display_name
type: string
description: The display name
default: Display Name
prompt: "What is the display name?"
product_name:
compilable: product_name
type: string
description: The product name
default: product_name
prompt: "What is the product name?"
flutter:
type: boolean
description: If this app is a Flutter or Dart application.
default: false
prompt: "Is this a Flutter appplication ?"
brickgen:
path_to_brickify: brick_name
hooks: true
ignore:
- .env
boolean_file_system:
flutter:
folders:
on_true:
- android
- ios
on_false:
- bin

View File

@ -0,0 +1,39 @@
// Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:io';
import 'package:mason/mason.dart';
void removeGitKeepFiles(String targetPath) {
if (!FileSystemEntity.isDirectorySync(targetPath)) {
throw ArgumentError('Target must be a directory', 'targetPath');
}
Directory(targetPath)
.listSync(recursive: true)
.whereType<File>()
.forEach((file) {
if (file.path.contains('.gitkeep')) {
file.deleteSync(recursive: true);
}
});
}
Future<void> run(HookContext context) async {
final workingDirectory = Directory.current.path;
removeGitKeepFiles(workingDirectory);
}

View File

@ -0,0 +1,7 @@
name: hooks
environment:
sdk: ">=2.18.0 <3.0.0"
dependencies:
mason: any

View File

@ -0,0 +1,39 @@
name: {{#snakeCase}}{{brick_name}}{{/snakeCase}}
description: {{#snakeCase}}{{brick_description}}{{/snakeCase}}
version: 0.1.0
vars:
display_name:
compilable: display_name
type: string
description: The display name
default: Display Name
prompt: "What is the display name?"
product_name:
compilable: product_name
type: string
description: The product name
default: product_name
prompt: "What is the product name?"
flutter:
type: boolean
description: If this app is a Flutter or Dart application.
default: false
prompt: "Is this a Flutter appplication ?"
brickgen:
path_to_brickify: {{#snakeCase}}{{brick_name}}{{/snakeCase}}
hooks: true
ignore:
- .env
boolean_file_system:
flutter:
folders:
on_true:
- android
- ios
on_false:
- bin

View File

@ -0,0 +1,39 @@
// Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:io';
import 'package:mason/mason.dart';
void removeGitKeepFiles(String targetPath) {
if (!FileSystemEntity.isDirectorySync(targetPath)) {
throw ArgumentError('Target must be a directory', 'targetPath');
}
Directory(targetPath)
.listSync(recursive: true)
.whereType<File>()
.forEach((file) {
if (file.path.contains('.gitkeep')) {
file.deleteSync(recursive: true);
}
});
}
Future<void> run(HookContext context) async {
final workingDirectory = Directory.current.path;
removeGitKeepFiles(workingDirectory);
}

View File

@ -0,0 +1,7 @@
name: hooks
environment:
sdk: ">=2.18.0 <3.0.0"
dependencies:
mason: any

View File

@ -0,0 +1,3 @@
# display_name
Brick generated with `Brickgen`.

View File

@ -0,0 +1,18 @@
<!--
Copyright (C) 2023 WYATT GROUP
Please see the AUTHORS file for details.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->

View File

@ -0,0 +1,16 @@
// Copyright (C) 2023 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

View File

@ -0,0 +1,18 @@
<!--
Copyright (C) 2023 WYATT GROUP
Please see the AUTHORS file for details.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
-->

View File

@ -0,0 +1,24 @@
name: wyatt_brick_template
description: Template to create a compilable project that can be converted with Brickgen
version: 0.1.0
vars:
brick_name:
type: string
description: Name of the brick
default: brick_name
prompt: What is the brick name?
brick_description:
type: string
description: Description of the brick
default: brick_description
prompt: What is the brick description?
hooks:
type: boolean
description: Enables hooks for this brick.
default: false
prompt: Do you want to enable `hooks` for this brick ?

View File

@ -0,0 +1,39 @@
// Copyright (C) 2022 WYATT GROUP
// Please see the AUTHORS file for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'dart:io';
import 'package:mason/mason.dart';
void removeGitKeepFiles(String targetPath) {
if (!FileSystemEntity.isDirectorySync(targetPath)) {
throw ArgumentError('Target must be a directory', 'targetPath');
}
Directory(targetPath)
.listSync(recursive: true)
.whereType<File>()
.forEach((file) {
if (file.path.contains('.gitkeep')) {
file.deleteSync(recursive: true);
}
});
}
Future<void> run(HookContext context) async {
final workingDirectory = Directory.current.path;
removeGitKeepFiles(workingDirectory);
}

View File

@ -0,0 +1,7 @@
name: hooks
environment:
sdk: ">=2.18.0 <3.0.0"
dependencies:
mason: any