This commit is contained in:
Tobe O 2019-01-25 11:02:38 -05:00
parent 449a71100e
commit 589c40415c
5 changed files with 35 additions and 12 deletions

View file

@ -1,3 +1,7 @@
# 2.1.5
* Add `shared` boilerplates.
* Remove uncecessary `angel_model` imports.
# 2.1.4+1
* Patch `part of 'path'` renames.

View file

@ -240,10 +240,24 @@ const BoilerplateInfo legacyBoilerplate = const BoilerplateInfo(
ref: '1.1.x',
);
const BoilerplateInfo sharedBoilerplate = const BoilerplateInfo(
'Shared',
'Holds common models and files shared across multiple Dart projects.',
'https://github.com/angel-dart/boilerplate_shared.git');
const BoilerplateInfo sharedOrmBoilerplate = const BoilerplateInfo(
'Shared (ORM)',
'Holds common models and files shared across multiple Dart projects.',
'https://github.com/angel-dart/boilerplate_shared.git',
ref: 'orm',
);
const List<BoilerplateInfo> boilerplates = const [
basicBoilerplate,
//legacyBoilerplate,
ormBoilerplate,
sharedBoilerplate,
sharedOrmBoilerplate,
];
class BoilerplateInfo {

View file

@ -54,9 +54,6 @@ class ModelCommand extends Command {
]);
}
modelLib.directives
.add(new Directive.import('package:angel_model/angel_model.dart'));
var needsSerialize = argResults['serializable'] as bool ||
argResults['orm'] as bool ||
argResults['migration'] as bool;
@ -67,6 +64,10 @@ class ModelCommand extends Command {
deps.add(const MakerDependency('angel_serialize', '^2.0.0'));
deps.add(const MakerDependency('angel_serialize_generator', '^2.0.0'));
deps.add(const MakerDependency('build_runner', '">=0.7.0 <0.10.0"'));
} else {
modelLib.directives
.add(new Directive.import('package:angel_model/angel_model.dart'));
deps.add(const MakerDependency('angel_model', '^1.0.0'));
}
if (argResults['orm'] as bool || argResults['migration'] as bool) {

View file

@ -81,18 +81,22 @@ renamePubspec(Directory dir, String oldName, String newName) async {
}
renameDartFiles(Directory dir, String oldName, String newName) async {
if (!await dir.exists()) return;
// Try to replace MongoDB URL
var configGlob = new Glob('config/**/*.yaml');
await for (var yamlFile in configGlob.list(root: dir.absolute.path)) {
if (yamlFile is File) {
print(
'Replacing occurrences of "$oldName" with "$newName" in file "${yamlFile.absolute.path}"...');
var contents = await yamlFile.readAsString();
contents = contents.replaceAll(oldName, newName);
await yamlFile.writeAsString(contents);
try {
await for (var yamlFile in configGlob.list(root: dir.absolute.path)) {
if (yamlFile is File) {
print(
'Replacing occurrences of "$oldName" with "$newName" in file "${yamlFile.absolute.path}"...');
var contents = await yamlFile.readAsString();
contents = contents.replaceAll(oldName, newName);
await yamlFile.writeAsString(contents);
}
}
}
} catch (_) {}
var entry = new File.fromUri(dir.uri.resolve('lib/$oldName.dart'));

View file

@ -2,7 +2,7 @@ author: Tobe O <thosakwe@gmail.com>
description: Command-line tools for the Angel framework.
homepage: https://github.com/angel-dart/angel_cli
name: angel_cli
version: 2.1.4+1
version: 2.1.5
dependencies:
analyzer: ">=0.32.0"
args: ^1.0.0