function Assembler(options) {
  options = options || {};

  this._initProject(options);

  this.env  = Assembler.env();
  this.name = options.name || this.project.name();
  this.registry = options.registry || preprocessors.defaultRegistry(this);
  var isProduction = this.env === 'production';
  this._initTestsAndHinting(options, isProduction);
  this._initOptions(options, isProduction);
  this.entries = this.options.entries;
  this.trees = this.options.trees;
  this._importTrees = [];
  this.legacyFilesToAppend = [];
  this.legacyTestFilesToAppend = [];
  this.vendorStaticStyles = [];
  this.vendorTestStaticStyles = [];
  this.otherAssetPaths = [];
  this.cache = new Cache();

  // @deprecated
  this.bowerDirectory = this.project.bowerDirectory;

  preprocessors.setupRegistry(this);
  this._notifyAddonIncluded();
}
Exemple #2
0
  init: function(parent, project) {
    this._super();
    this.parent = parent;
    this.project = project;
    this.ui = project && project.ui;
    this.addonPackages = {};
    this.addons = [];
    this.addonDiscovery = new AddonDiscovery(this.ui);
    this.addonsFactory = new AddonsFactory(this, this.project);
    this.registry = p.defaultRegistry(this);
    this._didRequiredBuildPackages = false;

    if (!this.root) {
      throw new Error('Addon classes must be instantiated with the `root` property');
    }
    this.nodeModulesPath = nodeModulesPath(this.root);

    this.treePaths = {
      app:               'app',
      styles:            'app/styles',
      templates:         'app/templates',
      addon:             'addon',
      'addon-styles':    'addon/styles',
      'addon-templates': 'addon/templates',
      vendor:            'vendor',
      'test-support':    'test-support',
      'addon-test-support': 'addon-test-support',
      public:            'public'
    };

    this.treeForMethods = {
      app:               'treeForApp',
      styles:            'treeForStyles',
      templates:         'treeForTemplates',
      'addon-templates': 'treeForAddonTemplates',
      addon:             'treeForAddon',
      vendor:            'treeForVendor',
      'test-support':    'treeForTestSupport',
      'addon-test-support': 'treeForAddonTestSupport',
      public:            'treeForPublic'
    };

    p.setupRegistry(this);

    if (!this.name) {
      throw new SilentError('An addon must define a `name` property.');
    }

    this.__originalOptions = this.options = defaultsDeep(this.options, {
      babel: DEFAULT_BABEL_CONFIG
    });

    var emberCLIBabelConfigKey = this._emberCLIBabelConfigKey();
    this.__originalOptions[emberCLIBabelConfigKey] = this.options[emberCLIBabelConfigKey] = defaultsDeep(this.options[emberCLIBabelConfigKey], {
      compileModules: true
    });
  },
