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

var path = require('path');
var checker = require('ember-cli-version-checker');
var rawHandlebarsCompiler = require('./raw-handlebars-compiler');
var mergeTrees = require('broccoli-merge-trees');
var Funnel = require('broccoli-funnel');

module.exports = {
  name: 'ember-cli-raw-handlebars',

  init: function() {
    checker.assertAbove(this, '0.1.2');
  },

  included: function (app) {
  },

  projectConfig: function () {
    return this.project.config(process.env.EMBER_ENV);
  },

  rawTemplatesPath: function() {
    return this.app.options.rawTemplatesPath || path.join(this.app.trees.app, 'raw-templates');
  },

  treeForApp: function(tree) {
    var rawTemplates = mergeTrees([this.rawTemplatesPath()]);
    rawTemplates = new Funnel(rawTemplates, { destDir: 'raw-templates' });
    rawTemplates = this.processRawTemplates(rawTemplates);
    return this.mergeTrees([tree, rawTemplates]);
  },

  processRawTemplates: function(tree) {
    var options = {
      templateCompilerPath: this.templateCompilerPath()
    };
    return rawHandlebarsCompiler(tree, options);
  },

  templateCompilerPath: function() {
    var config = this.projectConfig();
    var templateCompilerPath = config['ember-cli-raw-handlebars'] && config['ember-cli-raw-handlebars'].templateCompilerPath;

    if (!templateCompilerPath) {
      templateCompilerPath = this.project.bowerDirectory + '/handlebars/handlebars';
    }

    return path.join(this.project.root, templateCompilerPath);
  }
};<commit_msg>import handlebars runtime in hosting app<commit_after>/* jshint node: true */
'use strict';

var path = require('path');
var checker = require('ember-cli-version-checker');
var rawHandlebarsCompiler = require('./raw-handlebars-compiler');
var mergeTrees = require('broccoli-merge-trees');
var Funnel = require('broccoli-funnel');

module.exports = {
  name: 'ember-cli-raw-handlebars',

  init: function() {
    checker.assertAbove(this, '0.1.2');
  },

  included: function(app) {
    app.import(this.templateRuntimePath());
  },

  projectConfig: function() {
    return this.project.config(process.env.EMBER_ENV);
  },

  rawTemplatesPath: function() {
    return this.app.options.rawTemplatesPath || path.join(this.app.trees.app, 'raw-templates');
  },

  treeForApp: function(tree) {
    var rawTemplates = mergeTrees([this.rawTemplatesPath()]);
    rawTemplates = new Funnel(rawTemplates, { destDir: 'raw-templates' });
    rawTemplates = this.processRawTemplates(rawTemplates);
    return this.mergeTrees([tree, rawTemplates]);
  },

  processRawTemplates: function(tree) {
    var options = {
      templateCompilerPath: this.templateCompilerPath()
    };
    return rawHandlebarsCompiler(tree, options);
  },

  templateCompilerPath: function() {
    var config = this.projectConfig();
    var templateCompilerPath = config['ember-cli-raw-handlebars'] && config['ember-cli-raw-handlebars'].templateCompilerPath;

    if (!templateCompilerPath) {
      templateCompilerPath = this.project.bowerDirectory + '/handlebars/handlebars';
    }

    return path.join(this.project.root, templateCompilerPath);
  },

  templateRuntimePath: function() {
    var config = this.projectConfig();
    var templateRuntimePath = config['ember-cli-raw-handlebars'] && config['ember-cli-raw-handlebars'].templateRuntimePath;

    if (!templateRuntimePath) {
      templateRuntimePath = this.project.bowerDirectory + '/handlebars/handlebars.runtime.js';
    }

    return templateRuntimePath;
  }
};
{'fraction_non_alphanumeric': 0.14257425742574256, 'fraction_numerical': 0.0016973125884016972, 'mean_word_length': 4.415007656967841, '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': '7329422', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1054, 'n_words': 185}