You are here

function drush_gelf_download in GELF 8

Same name and namespace in other branches
  1. 6 gelf.drush.inc \drush_gelf_download()
  2. 7 gelf.drush.inc \drush_gelf_download()

A command callback. Download the GELF library using git.

1 call to drush_gelf_download()
drush_gelf_post_pm_enable in ./gelf.drush.inc
Implements drush_MODULE_post_COMMAND().

File

./gelf.drush.inc, line 35
Drush integration for the gelf module.

Code

function drush_gelf_download() {
  $args = func_get_args();
  if (isset($args[0])) {
    $path = $args[0];
  }
  else {
    $path = drush_get_context('DRUSH_DRUPAL_ROOT');
    if (function_exists('libraries_get_path')) {
      $path .= '/' . libraries_get_path('gelf-php');
    }
  }
  if (is_dir($path)) {
    drush_log(' already present. No download required.', 'ok');
  }
  elseif (drush_shell_cd_and_exec(dirname($path), 'git clone https://github.com/bzikarsky/gelf-php.git')) {
    drush_log(dt('GELF has been cloned via git to @path.', array(
      '@path' => $path,
    )), 'success');
  }
  else {
    drush_log(dt('Drush was unable to clone to @path.', array(
      '@path' => $path,
    )), 'error');
  }
}