public function handle(EditThemeCommand $command) { $repository = new Repository($command->repository); $repository->setBranch($command->branch); $this->themes->editTheme($command->stylesheet, array('repository' => $repository, 'branch' => $repository->getBranch(), 'status' => $command->status, 'ptd' => $command->pushToDeploy, 'subdirectory' => $command->subdirectory)); do_action('wppusher_theme_was_edited', new ThemeWasEdited()); }
public function handle(UpdatePackageFromWebhookCommand $command) { $package = false; // Plugin? try { $package = $this->plugins->pusherPluginFromRepository($command->repository); $updateCommand = new UpdatePlugin(array('file' => $package->file, 'repository' => $package->repository)); } catch (PluginNotFound $e) { // No plugins... } // Or theme? try { $package = $this->themes->pusherThemeFromRepository($command->repository); $updateCommand = new UpdateTheme(array('stylesheet' => $package->stylesheet, 'repository' => $package->repository)); } catch (ThemeNotFound $e) { // ... and no themes. } if (!$package) { throw new PushToDeployFailed("Push-to-Deploy failed. Couldn't find matching package."); } // Check if push to deploy is enabled before executing if (!$package->pushToDeploy) { throw new PushToDeployFailed("Push-to-Deploy failed. Push-to-Deploy was not enabled for package '{$package->name}'"); } $this->dashboard->execute($updateCommand); }
public function getThemes() { if (isset($_GET['repo'])) { try { $theme = $this->themes->pusherThemeFromRepository($_GET['repo']); return $this->render('themes/edit', compact('theme')); } catch (ThemeNotFound $e) { // Theme not found, show index instead } } $data['themes'] = $this->themes->allPusherThemes(); return $this->render('themes/index', $data); }
public function handle(InstallThemeCommand $command) { $theme = new Theme(); $repository = $this->repositoryFactory->build($command->type, $command->repository); if ($command->private and $this->pusher->hasValidLicenseKey()) { $repository->makePrivate(); } $repository->setBranch($command->branch); $theme->setRepository($repository); $theme->setSubdirectory($command->subdirectory); $command->dryRun ?: $this->upgrader->installTheme($theme); if ($command->subdirectory) { $slug = end(explode('/', $command->subdirectory)); } else { $slug = $repository->getSlug(); } $theme = $this->themes->fromSlug($slug); $theme->setRepository($repository); $theme->setPushToDeploy($command->ptd); $theme->setSubdirectory($command->subdirectory); $this->themes->store($theme); do_action('wppusher_theme_was_installed', new ThemeWasInstalled($theme)); }
public function handle(UnlinkThemeCommand $command) { $this->themes->unlink($command->stylesheet); do_action('wppusher_theme_was_unlinked', new ThemeWasUnlinked()); }
public function handle(UpdateThemeCommand $command) { $theme = $this->themes->pusherThemeFromRepository($command->repository); $this->upgrader->upgradeTheme($theme); do_action('wppusher_theme_was_updated', new ThemeWasUpdated($theme)); }