<commit_before>'use strict';

var path = require('path'),
    url = require('url'),
    util = require('util');

var Q = require('q');

var lib = require('manifoldjs-lib');

var CustomError = lib.CustomError,
    fileTools = lib.fileTools,
    manifestTools = lib.manifestTools,
    PlatformBase = lib.PlatformBase,
    processTools = lib.processTools,
    projectTools = lib.projectTools,
    exec = lib.processTools.exec,
    utils = lib.utils;

var constants = require('./constants');
  
function Platform (packageName, platforms) {

  var self = this;

  PlatformBase.call(this, constants.platform.id, constants.platform.name, packageName, __dirname);
  
  // save platform list
  self.platforms = platforms;

  // returns the path to the cordova shell command
  var cachedCordovaPath;
  function getCordovaPath () {
    
    if (!cachedCordovaPath) {
      // npm command in Windows is a batch file and needs to include extension to be resolved by spawn call
      var cordova = (process.platform === 'win32' ? 'cordova.cmd' : 'cordova');
      return processTools.getCommandPath(__dirname, cordova)
      .then(function (commandPath) {
        cachedCordovaPath = commandPath;
        if (!commandPath) {
          return Q.reject(new Error('Failed to locate the Cordova shell command: \'' + cordova + '\'.'));
        }
        
        return cachedCordovaPath = commandPath;
      });
    }
    
    return Q.resolve(cachedCordovaPath);
  }

  // ID or URL of the Hosted Web App plugin - THIS SETTING WILL NEED TO BE UPDATED IF THE PLUGIN IS RELOCATED
  // TODO: make this overridable via environment variable
  var pluginIdOrUrl = 'cordova-plugin-hostedwebapp@>=0.2.0 <0.3.0';
  <commit_msg>Support overriding Hosted Web App plugin location and/or version with an environment variable (CORDOVA_PLUGIN_HOSTEDWEBAPP)<commit_after>'use strict';

var path = require('path'),
    url = require('url'),
    util = require('util');

var Q = require('q');

var lib = require('manifoldjs-lib');

var CustomError = lib.CustomError,
    fileTools = lib.fileTools,
    manifestTools = lib.manifestTools,
    PlatformBase = lib.PlatformBase,
    processTools = lib.processTools,
    projectTools = lib.projectTools,
    exec = lib.processTools.exec,
    utils = lib.utils;

var constants = require('./constants');
  
// ID or URL of the Hosted Web App plugin
// Specifies the location and version constraints (if applicable) of the plugin.
// Can be overriden by defining a CORDOVA_PLUGIN_HOSTEDWEBAPP environment variable. For example: 
//   SET "CORDOVA_PLUGIN_HOSTEDWEBAPP=cordova-plugin-hostedwebapp@0.4.5"
var pluginIdOrUrl = process.env.CORDOVA_PLUGIN_HOSTEDWEBAPP || 'cordova-plugin-hostedwebapp@>=0.3.0 <0.4.0';
  
function Platform (packageName, platforms) {

  var self = this;

  PlatformBase.call(this, constants.platform.id, constants.platform.name, packageName, __dirname);
  
  // save platform list
  self.platforms = platforms;

  // returns the path to the cordova shell command
  var cachedCordovaPath;
  function getCordovaPath () {
    
    if (!cachedCordovaPath) {
      // npm command in Windows is a batch file and needs to include extension to be resolved by spawn call
      var cordova = (process.platform === 'win32' ? 'cordova.cmd' : 'cordova');
      return processTools.getCommandPath(__dirname, cordova)
      .then(function (commandPath) {
        cachedCordovaPath = commandPath;
        if (!commandPath) {
          return Q.reject(new Error('Failed to locate the Cordova shell command: \'' + cordova + '\'.'));
        }
        
        return cachedCordovaPath = commandPath;
      });
    }
    
    return Q.resolve(cachedCordovaPath);
  }

{'fraction_non_alphanumeric': 0.10763794509377549, 'fraction_numerical': 0.0051644468605599346, 'mean_word_length': 3.304093567251462, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '604171', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1091, 'n_words': 313}