protected function installParts() { $config = new \stdClass(); foreach ($this->parts as $part) { $part->setupPackage($config, $this->directory); } $this->directory->write('composer.json', json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)); }
protected function copyTo($file, Directory $target, $targetName = null, Closure $handler = null) { $targetName = $targetName ?: basename($file); $content = file_get_contents($file); if ($handler) { $content = $handler($content); } $target->write($targetName, $content); }
public function setupPackage($composer, Directory $target) { $target->makeDir('src'); $target->makeDir('tests'); $this->copyTo(__DIR__ . '/stubs/gitignore.txt', $target, '.gitignore'); }