Exemple #3
0
/**
  EmberApp is the main class Ember CLI uses to manage the Broccoli trees
  for your application. It is very tightly integrated with Broccoli and has
  an `toTree()` method you can use to get the entire tree for your application.

  Available init options:
    - es3Safe, defaults to `true`,
    - storeConfigInMeta, defaults to `true`,
    - autoRun, defaults to `true`,
    - outputPaths, defaults to `{}`,
    - minifyCSS, defaults to `{enabled: !!isProduction,options: { relativeTo: 'assets' }},
    - minifyJS, defaults to `{enabled: !!isProduction},
    - sourcemaps, defaults to `{}`,
    - trees, defaults to `{},`
    - jshintrc, defaults to `{},`
    - vendorFiles, defaults to `{}`

  @class EmberApp
  @constructor
  @param {Object} options Configuration options
*/
function EmberApp() {
  var args = [];
  var options = {};

  for (var i = 0, l = arguments.length; i < l; i++) {
    args.push(arguments[i]);
  }

  if (args.length === 1) {
    options = args[0];
  } else if (args.length > 1) {
    args.reverse();
    options = defaults.apply(null, args);
  }

  this._initProject(options);

  this.env  = EmberApp.env();
  this.name = options.name || this.project.name();

  this.registry = options.registry || p.defaultRegistry(this);

  this.bowerDirectory = this.project.bowerDirectory;

  var isProduction = this.env === 'production';

  this._initTestsAndHinting(options, isProduction);
  this._initOptions(options, isProduction);
  this._initVendorFiles();

  this._styleOutputFiles       = {};
  this._scriptOutputFiles      = {};

  this.legacyFilesToAppend     = [];
  this.vendorStaticStyles      = [];
  this.otherAssetPaths         = [];
  this.legacyTestFilesToAppend = [];
  this.vendorTestStaticStyles  = [];

  this.trees = this.options.trees;

  this.populateLegacyFiles();
  p.setupRegistry(this);
  this._notifyAddonIncluded();

  if (!this._addonInstalled('loader.js') && !this.options._ignoreMissingLoader) {
    throw new SilentError('The loader.js addon is missing from your project, please add it to `package.json`.');
  }
}
Exemple #4
0
  init: function(parent, project) {
    this._super();
    this.parent = parent;
    this.project = project;
    this.ui = project && project.ui;
    this.addonPackages = {};
    this.addons = [];
    this.addonDiscovery = new AddonDiscovery(this.ui);
    this.addonsFactory = new AddonsFactory(this, this.project);
    this.registry = p.defaultRegistry(this);
    this._didRequiredBuildPackages = false;

    if (!this.root) {
      throw new Error('Addon classes must be instantiated with the `root` property');
    }
    this.nodeModulesPath = nodeModulesPath(this.root);

    this.treePaths = {
      app:               'app',
      styles:            'app/styles',
      templates:         'app/templates',
      addon:             'addon',
      'addon-styles':    'addon/styles',
      'addon-templates': 'addon/templates',
      vendor:            'vendor',
      'test-support':    'test-support',
      'addon-test-support': 'addon-test-support',
      public:            'public'
    };

    this.treeForMethods = {
      app:               'treeForApp',
      styles:            'treeForStyles',
      templates:         'treeForTemplates',
      'addon-templates': 'treeForAddonTemplates',
      addon:             'treeForAddon',
      vendor:            'treeForVendor',
      'test-support':    'treeForTestSupport',
      'addon-test-support': 'treeForAddonTestSupport',
      public:            'treeForPublic'
    };

    p.setupRegistry(this);

    if (!this.name) {
      throw new SilentError('An addon must define a `name` property.');
    }
  },
