This commit is contained in:
Tobe O 2019-01-09 12:46:12 -05:00
parent 0e56cc808c
commit eb82f173a6
5 changed files with 17 additions and 7 deletions

View file

@ -1,3 +1,7 @@
# 2.1.3
* Fix generation of ORM models.
* A `--project-name` to `init` command.
# 2.1.2 # 2.1.2
* No migrations-by-default. * No migrations-by-default.

View file

@ -22,7 +22,10 @@ class InitCommand extends Command {
"Initializes a new Angel project in the current directory."; "Initializes a new Angel project in the current directory.";
InitCommand() { 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 @override
@ -44,8 +47,11 @@ class InitCommand extends Command {
new File.fromUri(projectDir.uri.resolve('config/production.yaml')), new File.fromUri(projectDir.uri.resolve('config/production.yaml')),
secret); secret);
var name = p.basenameWithoutExtension( var name = argResults.wasParsed('project-name')
projectDir.absolute.uri.normalizePath().toFilePath()); ? argResults['project-name'] as String
: p.basenameWithoutExtension(
projectDir.absolute.uri.normalizePath().toFilePath());
name = ReCase(name).snakeCase; name = ReCase(name).snakeCase;
print('Renaming project from "angel" to "$name"...'); print('Renaming project from "angel" to "$name"...');
await renamePubspec(projectDir, 'angel', name); await renamePubspec(projectDir, 'angel', name);

View file

@ -98,8 +98,8 @@ class ModelCommand extends Command {
if (argResults['migration'] as bool) { if (argResults['migration'] as bool) {
modelClazz.annotations.add(refer('orm')); modelClazz.annotations.add(refer('orm'));
} else { } else {
modelClazz.annotations.add(refer('Orm') modelClazz.annotations.add(
.newInstance([], {'generateMigration': literalFalse})); refer('Orm').call([], {'generateMigration': literalFalse}));
} }
} }
})); }));

View file

@ -29,7 +29,7 @@ class RenameCommand extends Command {
newName = prompts.get('Rename project to'); 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`?'); var choice = prompts.getBool('Rename the project to `$newName`?');

View file

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