You are here

function drush_addressfield_autocomplete_geocomplete_plugin in Addressfield Autocomplete 7

Command to download the Geocomplete plugin.

1 string reference to 'drush_addressfield_autocomplete_geocomplete_plugin'
addressfield_autocomplete_drush_command in ./addressfield_autocomplete.drush.inc
Implements hook_drush_command().

File

./addressfield_autocomplete.drush.inc, line 42
Drush integration for addressfield autocomplete.

Code

function drush_addressfield_autocomplete_geocomplete_plugin() {
  $version = drush_get_option('version');
  $path = drush_get_option('path', 'sites/all/libraries');

  // Make sure version matches a specific regex
  if (!preg_match('/v?(\\d\\.?){2,3}/', $version)) {
    $version = 'master';
  }
  $olddir = getcwd();
  try {
    _addressfield_autocomplete_drush_plugin_process($version, $path);
    drush_log(dt('Geocomplete plugin has been installed in @path', array(
      '@path' => $path,
    )), 'success');
  } catch (\Exception $e) {
    drush_log(dt($e
      ->getMessage()), 'error');
  }

  // Set working directory back to the previous working directory.
  chdir($olddir);
}