This commit is contained in:
thosakwe 2017-04-26 09:21:25 -04:00
parent 8b71a2603d
commit 1675cbd701
8 changed files with 32 additions and 9 deletions

View file

@ -6,7 +6,6 @@
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/bin/packages" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/example/packages" />
<excludeFolder url="file://$MODULE_DIR$/packages" />
<excludeFolder url="file://$MODULE_DIR$/sample_project/.pub" />
<excludeFolder url="file://$MODULE_DIR$/sample_project/bin/packages" />
@ -17,6 +16,7 @@
<excludeFolder url="file://$MODULE_DIR$/sample_project/web/packages" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
<excludeFolder url="file://$MODULE_DIR$/tool/packages" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

View file

@ -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);

View file

@ -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({

View file

@ -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) {

View file

@ -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) {

View file

@ -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) {

View file

@ -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();

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: 1.0.10
version: 1.0.11
dependencies:
# analyzer: "^0.29.0"
args: "^0.13.7"