diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ad85a9..9f2607c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.1.3 +* Fix generation of ORM models. +* A `--project-name` to `init` command. + # 2.1.2 * No migrations-by-default. diff --git a/lib/src/commands/init.dart b/lib/src/commands/init.dart index 9915891..53e355a 100644 --- a/lib/src/commands/init.dart +++ b/lib/src/commands/init.dart @@ -22,7 +22,10 @@ class InitCommand extends Command { "Initializes a new Angel project in the current directory."; InitCommand() { - argParser..addFlag('pub-get', defaultsTo: true); + argParser + ..addFlag('pub-get', defaultsTo: true) + ..addOption('project-name', + abbr: 'n', help: 'The name for this project.'); } @override @@ -44,8 +47,11 @@ class InitCommand extends Command { new File.fromUri(projectDir.uri.resolve('config/production.yaml')), secret); - var name = p.basenameWithoutExtension( - projectDir.absolute.uri.normalizePath().toFilePath()); + var name = argResults.wasParsed('project-name') + ? argResults['project-name'] as String + : p.basenameWithoutExtension( + projectDir.absolute.uri.normalizePath().toFilePath()); + name = ReCase(name).snakeCase; print('Renaming project from "angel" to "$name"...'); await renamePubspec(projectDir, 'angel', name); diff --git a/lib/src/commands/make/model.dart b/lib/src/commands/make/model.dart index ceda14d..f40b3d9 100644 --- a/lib/src/commands/make/model.dart +++ b/lib/src/commands/make/model.dart @@ -98,8 +98,8 @@ class ModelCommand extends Command { if (argResults['migration'] as bool) { modelClazz.annotations.add(refer('orm')); } else { - modelClazz.annotations.add(refer('Orm') - .newInstance([], {'generateMigration': literalFalse})); + modelClazz.annotations.add( + refer('Orm').call([], {'generateMigration': literalFalse})); } } })); diff --git a/lib/src/commands/rename.dart b/lib/src/commands/rename.dart index b62597e..553f359 100644 --- a/lib/src/commands/rename.dart +++ b/lib/src/commands/rename.dart @@ -29,7 +29,7 @@ class RenameCommand extends Command { newName = prompts.get('Rename project to'); } - newName = new Recase(newName).snakeCase; + newName = new ReCase(newName).snakeCase; var choice = prompts.getBool('Rename the project to `$newName`?'); diff --git a/pubspec.yaml b/pubspec.yaml index 8901043..ecfea27 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ author: Tobe O description: Command-line tools for the Angel framework. homepage: https://github.com/angel-dart/angel_cli name: angel_cli -version: 2.1.2 +version: 2.1.3 dependencies: analyzer: ">=0.32.0" args: ^1.0.0