diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..c2e90e8
Binary files /dev/null and b/.DS_Store differ
diff --git a/.idea/angel_cli.iml b/.idea/angel_cli.iml
new file mode 100644
index 0000000..e673c03
--- /dev/null
+++ b/.idea/angel_cli.iml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..5f91449
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index 5f33cd5..87776e1 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,14 @@
# angel_cli
-Command-line tools for the Angel framework.
\ No newline at end of file
+Command-line tools for the Angel framework.
+
+To install:
+
+```bash
+$ pub global activate angel_cli
+```
+
+And then, for information on each command:
+
+```bash
+$ angel --help
+```
\ No newline at end of file
diff --git a/bin/angel.dart b/bin/angel.dart
index fd9e44d..d16d426 100644
--- a/bin/angel.dart
+++ b/bin/angel.dart
@@ -16,7 +16,8 @@ main(List args) {
..addCommand(new ServiceCommand())
..addCommand(new InitCommand())
..addCommand(new TestCommand())
- ..addCommand(new PluginCommand());
+ ..addCommand(new PluginCommand())
+ ..addCommand(new StartCommand());
return runner.run(args).then((_) {}).catchError((exc) {
stderr.writeln("Oops, something went wrong: $exc");
diff --git a/lib/src/commands/commands.dart b/lib/src/commands/commands.dart
index 1404153..7e82dcc 100644
--- a/lib/src/commands/commands.dart
+++ b/lib/src/commands/commands.dart
@@ -4,4 +4,5 @@ export "doctor.dart";
export "init.dart";
export "plugin.dart";
export "service.dart";
+export "start.dart";
export "test.dart";
\ No newline at end of file
diff --git a/lib/src/commands/start.dart b/lib/src/commands/start.dart
new file mode 100644
index 0000000..23ceff9
--- /dev/null
+++ b/lib/src/commands/start.dart
@@ -0,0 +1,63 @@
+import 'dart:io';
+import 'package:args/command_runner.dart';
+import 'package:yaml/yaml.dart';
+
+class StartCommand extends Command {
+ @override
+ String get name => 'start';
+
+ @override
+ String get description =>
+ 'Runs any `start` scripts, and then runs the server.';
+
+ StartCommand() : super() {
+ argParser.addFlag('production',
+ help: 'Starts the server in production mode.',
+ negatable: false,
+ defaultsTo: false);
+ }
+
+ @override
+ run() async {
+ final pubspec = new File('pubspec.yaml');
+
+ if (await pubspec.exists()) {
+ // Run start scripts
+ final doc = loadYamlDocument(await pubspec.readAsString());
+ final scriptsNode = doc.contents['scripts'];
+
+ if (scriptsNode != null && scriptsNode.containsKey('start')) {
+ final scripts = scriptsNode['start'] is List
+ ? scriptsNode['start']
+ : [scriptsNode['start']];
+
+ for (String script in scripts) {
+ final split = script.split(' ');
+ final result = await Process.run(split.first, split.skip(1).toList(),
+ stdoutEncoding: null, stderrEncoding: null);
+ final code = result.exitCode;
+
+ stdout.add(result.stdout);
+ stderr.add(result.stderr);
+
+ if (code != 0) {
+ throw new Exception("Command '$script' exited with code $code.");
+ }
+ }
+ }
+ }
+
+ print('Starting server...');
+
+ final env = {};
+
+ if (argResults['production']) env['ANGEL_ENV'] = 'production';
+
+ final server = await Process.start(Platform.executable, ['bin/server.dart'],
+ environment: env);
+ server.stdout.pipe(stdout);
+ server.stderr.pipe(stderr);
+
+ exitCode = await server.exitCode;
+ }
+}
diff --git a/pubspec.yaml b/pubspec.yaml
index e434f18..75278ac 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: angel_cli
-version: 1.0.0-dev+5
+version: 1.0.0-dev+6
description: Command-line tools for the Angel framework.
author: Tobe O
homepage: https://github.com/angel-dart/angel_cli