* @package PHPCI * @subpackage Plugins */ class Wipe implements PluginInterface { /** * @var \PHPCI\Builder */ protected $phpci; /** * @var \PHPCI\Model\Build */ protected $build; protected $directory; /** * Set up the plugin, configure options, etc. * * @param Builder $phpci * @param Build $build * @param array $options */ public function __construct(Builder $phpci, Build $build, array $options = array()) { $path = $phpci->buildPath; $this->phpci = $phpci; $this->build = $build; $this->directory = isset($options['directory']) ? $options['directory'] : $path; } /** * {@inheritDocs} */ public function execute() { $build = $this->phpci->buildPath; if ($this->directory == $build || empty($this->directory)) { return true; } if (is_dir($this->directory)) { $cmd = 'rm -Rf "%s"'; if (IS_WIN) { $cmd = 'rmdir /S /Q "%s"'; } return $this->phpci->executeCommand($cmd, $this->directory); } return true; } }