<commit_before>/* jshint node: true */
'use strict';

var chalk = require('chalk');
var glob  = require('glob');

module.exports = {
  name: 'ember-cli-deploy-build',

  createDeployPlugin: function(options) {
    function pipelineData(outputPath) {
      var data = {};

      var files = glob.sync(outputPath + '/index.html', { nonull: false });

      if (files && files.length) {
        data.indexPath = files[0];
      }

      files = glob.sync(outputPath + '**/**/*', { nonull: false, ignore: '**/index.html' });

      if (files && files.length) {
        data.assetPaths = files;
      }

      return data;
    }

    return {
      name: options.name,

      build: function(context) {
        var deployment = context.deployment;
        var ui         = deployment.ui;
        var project    = deployment.project;
        var config     = deployment.config[this.name] || {};

        var outputPath = 'dist';
        var buildEnv   = config.buildEnv || 'production';

        ui.startProgress(chalk.green('Building'), chalk.green('.'));

        var Builder  = require('ember-cli/lib/models/builder');
        var builder = new Builder({
          ui: ui,
          outputPath: outputPath,
          environment: buildEnv,
          project: project
        });

        return builder.build()
          .finally(function() {
            ui.stopProgress();
            return builder.cleanup();
          })
          .then(function() {
            ui.writeLine(chalk.green('Built project successfully. Stored in "' +
              outputPath + '".'));
          })
          .then(pipelineData.bind(this, outputPath))
          .catch(function(err) {
            ui.writeLine(chalk.red('Build failed.'));
            ui.writeError(err);

            return 1;
          });
      }
    }
  }
};
<commit_msg>Now we don't make a distinction between index and assets<commit_after>/* jshint node: true */
'use strict';

var Promise = require('ember-cli/lib/ext/promise');

var glob  = require('glob');
var chalk = require('chalk');
var blue  = chalk.blue;

module.exports = {
  name: 'ember-cli-deploy-build',

  createDeployPlugin: function(options) {
    function _beginMessage(ui, outputPath) {
      ui.write(blue('|      '));
      ui.writeLine(blue('- building into `' + outputPath + '`'));

      return Promise.resolve();
    }

    function _successMessages(ui, outputPath) {
      var files = glob.sync(outputPath + '**/**/*', { nonull: false, nodir: true });

      if (files && files.length) {
        files.forEach(function(path) {
          ui.write(blue('|      '));
          ui.writeLine(blue('- ' + path));
        });
      }

      ui.write(blue('|      '));
      ui.writeLine(blue('- build successful'));

      return Promise.resolve(files);
    }

    return {
      name: options.name,

      build: function(context) {
        var deployment = context.deployment;
        var ui         = deployment.ui;
        var project    = deployment.project;
        var config     = deployment.config[this.name] || {};

        var outputPath = 'dist';
        var buildEnv   = config.buildEnv || 'production';

        var Builder  = require('ember-cli/lib/models/builder');
        var builder = new Builder({
          ui: ui,
          outputPath: outputPath,
          environment: buildEnv,
          project: project
        });

        return _beginMessage(ui, outputPath)
          .then(builder.build.bind(builder))
          .finally(function() {
            return builder.cleanup();
          })
          .then(_successMessages.bind(this, ui, outputPath))
          .then(function(files) {
            files = files || [];

            return {
              distDir: outputPath,
              distFiles: files
            };
          })
          .catch(function(error) {
            ui.write(blue('|      '));
            ui.writeLine(chalk.red('build failed'));

            return Promise.reject(error);
          });
      }
    }
  }
};

{'fraction_non_alphanumeric': 0.1437170805116629, 'fraction_numerical': 0.0005016302984700275, 'mean_word_length': 1.8898550724637682, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '3324782', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1111, 'n_words': 235}