diff --git a/lib/src/commands/make/controller.dart b/lib/src/commands/make/controller.dart index 58a1d25..f5746d6 100644 --- a/lib/src/commands/make/controller.dart +++ b/lib/src/commands/make/controller.dart @@ -64,12 +64,21 @@ class ControllerCommand extends Command { : 'Controller'); if (argResults['websocket'] as bool) { + // XController(AngelWebSocket ws) : super(ws); + clazz.constructors.add(new Constructor((b) { + b + ..requiredParameters.add(new Parameter((b) => b + ..name = 'ws' + ..type = refer('AngelWebSocket'))) + ..initializers.add(new Code('super(ws)')); + })); + clazz.methods.add(new Method((meth) { meth ..name = 'hello' ..returns = refer('void') - ..annotations.add(refer('ExposeWs') - .call([literal('get_${rc.snakeCase}')])) + ..annotations + .add(refer('ExposeWs').call([literal('get_${rc.snakeCase}')])) ..requiredParameters.add(new Parameter((b) => b ..name = 'socket' ..type = refer('WebSocketContext'))) diff --git a/lib/src/commands/make/plugin.dart b/lib/src/commands/make/plugin.dart index 3780750..d942435 100644 --- a/lib/src/commands/make/plugin.dart +++ b/lib/src/commands/make/plugin.dart @@ -60,11 +60,10 @@ library ${pubspec.name}.src.config.plugins.${rc.snakeCase}; import 'dart:async'; import 'package:angel_framework/angel_framework.dart'; -class ${rc.pascalCase}Plugin extends AngelPlugin { - @override - Future call(Angel app) async { +AngelConfigurer ${rc.camelCase}() { + return (Angel app) async { // Work some magic... - } + }; } '''; }