diff --git a/.idea/angel_cli.iml b/.idea/angel_cli.iml index e673c03e..0a2188d2 100644 --- a/.idea/angel_cli.iml +++ b/.idea/angel_cli.iml @@ -6,7 +6,6 @@ - @@ -17,6 +16,7 @@ + diff --git a/lib/src/commands/init.dart b/lib/src/commands/init.dart index 744ca6d3..59f435b0 100644 --- a/lib/src/commands/init.dart +++ b/lib/src/commands/init.dart @@ -6,6 +6,8 @@ import 'package:path/path.dart' as p; import 'key.dart'; import 'rename.dart'; +final RegExp _leadingSlashes = new RegExp(r'^/+'); + class InitCommand extends Command { final KeyCommand _key = new KeyCommand(); final TextPen _pen = new TextPen(); @@ -143,6 +145,7 @@ class InitCommand extends Command { _pubGet(Directory projectDir) async { var exec = new File(Platform.resolvedExecutable); var pubPath = exec.parent.uri.resolve('pub').path; + if (Platform.isWindows) pubPath = pubPath.replaceAll(_leadingSlashes, ''); print('Running pub at "$pubPath"...'); var pub = await Process.start(pubPath, ["get"], workingDirectory: projectDir.absolute.path); diff --git a/lib/src/commands/service.dart b/lib/src/commands/service.dart index f65e293e..c5c682f7 100644 --- a/lib/src/commands/service.dart +++ b/lib/src/commands/service.dart @@ -107,7 +107,7 @@ class ServiceCommand extends Command { new ImportBuilder('package:angel_common/angel_common.dart')); generator.applyToLibrary(lib, name, lower); - if (generator.createsModel == true) { + if (generator.createsModel == true || typed) { lib ..addMember(new ImportBuilder('../models/$lower.dart')) ..addMember(new ExportBuilder('../models/$lower.dart')); @@ -180,7 +180,7 @@ class $name extends Model { if (!await file.exists()) await file.createSync(recursive: true); await file.writeAsString(''' -library ${pubspec.name}.models.$lower; +library ${pubspec.name}.validtors.$lower; import 'package:angel_validate/angel_validate.dart'; final Validator $constantCase = new Validator({ diff --git a/lib/src/commands/service_generators/map.dart b/lib/src/commands/service_generators/map.dart index d0f7eb44..ec7b1499 100644 --- a/lib/src/commands/service_generators/map.dart +++ b/lib/src/commands/service_generators/map.dart @@ -2,11 +2,11 @@ import 'generator.dart'; import 'package:code_builder/code_builder.dart'; class MapServiceGenerator extends ServiceGenerator { + const MapServiceGenerator() : super('In-Memory'); + @override bool get createsModel => false; - const MapServiceGenerator() : super('In-Memory'); - @override ExpressionBuilder createInstance( MethodBuilder methodBuilder, String name, String lower) { diff --git a/lib/src/commands/service_generators/mongo.dart b/lib/src/commands/service_generators/mongo.dart index af15f740..16e7c363 100644 --- a/lib/src/commands/service_generators/mongo.dart +++ b/lib/src/commands/service_generators/mongo.dart @@ -5,6 +5,9 @@ import 'package:inflection/inflection.dart'; class MongoServiceGenerator extends ServiceGenerator { const MongoServiceGenerator() : super('MongoDB'); + @override + bool get createsModel => false; + @override void applyToConfigureServer( MethodBuilder configureServer, String name, String lower) { diff --git a/lib/src/commands/service_generators/rethink.dart b/lib/src/commands/service_generators/rethink.dart index 71d6acc5..22d0bd64 100644 --- a/lib/src/commands/service_generators/rethink.dart +++ b/lib/src/commands/service_generators/rethink.dart @@ -5,6 +5,9 @@ import 'package:inflection/inflection.dart'; class RethinkServiceGenerator extends ServiceGenerator { const RethinkServiceGenerator() : super('RethinkDB'); + @override + bool get createsModel => false; + @override void applyToConfigureServer( MethodBuilder configureServer, String name, String lower) { diff --git a/lib/src/commands/start.dart b/lib/src/commands/start.dart index 02ac0c00..f9af79bc 100644 --- a/lib/src/commands/start.dart +++ b/lib/src/commands/start.dart @@ -34,9 +34,23 @@ class StartCommand extends Command { @override run() async { if (argResults['watch']) { - new DirectoryWatcher('bin').events.listen((_) async => start()); - new DirectoryWatcher('config').events.listen((_) async => start()); - new DirectoryWatcher('lib').events.listen((_) async => start()); + try { + new DirectoryWatcher('bin').events.listen((_) async => start()); + } catch (e) { + // Fail silently... + } + + try { + new DirectoryWatcher('config').events.listen((_) async => start()); + } catch (e) { + // Fail silently... + } + + try { + new DirectoryWatcher('lib').events.listen((_) async => start()); + } catch (e) { + // Fail silently... + } } return await start(); diff --git a/pubspec.yaml b/pubspec.yaml index 8706e718..bbb0ff9e 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: 1.0.10 +version: 1.0.11 dependencies: # analyzer: "^0.29.0" args: "^0.13.7"