diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..7b93245a8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Very Good Ventures + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/templates/very_good_core/LICENSE b/templates/very_good_core/LICENSE new file mode 100644 index 000000000..7b93245a8 --- /dev/null +++ b/templates/very_good_core/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Very Good Ventures + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/tool/generator/main.dart b/tool/generator/main.dart index bcb54e88f..72ba13652 100644 --- a/tool/generator/main.dart +++ b/tool/generator/main.dart @@ -8,6 +8,15 @@ final _targetPath = path.join( '__brick__', ); +const copyrightHeader = ''' +// Copyright (c) 2021, Very Good Ventures +// https://verygood.ventures +// +// Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file or at +// https://opensource.org/licenses/MIT. +'''; + void main() async { // Remove Previously Generated Files final targetDir = Directory(_targetPath); @@ -27,6 +36,11 @@ void main() async { var file = _; try { + if (path.extension(file.path) == '.dart') { + final contents = await file.readAsString(); + file = await file.writeAsString('$copyrightHeader\n$contents'); + } + final contents = await file.readAsString(); file = await file.writeAsString( contents @@ -37,19 +51,17 @@ void main() async { '{{#titleCase}}{{project_name}}{{/titleCase}}', ), ); + final fileSegments = file.path.split('/').sublist(3); + if (fileSegments.contains('very_good_core')) { + final newPathSegment = fileSegments + .join('/') + .replaceAll('very_good_core', '{{project_name}}'); + final newPath = path.join(_targetPath, newPathSegment); + File(newPath).createSync(recursive: true); + file.renameSync(newPath); + Directory(file.parent.path).deleteSync(recursive: true); + } } catch (_) {} - - final fileSegments = file.path.split('/').sublist(3); - if (fileSegments.contains('very_good_core')) { - final newPathSegment = fileSegments.join('/').replaceAll( - 'very_good_core', - '{{project_name}}', - ); - final newPath = path.join(_targetPath, newPathSegment); - File(newPath).createSync(recursive: true); - file.renameSync(newPath); - Directory(file.parent.path).deleteSync(recursive: true); - } }), ); }