function deploy


Future deploy({List<String> entryPoints, CommandLineOptions options, String currentPackage, Map<String, String> packageDirs})

Creates a directory suitable for deploying a Polymer application to a server.

Note: this function will be replaced in the future by the pub deploy command.

The entryPoints list contains files under web/ that should be treated as entry points. Each entry on this list is a relative path from the package root (for example 'web/index.html'). If null, all files under 'web/' are treated as possible entry points.

Options must be passed by passing the options list.

The deploy step needs to know the name of the currentPackage and the location where to find the code for any package it depends on (packageDirs). This is inferred automatically, but can be overriden if those arguments are provided.

Source

Future deploy({List<String> entryPoints, CommandLineOptions options,
    String currentPackage, Map<String, String> packageDirs}) {
  if (options == null) {
    print('warning: now that main takes arguments, you need to explicitly pass'
        ' options to deploy(). Running as if no options were passed.');
    options = parseOptions([]);
  }
  if (currentPackage == null) currentPackage = readCurrentPackageFromPubspec();
  if (entryPoints == null) entryPoints = _parseEntryPointsFromPubspec();

  var transformOptions = new TransformOptions(
      entryPoints: entryPoints,
      directlyIncludeJS: options.directlyIncludeJS,
      contentSecurityPolicy: options.contentSecurityPolicy,
      releaseMode: options.releaseMode);

  var phases = new PolymerTransformerGroup(transformOptions).phases;
  var barbackOptions = new BarbackOptions(phases, options.outDir,
      currentPackage: currentPackage,
      packageDirs: packageDirs,
      machineFormat: options.machineFormat,
      // TODO(sigmund): include here also smoke transformer when it's on by
      // default.
      packagePhases: {'polymer': phasesForPolymer});
  return runBarback(barbackOptions)
      .then((_) => print('Done! All files written to "${options.outDir}"'));
}