<commit_before>/**
 * Created by lejard_h on 06/05/16.
 */

import "dart:io";
import 'dart:async';

import "package:dev_string_converter/dev_string_converter.dart";
import "utils.dart";


StreamSubscription _progressSubscription;

void _progress() {
    _progressSubscription =
        new Stream.periodic(const Duration(seconds: 1)).listen((_) {
            output('.', Color.white);
        });
}

void _endProgress() {
    _progressSubscription.cancel();
    stdout.write('\n');
}


main(List<String> args) async {
    var name = toTableName(args[0]);
    output('Cloning template repository', Color.green);
    _progress();
    ProcessResult result;
    try {
        result = await Process.run('git', [
            'clone',
            'https://github.com/lejard-h/angular2_project_template.git',
            '-bmaster',
            '--single-branch',
            name,
        ]);
    } catch (e) {
        output('\n••• Couldn\'t run git clone', Color.red);
    }

    _endProgress();

    if (result.exitCode != 0) {
        output('${result.stderr}\n', Color.red);
        exit(1);
    }

    Directory.current = name;

    try {
        await new Directory('.git').delete(recursive: true);
    } catch (e) {
        output('$e\n', Color.red);
        exit(1);
    }

    Process.runSync("replace", [ "__projectName__", "$name", "--", "pubspec.yaml"]);
    Process.runSync("replace", [ "__projectName__", "$name", "--", "angular.config.yaml"]);
    Process.runSync("replace", [ "__projectName__", "$name", "--", "web/main.dart"]);

    output('Running Pub Get', Color.green);

    _progress();

    try {

        await Process.run('pub', ['get']);
    } catch (e) {
        output('\n••• Couldn\'t run pub get', Color.red);
    }

    _endProgress();<commit_msg>update for last app template<commit_after>/**
 * Created by lejard_h on 06/05/16.
 */

import "dart:io";
import 'dart:async';

import "package:dev_string_converter/dev_string_converter.dart";
import "utils.dart";


StreamSubscription _progressSubscription;

void _progress() {
    _progressSubscription =
        new Stream.periodic(const Duration(seconds: 1)).listen((_) {
            output('.', Color.white);
        });
}

void _endProgress() {
    _progressSubscription.cancel();
    stdout.write('\n');
}


main(List<String> args) async {
    var name = toTableName(args[0]);
    output('Cloning template repository', Color.green);
    _progress();
    ProcessResult result;
    try {
        result = await Process.run('git', [
            'clone',
            'https://github.com/lejard-h/angular2_project_template.git',
            '-bmaster',
            '--single-branch',
            name,
        ]);
    } catch (e) {
        output('\n••• Couldn\'t run git clone', Color.red);
    }

    _endProgress();

    if (result.exitCode != 0) {
        output('${result.stderr}\n', Color.red);
        exit(1);
    }

    Directory.current = name;

    try {
        await new Directory('.git').delete(recursive: true);
    } catch (e) {
        output('$e\n', Color.red);
        exit(1);
    }

    ConfigFile config = new ConfigFile();

    Process.runSync("mv", ["lib/__projectName__.dart", "lib/$name.dart"] );
    Process.runSync("replace", [ "__projectName__", "$name", "--", "pubspec.yaml"]);
    Process.runSync("replace", [ "__projectName__", "$name", "--", "angular.config.yaml"]);
    Process.runSync("replace", [ "__projectName__", "$name", "--", "web/main.dart"]);

    Process.runSync("replace", [ "__projectName__", "$name", "--", "lib/$name.dart"]);
    Process.runSync("replace", [ "__projectName__", "$name", "--", "${config.servicesPath}/services.dart"]);
    Process.runSync("replace", [ "__projectName__", "$name", "--", "lib/models.dart"]);
    Process.runSync("replace", [ "__projectName__", "$name", "--", "${config.componentsPath}/components.dart"]);
    Process.runSync("replace", [ "__projectName__", "$name", "--", "${config.pipesPath}/pipes.dart"]);
    Process.runSync("replace", [ "__projectName__", "$name", "--", "${config.routesPath}/routes.dart"]);
    Process.runSync("replace", [ "__projectName__", "$name", "--", "${config.directivesPath}/directives.dart"]);


    output('Running Pub Get', Color.green);

    _progress();

    try {

        await Process.run('pub', ['get']);
    } catch (e) {
        output('\n••• Couldn\'t run pub get', Color.red);
    }

    _endProgress();
{'fraction_non_alphanumeric': 0.19622555707139608, 'fraction_numerical': 0.005457025920873124, 'mean_word_length': 2.899822695035461, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1295402', 'n_tokens_mistral': 1422, 'n_tokens_neox': 1403, 'n_words': 254}