Multiple boilerplates

This commit is contained in:
thosakwe 2017-06-15 16:43:16 -04:00
parent cb075a4dc0
commit 2414886c2a
3 changed files with 34 additions and 10 deletions

View file

@ -122,13 +122,14 @@ class InitCommand extends Command {
}
}
var git = await Process.start("git", [
"clone",
"--depth",
"1",
"https://github.com/angel-dart/angel",
projectDir.absolute.path
]);
print('Choose a project type before continuing:');
var boilerplateChooser = new Chooser<BoilerplateInfo>(ALL_BOILERPLATES);
var boilerplate = await boilerplateChooser.choose();
print(
'Cloning "${boilerplate.name}" boilerplate from "${boilerplate.url}"...');
var git = await Process.start("git",
["clone", "--depth", "1", boilerplate.url, projectDir.absolute.path]);
stdout.addStream(git.stdout);
stderr.addStream(git.stderr);
@ -138,7 +139,6 @@ class InitCommand extends Command {
}
var gitDir = new Directory.fromUri(projectDir.uri.resolve(".git"));
if (await gitDir.exists()) await gitDir.delete(recursive: true);
} catch (e) {
print(e);
@ -184,3 +184,27 @@ preBuild(Directory projectDir) async {
if (buildCode != 0) throw new Exception('Failed to pre-build resources.');
}
const BoilerplateInfo FULL_APPLICATION_BOILERPLATE = const BoilerplateInfo(
'Full Application',
'A complete project including authentication, multi-threading, and more.',
'https://github.com/angel-dart/angel.git');
const BoilerplateInfo LIGHT_BOILERPLATE = const BoilerplateInfo(
'Light',
'Minimal starting point for new users',
'https://github.com/angel-dart/boilerplate_light.git');
const List<BoilerplateInfo> ALL_BOILERPLATES = const [
FULL_APPLICATION_BOILERPLATE,
LIGHT_BOILERPLATE
];
class BoilerplateInfo {
final String name, description, url;
const BoilerplateInfo(this.name, this.description, this.url);
@override
String toString() => '$name ($description)';
}

View file

@ -3,7 +3,7 @@ import 'dart:convert';
import 'package:http/src/base_client.dart' as http;
import 'package:pub_semver/pub_semver.dart';
final Version PACKAGE_VERSION = new Version(1, 1, 2);
final Version PACKAGE_VERSION = new Version(1, 1, 3);
Future<Version> fetchCurrentVersion(http.BaseClient client) async {
var response =
await client.get('https://pub.dartlang.org/api/packages/angel_cli');

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.1.2
version: 1.1.3
dependencies:
# analyzer: "^0.29.0"
args: ^0.13.4