Skip to content

Instantly share code, notes, and snippets.

@AdrianRossouw
Created April 13, 2010 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdrianRossouw/364918 to your computer and use it in GitHub Desktop.
Save AdrianRossouw/364918 to your computer and use it in GitHub Desktop.
class provisionConfig_drushrc extends provisionConfig {
public $template = 'provision_drushrc.tpl.php';
public $description = 'Drush configuration file';
protected $mode = 0400;
protected $context_name = 'drush';
function filename() {
return _drush_config_file($this->context_name);
}
function __construct($data = array()) {
parent::__construct($data);
$this->load_data();
}
function load_data() {
// we fetch the context to pass into the template based on the context name
$this->data = array_merge(drush_get_context($this->context_name), $this->data);
}
function process() {
unset($this->data['context-path']);
unset($this->data['config-file']);
$this->data['option_keys'] = array_keys($this->data);
}
}
// class to read and write an alias record
class provisionConfig_drushrc_alias extends provisionConfig_drushrc {
function __construct($aliasname, $data = array()) {
parent::construct($data);
$this->alias_name = $aliasname;
}
function load_data() {
// do something about alias_load_data
}
function filename() {
return drush_get_option('alias-path', drush_server_home() . '/.drush/aliases/') . trim($this->aliasname, '@');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment