*/ class CleanBuild extends Plugin { protected $remove; /** * @return string */ public static function pluginName() { return 'clean_build'; } /** * {@inheritdoc} */ public function __construct(Builder $builder, Build $build, array $options = []) { parent::__construct($builder, $build, $options); $this->remove = isset($options['remove']) && is_array($options['remove']) ? $options['remove'] : []; } /** * Executes Composer and runs a specified command (e.g. install / update) */ public function execute() { $cmd = 'rm -Rf "%s"'; $this->builder->executeCommand($cmd, $this->builder->buildPath . 'composer.phar'); $this->builder->executeCommand($cmd, $this->builder->buildPath . 'composer.lock'); $success = true; foreach ($this->remove as $file) { $ok = $this->builder->executeCommand($cmd, $this->builder->buildPath . $file); if (!$ok) { $success = false; } } return $success; } }