Update plugin boilerplate

This commit is contained in:
Tobe O 2018-07-14 19:26:05 -04:00
parent d6568c53a0
commit c199e56e14
2 changed files with 14 additions and 6 deletions

View file

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

View file

@ -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...
}
};
}
''';
}