Пример #1
0
    /**
     * Try to write a tiny drushrc.php to each place that drush checks. Also
     * write a sites/dev/aliases.drushrc.php file to the sandbox.
     */
    function setUp()
    {
        parent::setUp();
        $this->setUpDrupal();
        $this->setUpPaths();
        // These files are only written to sandbox so get automatically cleaned up.
        foreach ($this->paths as $key => $path) {
            $contents = <<<EOD
<?php
// Written by Drush's contextCase::setUp(). This file is safe to delete.

\$options['contextConfig'] = '{$key}';
\$command_specific['unit-eval']['contextConfig'] = '{$key}-specific';

EOD;
            $path .= $key == 'user' ? '/.drushrc.php' : '/drushrc.php';
            if (file_put_contents($path, $contents)) {
                $this->written[] = $this->convert_path($path);
            }
        }
        // Also write a site alias so we can test its supremacy in context hierarchy.
        $path = $this->site . '/aliases.drushrc.php';
        $aliases['contextAlias'] = array('contextConfig' => 'alias1', 'command-specific' => array('unit-eval' => array('contextConfig' => 'alias-specific')));
        $contents = unish_file_aliases($aliases);
        $return = file_put_contents($path, $contents);
    }
Пример #2
0
 /**
  * Try to write a tiny drushrc.php to each place that drush checks. Also
  * write a sites/dev/aliases.drushrc.php file to the sandbox.
  */
 function setUp()
 {
     parent::setUp();
     $path = UNISH_SANDBOX . '/aliases.drushrc.php';
     $aliases['site1'] = array('root' => UNISH_SANDBOX, 'uri' => 'site1.com', 'source-command-specific' => array('core-rsync' => array('exclude-paths' => 'excluded_by_source')), 'target-command-specific' => array('core-rsync' => array('exclude-paths' => 'excluded_by_target')), 'path-aliases' => array('%files' => 'sites/default/files'));
     $contents = $this->file_aliases($aliases);
     $return = file_put_contents($path, $contents);
 }
 /**
  * Write a config file that contains the shell-aliases array.
  */
 static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $contents = "\n      <?php\n\n      \$options['shell-aliases'] = array(\n        'glopts' => 'topic core-global-options',\n        'pull' => '!git pull',\n        'echosimple' => '!echo {{@target}}',\n        'echotest' => '!echo {{@target}} {{%root}} {{%mypath}}',\n        'compound-command' => '!cd {{%sandbox}} && echo second',\n      );\n    ";
     file_put_contents(UNISH_SANDBOX . '/drushrc.php', trim($contents));
     mkdir(UNISH_SANDBOX . '/b');
     $contents = "\n      <?php\n\n      \$options['shell-aliases'] = array(\n        'also' => '!echo alternate config file included too',\n      );\n    ";
     file_put_contents(UNISH_SANDBOX . '/b/drushrc.php', trim($contents));
     $contents = "\n      <?php\n\n      \$aliases['myalias'] = array (\n        'root' => '/path/to/drupal',\n        'uri' => 'mysite.org',\n        '#peer' => '@live',\n        'path-aliases' => array (\n          '%mypath' => '/srv/data/mypath',\n          '%sandbox' => '" . UNISH_SANDBOX . "'\n        ),\n      );\n    ";
     file_put_contents(UNISH_SANDBOX . '/aliases.drushrc.php', trim($contents));
 }
Пример #4
0
 /**
  * Write a config file that contains our configuration file.
  */
 static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $contents = "\n      <?php\n\n      \$options['shell-aliases'] = array(\n        'uninstall' => 'pm-uninstall',\n      );\n    ";
     file_put_contents(UNISH_SANDBOX . '/drushrc.php', trim($contents));
 }
Пример #5
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     // Copy in the command file, so the sandbox can find it.
     copy(dirname(dirname(__FILE__)) . '/situs.drush.inc', getenv('HOME') . '/.drush/situs.drush.inc');
 }