Example #1
0
File: app.js Project: yzen/gaia
  webapps.forEach(function(app) {
    let appDir = app.appDirPath;
    let appDirFile = utils.getFile(appDir);
    let appOptions = utils.cloneJSON(options);
    let stageAppDir = utils.getFile(options.STAGE_DIR, appDirFile.leafName);

    appOptions.APP_DIR = appDirFile.path;
    appOptions.STAGE_APP_DIR = stageAppDir.path;

    let buildFile = utils.getFile(appDir, 'build', 'build.js');
    // A workaround for bug 1093267
    if (buildFile.exists()) {
      utils.log('app', 'building ' + appDirFile.leafName + ' app...');

      if (parseInt(options.P) > 0) {
        // A workaround for bug 1093267
        if (appDir.indexOf('communications') !== -1) {
          communications = utils.spawnProcess('build-app', appOptions);
          processes.push({
            name: 'communications',
            instance: communications
          });
        } else {
          processes.push({
            name: appDirFile.leafName,
            instance: utils.spawnProcess('build-app', appOptions)
          });
        }
      } else {
        require('./build-app').execute(appOptions);
      }
    }
    // Do not spawn a new process since too many processes will slow it down
    else {
      // A workaround for bug 1093267
      if (appDir.indexOf('callscreen') !== -1) {
        if (communications) {
          utils.processEvents(function () {
            return { wait: utils.processIsRunning(communications) };
          });
        }
      }

      utils.copyToStage(appOptions);
      appOptions.webapp = app;
      nodeHelper.require('./post-app', appOptions);
    }
  });
Example #2
0
  /**
   * Build an object with localization metadata, taken from the manifest file
   * for the GAIA_SOURCE_LOCALE locale
   *
   * It may look like this:
   * {
   *   default: {
   *     name: "App",
   *     description: "App's description"
   *   },
   *   entry_points: {
   *     dialer: {
   *       name: "App's Dialer",
   *       description: "App's Dialer's description"
   *     }
   *   }
   * }
   *
   * This data will be used as a reference point for localization of the
   * manifest data to other locales.
   *
   * @param {Object} manifest - Manifest.webapp's data object
   * @param {Object} webapp   - A webapp object for specific app
   */
  function buildSourceLocaleProps(manifest, webapp) {
    manifest = utils.cloneJSON(manifest);
    if (!manifest.locales[GAIA_SOURCE_LOCALE]) {
      utils.log(MODNAME,
        'In manifest file: ' + webapp.buildManifestFile.path + ', ' +
        'missing locales key for locale: ' + GAIA_SOURCE_LOCALE);
    }
    var sourceLocaleProps = {
      default: manifest.locales[GAIA_SOURCE_LOCALE],
      entry_points: {}
    };

    if (manifest.entry_points) {
      for (var name in manifest.entry_points) {
        sourceLocaleProps.entry_points[name] =
          manifest.entry_points[name].locales[GAIA_SOURCE_LOCALE];
      }
    }

    return sourceLocaleProps;
  }