Exemple #5
0
/**
  EmberApp is the main class Ember CLI uses to manage the Broccoli trees
  for your application. It is very tightly integrated with Broccoli and has
  a `toTree()` method you can use to get the entire tree for your application.

  Available init options:
    - storeConfigInMeta, defaults to `true`
    - autoRun, defaults to `true`
    - outputPaths, defaults to `{}`
    - minifyCSS, defaults to `{enabled: !!isProduction,options: { relativeTo: 'assets' }}
    - minifyJS, defaults to `{enabled: !!isProduction}
    - sourcemaps, defaults to `{}`
    - trees, defaults to `{}`
    - jshintrc, defaults to `{}`
    - vendorFiles, defaults to `{}`
    - addons, defaults to `{ blacklist: [], whitelist: [] }`

  @class EmberApp
  @constructor
  @param {Object} [defaults]
  @param {Object} [options={}] Configuration options
*/
function EmberApp(defaults, options) {
  if (arguments.length === 0) {
    options = {};
  } else if (arguments.length === 1) {
    options = defaults;
  } else {
    defaultsDeep(options, defaults);
  }

  this._initProject(options);
  this.name = options.name || this.project.name();

  this.env  = EmberApp.env();
  this.isProduction = (this.env === 'production');

  this.registry = options.registry || p.defaultRegistry(this);

  this.bowerDirectory = this.project.bowerDirectory;

  this._initTestsAndHinting(options);
  this._initOptions(options);
  this._initVendorFiles();

  this._styleOutputFiles       = {};
  this._scriptOutputFiles      = {};
  this.amdModuleNames          = null;

  this.legacyFilesToAppend     = [];
  this.vendorStaticStyles      = [];
  this.otherAssetPaths         = [];
  this.legacyTestFilesToAppend = [];
  this.vendorTestStaticStyles  = [];

  this.trees = this.options.trees;

  this.populateLegacyFiles();
  p.setupRegistry(this);
  this._notifyAddonIncluded();

  if (!this._addonInstalled('loader.js') && !this.options._ignoreMissingLoader) {
    throw new SilentError('The loader.js addon is missing from your project, please add it to `package.json`.');
  }
}
Exemple #6
0
/**
  EmberApp is the main class Ember CLI uses to manage the Brocolli trees
  for your application. It is very tightly integrated with Brocolli and has
  an `toTree()` method you can use to get the entire tree for your application.

  Available init options:
    - es3Safe, defaults to `true`,
    - storeConfigInMeta, defaults to `true`,
    - autoRun, defaults to `true`,
    - outputPaths, defaults to `{}`,
    - minifyCSS, defaults to `{enabled: !!isProduction,options: { relativeTo: 'app/styles' }},
    - minifyJS, defaults to `{enabled: !!isProduction},
    - loader, defaults to this.bowerDirectory + '/loader.js/loader.js',
    - sourcemaps, defaults to `{}`,
    - trees, defaults to `{},`
    - jshintrc, defaults to `{},`
    - vendorFiles, defaults to `{}`

  @class EmberApp
  @constructor
  @param {Object} options Configuration options
*/
function EmberApp() {
  var args = [];
  var options = {};

  for (var i = 0, l = arguments.length; i < l; i++) {
    args.push(arguments[i]);
  }

  if (args.length === 1) {
    options = args[0];
  } else if (args.length > 1) {
    options = defaults.apply(null, args);
  }

  this._initProject(options);

  this.env  = EmberApp.env();
  this.name = options.name || this.project.name();

  this.registry = options.registry || p.defaultRegistry(this);

  this.bowerDirectory = this.project.bowerDirectory;

  var isProduction = this.env === 'production';

  this._initTestsAndHinting(options, isProduction);
  this._initOptions(options, isProduction);
  this._initVendorFiles();

  this.legacyFilesToAppend     = [];
  this.vendorStaticStyles      = [];
  this.otherAssetPaths         = [];
  this._importTrees            = [];
  this.legacyTestFilesToAppend = [];
  this.vendorTestStaticStyles  = [];

  this.trees = this.options.trees;

  this.populateLegacyFiles();
  p.setupRegistry(this);
  this._notifyAddonIncluded();
}
Exemple #7
0
    this.treePaths = {
      app: 'app',
      styles: 'app/styles',
      templates: 'app/templates',
      addon: 'addon',
      'addon-styles': 'addon/styles',
      'addon-templates': 'addon/templates',
      vendor: 'vendor',
      'test-support': 'test-support',
      'addon-test-support': 'addon-test-support',
      public: 'public',
    };

    this.treeForMethods = defaultsDeep({}, DEFAULT_TREE_FOR_METHODS);

    p.setupRegistry(this);

    if (!this.name) {
      throw new SilentError(`An addon must define a \`name\` property (found at ${this.root}).`);
    }

    this.__originalOptions = this.options = defaultsDeep(this.options, {
      babel: this[BUILD_BABEL_OPTIONS_FOR_PREPROCESSORS](),
    });

    let emberCLIBabelConfigKey = this._emberCLIBabelConfigKey();
    this.__originalOptions[emberCLIBabelConfigKey] = this.options[emberCLIBabelConfigKey] = defaultsDeep(this.options[emberCLIBabelConfigKey], {
      compileModules: true,
    });
  },