Commit a491bcbc authored by Adam Barth's avatar Adam Barth

Merge pull request #36 from devoncarew/add_flutter_yaml

add a flutter.yaml file to the init template
parents d86fb66e a4690209
...@@ -32,10 +32,11 @@ Future main(List<String> args) async { ...@@ -32,10 +32,11 @@ Future main(List<String> args) async {
// This level can be adjusted by users through the `--verbose` option. // This level can be adjusted by users through the `--verbose` option.
Logger.root.level = Level.WARNING; Logger.root.level = Level.WARNING;
Logger.root.onRecord.listen((LogRecord record) { Logger.root.onRecord.listen((LogRecord record) {
String level = record.level.name.toLowerCase();
if (record.level >= Level.WARNING) { if (record.level >= Level.WARNING) {
stderr.writeln(record.message); stderr.writeln('$level: ${record.message}');
} else { } else {
print(record.message); print('$level: ${record.message}');
} }
if (record.error != null) if (record.error != null)
stderr.writeln(record.error); stderr.writeln(record.error);
......
...@@ -49,7 +49,7 @@ class FlutterCommandRunner extends CommandRunner { ...@@ -49,7 +49,7 @@ class FlutterCommandRunner extends CommandRunner {
argParser.addFlag('local-build', argParser.addFlag('local-build',
negatable: false, negatable: false,
help: help:
'Automatically detect your engine src directory from an overridden Flutter package.' 'Automatically detect your engine src directory from an overridden Flutter package. '
'Useful if you are building Flutter locally and are using a dependency_override for' 'Useful if you are building Flutter locally and are using a dependency_override for'
'the Flutter package that points to your engine src directory.'); 'the Flutter package that points to your engine src directory.');
argParser.addOption('engine-src-path', hide: true, argParser.addOption('engine-src-path', hide: true,
......
...@@ -89,6 +89,7 @@ abstract class Template { ...@@ -89,6 +89,7 @@ abstract class Template {
class FlutterSimpleTemplate extends Template { class FlutterSimpleTemplate extends Template {
FlutterSimpleTemplate() : super('flutter-simple', 'A minimal Flutter project.') { FlutterSimpleTemplate() : super('flutter-simple', 'A minimal Flutter project.') {
files['.gitignore'] = _gitignore; files['.gitignore'] = _gitignore;
files['flutter.yaml'] = _flutterYaml;
files['pubspec.yaml'] = _pubspec; files['pubspec.yaml'] = _pubspec;
files['README.md'] = _readme; files['README.md'] = _readme;
files['lib/main.dart'] = _libMain; files['lib/main.dart'] = _libMain;
...@@ -98,9 +99,8 @@ class FlutterSimpleTemplate extends Template { ...@@ -98,9 +99,8 @@ class FlutterSimpleTemplate extends Template {
String _normalizeProjectName(String name) { String _normalizeProjectName(String name) {
name = name.replaceAll('-', '_').replaceAll(' ', '_'); name = name.replaceAll('-', '_').replaceAll(' ', '_');
// Strip any extension (like .dart). // Strip any extension (like .dart).
if (name.contains('.')) { if (name.contains('.'))
name = name.substring(0, name.indexOf('.')); name = name.substring(0, name.indexOf('.'));
}
return name; return name;
} }
...@@ -134,6 +134,12 @@ dev_dependencies: ...@@ -134,6 +134,12 @@ dev_dependencies:
sky_tools: any sky_tools: any
'''; ''';
const String _flutterYaml = r'''
name: {{projectName}}
material-design-icons:
- name: content/add
''';
const String _libMain = r''' const String _libMain = r'''
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
......
...@@ -28,7 +28,7 @@ dependencies: ...@@ -28,7 +28,7 @@ dependencies:
# See also https://github.com/dart-lang/pub/issues/1356 # See also https://github.com/dart-lang/pub/issues/1356
dev_dependencies: dev_dependencies:
mockito: "^0.10.1" mockito: ^0.10.1
# Add the bin/sky_tools.dart script to the scripts pub installs. # Add the bin/sky_tools.dart script to the scripts pub installs.
executables: executables:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment