<commit_before>const Task             = require('../../../tasks/-task');

const CordovaRaw       = require('../../../targets/cordova/tasks/raw');
const logger           = require('../../../utils/logger');
const Promise          = require('rsvp').Promise;

module.exports = Task.extend({
  project: undefined,
  platform: undefined,
  uiwebview: false,
  crosswalk: false,

  warnPlatform(platform, view) {
    logger.warn(
      'You have specified platform=' + platform + ' and ' + view + '.' +
      'Crosswalk is only available on android. This will have no effect.'
    );
  },

  warnIosView() {
    logger.warn(
      'corber initializes ios with the upgraded WKWebView. ' +
      'See http://corber.io/pages/workflow/default_webviews for details and flags'
    );
  },

  run() {
    let viewName, upgradeWebView;

    upgradeWebView = new CordovaRaw({
      project: this.project,
      api: 'plugins'
    });

    if (this.platform === 'ios') {
      if (this.crosswalk === true) {
        this.warnPlatform('ios', 'crosswalk=true');
      } else if (this.uiwebview === false) {
        this.warnIosView();
        viewName = 'cordova-plugin-wkwebview-engine';
      }
    } else if (this.platform === 'android') {
      if (this.uiwebview === true) {
        this.warnPlatform('android', 'uiwebview=true');
      } else if (this.crosswalk === true) {
        viewName = 'cordova-plugin-crosswalk-webview';
      }
    }

    if (viewName) {
      logger.success(
        'Initializing cordova with upgraded WebView ' + viewName
      );
    } else {
      logger.success('Initializing cordova with default WebView');
    }

    if (viewName !== undefined) {
      return upgradeWebView.run('add', viewName, { save: true });<commit_msg>fix(setup-webview): tell cordova lib to fetch missing plugin<commit_after>const Task             = require('../../../tasks/-task');

const CordovaRaw       = require('../../../targets/cordova/tasks/raw');
const logger           = require('../../../utils/logger');
const Promise          = require('rsvp').Promise;

module.exports = Task.extend({
  project: undefined,
  platform: undefined,
  uiwebview: false,
  crosswalk: false,

  warnPlatform(platform, view) {
    logger.warn(
      'You have specified platform=' + platform + ' and ' + view + '.' +
      'Crosswalk is only available on android. This will have no effect.'
    );
  },

  warnIosView() {
    logger.warn(
      'corber initializes ios with the upgraded WKWebView. ' +
      'See http://corber.io/pages/workflow/default_webviews for details and flags'
    );
  },

  run() {
    let viewName, upgradeWebView;

    upgradeWebView = new CordovaRaw({
      project: this.project,
      api: 'plugins'
    });

    if (this.platform === 'ios') {
      if (this.crosswalk === true) {
        this.warnPlatform('ios', 'crosswalk=true');
      } else if (this.uiwebview === false) {
        this.warnIosView();
        viewName = 'cordova-plugin-wkwebview-engine';
      }
    } else if (this.platform === 'android') {
      if (this.uiwebview === true) {
        this.warnPlatform('android', 'uiwebview=true');
      } else if (this.crosswalk === true) {
        viewName = 'cordova-plugin-crosswalk-webview';
      }
    }

    if (viewName) {
      logger.success(
        'Initializing cordova with upgraded WebView ' + viewName
      );
    } else {
      logger.success('Initializing cordova with default WebView');
    }

    if (viewName !== undefined) {
      return upgradeWebView.run('add', viewName, {
        save: true,
        fetch: true
      });
{'fraction_non_alphanumeric': 0.1506159014557671, 'fraction_numerical': 0.0, 'mean_word_length': 2.4126074498567336, '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': '5925315', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1058, 'n_words': 253}