/*
Determine whether we should use drush
483716
function(site, env) {

    // Get the framework, default to the wordpress dump since it is LCD
    var framework = app.config.pluginconfig.pantheon.framework || 'wordpress';

    // Do not use drush if we have a wordpress site
    if (framework === 'wordpress') {
      return Promise.resolve(false);
    }

    // Check to see whether we have an alias for this site or not
    return drushCollect(['sa'])

    .then(function(aliases) {
      var list = aliases[0] || '';
      var hasAlias = _.includes(list, ['@pantheon', site, env].join('.'));
      log.info(format(
        'Site %s %s is in Pantheon aliases %j: %s',
        site,
        env,
        list,
        hasAlias
      ));
      return hasAlias;
    });

  }
259491
public function postDeploy() {
    $terminus_site_env = $this->getPantheonSiteEnv();
    $pantheon_prefix   = getenv('TERMINUS_SITE');
    if ($terminus_site_env == $pantheon_prefix . '.develop' || $terminus_site_env == $pantheon_prefix . '.dev') {
      $drush_commands = [
        'drush_partial_config_import' => "terminus remote:drush $terminus_site_env -- config-import --partial -y",
        'drush_cache_clear' => "terminus remote:drush $terminus_site_env -- cr",
        'drush_entity_updates' => "terminus remote:drush $terminus_site_env -- entity-updates -y",
        'drush_update_database' => "terminus remote:drush $terminus_site_env -- updb -y",
        'drush_full_config_import' => "terminus remote:drush $terminus_site_env -- config-import -y",
      ];
      // Run the installation.
      $result = $this->taskExec(implode(' && ', $drush_commands))
        ->run();
    }
  }
1197869
function isSafeToCreateProjectIn(root, name) {
  const validFiles = [
    '.DS_Store',
    'Thumbs.db',
    '.git',
    '.gitignore',
    '.idea',
    'README.md',
    'LICENSE',
    'web.iml',
    '.hg',
    '.hgignore',
    '.hgcheck',
  ];
  console.log();

  const conflicts = fs
    .readdirSync(root)
    .filter(file => !validFiles.includes(file));
  if (conflicts.length < 1) {
    return true;
  }

  console.log(
    `The directory ${chalk.green(name)} contains files that could conflict:`
  );
  console.log();
  for (const file of conflicts) {
    console.log(`  ${file}`);
  }
  console.log();
  console.log(
    'Either try using a new directory name, or remove the files listed above.'
  );

  return false;
}
173529
protected function doSetupDrush() {
    $content = file_get_contents(__DIR__ . '/../dist/drushrc.php');
    $content = str_replace('BUILD_ROOT', $this->getBuildRoot(), $content);
    $filename = $this->getDefaultDirectory() . '/drushrc.php';
    $this->write('Setup default Drush configuration file at <comment>%s</comment>', $this->shortenDirectory($filename));
    file_put_contents($filename, $content);
  }
223499
public function main() {
    $command = array();

    $command[] = !empty($this->bin) ? $this->bin : 'drush';

    if (!empty($this->alias)) {
      $command[] = $this->alias;
    }

    if (empty($this->color)) {
      $option = new Option();
      $option->setName('nocolor');
      $this->options[] = $option;
    }


    if (!empty($this->root)) {
      $option = new Option();
      $option->setName('root');
      $option->addText($this->root);
      $this->options[] = $option;
    }

    if (!empty($this->uri)) {
      $option = new Option();
      $option->setName('uri');
      $option->addText($this->uri);
      $this->options[] = $option;
    }

    if (!empty($this->config)) {
      $option = new Option();
      $option->setName('config');
      $option->addText($this->config);
      $this->options[] = $option;
    }

    if (!empty($this->aliasPath)) {
      $option = new Option();
      $option->setName('alias-path');
      $option->addText($this->uri);
      $this->options[] = $option;
    }

    if (is_bool($this->assume)) {
      $option = new Option();
      $option->setName(($this->assume ? 'yes' : 'no'));
      $this->options[] = $option;
    }

    if ($this->simulate) {
      $option = new Option();
      $option->setName('simulate');
      $this->options[] = $option;
    }

    if ($this->pipe) {
      $option = new Option();
      $option->setName('pipe');
      $this->options[] = $option;
    }

    if ($this->verbose) {
      $option = new Option();
      $option->setName('verbose');
      $this->options[] = $option;
    }

    foreach ($this->options as $option) {
      $command[] = $option->toString();
    }

    $command[] = $this->command;

    foreach ($this->params as $param) {
      $command[] = '"' . escapeshellcmd($param->getValue()) . '"';
    }

    $command = implode(' ', $command);

    if ($this->dir !== NULL) {
      $currdir = getcwd();
      @chdir($this->dir->getPath());
    }

    // Execute Drush.
    $this->log("Executing '$command'...");
    $output = array();
    exec($command, $output, $return);

    if (isset($currdir)) {
      @chdir($currdir);
    }

    // Collect Drush output for display through Phing's log.
    foreach ($output as $line) {
      $this->log($line);
    }
    // Set value of the 'pipe' property.
    if (!empty($this->returnProperty)) {
      $this->getProject()->setProperty($this->returnProperty, implode($this->returnGlue, $output));
    }
    // Build fail.
    if ($this->haltOnError && $return != 0) {
      throw new \BuildException("Drush exited with code $return");
    }
    return $return != 0;
  }
3854
def use_dev_config_dir(use_dev_config_dir=USE_DEV_CONFIG_DIR):
    """"""
    if use_dev_config_dir is not None:
        if use_dev_config_dir.lower() in {'false', '0'}:
            use_dev_config_dir = False
    else:
        use_dev_config_dir = DEV or not is_stable_version(__version__)
    return use_dev_config_dir
910611
function isModuleInstalledGlobally(name, fn) {
  var cmd = 'npm ls --global --json --depth=0';
  exec(cmd, function(err, stdout) {
    if (err) {
      return fn(err);
    }

    var data = JSON.parse(stdout);
    var installed = data.dependencies[name];
    fn(null, installed !== undefined);
  });
}
929692
public function getSiteDir() {
    if (!drush_has_boostrapped(DRUSH_BOOTSTRAP_DRUPAL_SITE)) {
      return FALSE;
    }

    // Check for aliases.
    $site_name = drush_sitealias_bootstrapped_site_name();
    $alias = drush_sitealias_get_record("@{$site_name}");

    if (floatval(DRUSH_VERSION) > 6.2) {
      $site_path = drush_sitealias_local_site_path($alias);
    }
    else {
      $supposed_path = drush_sitealias_local_site_path($alias);
      $hostname = drush_sitealias_uri_to_site_dir($alias['uri']);

      $site_root = drush_get_context('DRUSH_SELECTED_DRUPAL_ROOT');
      if (file_exists($site_root . '/sites/sites.php')) {
        $sites = [];

        include $site_root . '/sites/sites.php';

        // If we found a match in sites.php and the supposed path is sites/default
        // then replace 'default' with the matching directory.
        if (isset($sites[$hostname]) && substr($supposed_path, -8) == '/default') {
          $site_path = str_replace('/default', "/{$sites[$hostname]}", $supposed_path);
        }
        else {
          $site_path = $supposed_path;
        }
      }
      else {
        $site_path = $supposed_path;
      }
    }

    // If the site dir is 'default', switch to 'all'.
    if (substr($site_path, -8) == '/default') {
      $site_path = str_replace('/default', '/all', $site_path);
    }

    return $site_path . '/drush';
  }
403697
def is_dirty(self, index=True, working_tree=True, untracked_files=False,
                 submodules=True, path=None):
        
        if self._bare:
            # Bare repositories with no associated working directory are
            # always consired to be clean.
            return False

        # start from the one which is fastest to evaluate
        default_args = ['--abbrev=40', '--full-index', '--raw']
        if not submodules:
            default_args.append('--ignore-submodules')
        if path:
            default_args.append(path)
        if index:
            # diff index against HEAD
            if osp.isfile(self.index.path) and \
                    len(self.git.diff('--cached', *default_args)):
                return True
        # END index handling
        if working_tree:
            # diff index against working tree
            if len(self.git.diff(*default_args)):
                return True
        # END working tree handling
        if untracked_files:
            if len(self._get_untracked_files(path, ignore_submodules=not submodules)):
                return True
        # END untracked files
        return False
707627
protected function varnishCheckCommand()
    {
        $this->readProperties();

        $drushVersion = $this->taskDrushStack()
            ->drupalRootDirectory($this->getConfig()->get('digipolis.root.web'))
            ->getVersion();
        if (version_compare($drushVersion, '9.0', '<')) {
            return 'bash -c "[[ '
                . '\'$ENABLED_MODULES\' =~ \((varnish|purge)\) '
                . '&& \'$ENABLED_MODULES\' =~ \(page_cache\)'
                . ' ]]" && exit 1 || :';
        }
        return 'bash -c "[[ '
            . '\'$ENABLED_MODULES\' =~ (varnish|purge) '
            . '&& \'$ENABLED_MODULES\' =~ page_cache'
            . ' ]]" && exit 1 || :';
    }
1161856
public function update_8009007() {
    $this->updater->deleteFile('drush.wrapper');
    $this->updater->deleteFile('.drush-use');

    // Recommend drush upgrade.
    $messages = [
      "You should replace your local global installation of drush with drush launcher:",
      "https://github.com/drush-ops/drush-launcher",
    ];
    $formattedBlock = $this->updater->getFormatter()->formatBlock($messages, 'ice');
    $this->updater->getOutput()->writeln("");
    $this->updater->getOutput()->writeln($formattedBlock);
    $this->updater->getOutput()->writeln("");
  }
112099
function useYarn(setYarn) {
  if (typeof setYarn !== "undefined") {
    allowYarn = setYarn;
  }
  if (typeof allowYarn !== "undefined") {
    return allowYarn;
  }
  return getYarnVersionIfAvailable() ? true : false;
}
1343919
public function needsToRun()
    {
        $this->initializeVersions();

        if (empty($this->migratedVersions) && empty($this->availableVersions)) {
            return false;
        }

        $needsToRun = $this->hasUnmigratedVersions();

        return $needsToRun;
    }
370249
function(required, done) {
        if (arguments.length < 1 || required) {
          grunt.log.writeln('\nnpm install...');
          // Run npm install in project's directory
          grunt.util.spawn({cmd: 'npm', args: ['install'],
                            opts: {cwd: init.destpath, stdio: 'inherit'}},
              function(error, result, code) {
                if (done) {
                  done();
                }
              });
        } else if (done) {
          done();
        }
      }
638007
public static function isJoomlatoolsBox()
    {
        if (php_uname('n') === 'joomlatools') {
            return true;
        }

        // Support boxes that do not have the correct hostname set
        $user = exec('whoami');
        if (trim($user) == 'vagrant' && file_exists('/home/vagrant/scripts/dashboard/index.php'))
        {
            if (file_exists('/etc/varnish/default.vcl')) {
                return true;
            }
        }

        return false;
    }
527851
function checkOld (id, ts) {
    return false
    if(sources[id] && sources[id] >= ts) return true
    sources[id] = ts
  }
986730
protected function checkEnvironment()
    {
        // Check chunk folder is writable.
        // If not, give feedback!
        $chunkFolder = $this->config->getChunkDir();
        if (is_writeable($chunkFolder) === false) {
            $chunkFolder = $this->fileService->filterFilePath($chunkFolder);
            $this->messages->addMessage('chunksNotWritable', array($chunkFolder));
            // We can work without chunks, but this will require much more memory!
            $this->chunks->setUseChunks(false);
        }

        // Check if the log folder is writable.
        // If not, give feedback!
        $logFolder = $this->config->getLogDir();
        if (is_writeable($logFolder) === false) {
            $logFolder = $this->fileService->filterFilePath($logFolder);
            $this->messages->addMessage('logNotWritable', array($logFolder));
            // Tell the chunk output that we have no write access in the logging
            // folder.
            $this->chunks->setUseLogging(false);
        }

        // At this point, we won't inform the dev right away. The error message
        // will pop up, when kreXX is actually displayed, no need to bother the
        // dev just now.
    }