public function generate() { parent::generate(); // Build projection variant trellis files $this->executeTrellis($this->data['variant_prefix']); // Copy Trellis ES mapping file to correction location $trellis_config_path = $this->getTargetPath($this->data['variant_prefix']) . $this->data['variant_prefix'] . '.ini'; $trellis_config = parse_ini_file($trellis_config_path); $mapping_source_path = sprintf('%s%s%s', dirname($trellis_config_path), DIRECTORY_SEPARATOR, $trellis_config['deploy_path']); if (!is_readable($mapping_source_path)) { throw new RuntimeError(sprintf('Could not find mapping source file at %s', $mapping_source_path)); } $mapping_target_path = sprintf('%1$s%2$smigration%2$selasticsearch%2$s%3$s_create_%4$s_%5$s%2$s%6$s', $this->data['target_path'], DIRECTORY_SEPARATOR, $this->data['timestamp'], $this->data['resource_prefix'], $this->data['variant_prefix'], str_replace('{{ timestamp }}', $this->data['timestamp'], basename($trellis_config['deploy_path']))); if (!is_writable(dirname($mapping_target_path))) { throw new RuntimeError(sprintf('Mapping target path is not writable for %s', $mapping_target_path)); } rename($mapping_source_path, $mapping_target_path); }