Skip to content

Commit

Permalink
Executing phpcbf against src dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
grasmash committed Jan 11, 2017
1 parent 0af906a commit a36d1cd
Show file tree
Hide file tree
Showing 11 changed files with 205 additions and 169 deletions.
9 changes: 5 additions & 4 deletions src/Annotations/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@
* @Annotation
* @Target({"METHOD","PROPERTY"})
*/
class Update
{
/** @Required */
class Update {
/**
* @Required */
public $version;

/**
* @var string
* @Required
*/
public $description;

}
46 changes: 22 additions & 24 deletions src/Composer/Plugin.php
Original file line number Diff line number Diff line change
@@ -1,47 +1,40 @@
<?php

/**
* @file
* Provides a way to patch Composer packages after installation.
*/

namespace Acquia\Blt\Composer;

use Acquia\Blt\Update\Updater;
use Composer\Script\Event;
use Composer\Installer\PackageEvent;
use Composer\Composer;
use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\EventDispatcher\EventSubscriberInterface;
use Composer\IO\IOInterface;
use Composer\Package\AliasPackage;
use Composer\Package\PackageInterface;
use Composer\Plugin\PluginInterface;
use Composer\Installer\PackageEvents;
use Composer\Script\Event;
use Composer\Script\ScriptEvents;
use Composer\Script\PackageEvent;
use Composer\Util\ProcessExecutor;
use Composer\Util\Filesystem;
use Symfony\Component\Process\Process;

/**
*
*/
class Plugin implements PluginInterface, EventSubscriberInterface {

/**
* @var Composer $composer
* @var Composer
*/
protected $composer;
/**
* @var IOInterface $io
* @var IOInterface
*/
protected $io;
/**
* @var EventDispatcher $eventDispatcher
* @var EventDispatcher
*/
protected $eventDispatcher;
/**
* @var ProcessExecutor $executor
* @var ProcessExecutor
*/
protected $executor;

Expand All @@ -50,13 +43,14 @@ class Plugin implements PluginInterface, EventSubscriberInterface {
*/
protected $bltPackage;

/** @var string */
/**
* @var string*/
protected $blt_prior_version;

/**
* Apply plugin modifications to composer
* Apply plugin modifications to composer.
*
* @param Composer $composer
* @param Composer $composer
* @param IOInterface $io
*/
public function activate(Composer $composer, IOInterface $io) {
Expand All @@ -73,7 +67,7 @@ public static function getSubscribedEvents() {
return array(
PackageEvents::POST_PACKAGE_INSTALL => "onPostPackageEvent",
PackageEvents::POST_PACKAGE_UPDATE => "onPostPackageEvent",
ScriptEvents::POST_UPDATE_CMD => 'onPostCmdEvent'
ScriptEvents::POST_UPDATE_CMD => 'onPostCmdEvent',
);
}

Expand All @@ -82,7 +76,7 @@ public static function getSubscribedEvents() {
*
* @param \Composer\Installer\PackageEvent $event
*/
public function onPostPackageEvent(\Composer\Installer\PackageEvent $event){
public function onPostPackageEvent(PackageEvent $event) {
$package = $this->getBltPackage($event->getOperation());
if ($package) {
// By explicitly setting the blt package, the onPostCmdEvent() will
Expand All @@ -96,7 +90,7 @@ public function onPostPackageEvent(\Composer\Installer\PackageEvent $event){
*
* @param \Composer\Script\Event $event
*/
public function onPostCmdEvent(\Composer\Script\Event $event) {
public function onPostCmdEvent(Event $event) {
// Only install the template files if acquia/blt was installed.
if (isset($this->bltPackage)) {
$version = $this->bltPackage->getVersion();
Expand All @@ -106,7 +100,9 @@ public function onPostCmdEvent(\Composer\Script\Event $event) {

/**
* Gets the acquia/blt package, if it is the package that is being operated on.
*
* @param $operation
*
* @return mixed
*/
protected function getBltPackage($operation) {
Expand All @@ -124,6 +120,7 @@ protected function getBltPackage($operation) {

/**
* Executes `blt update` and `blt-console blt:update` commands.
*
* @param $version
*/
protected function executeBltUpdate($version) {
Expand All @@ -132,7 +129,7 @@ protected function executeBltUpdate($version) {
if ($this->isInitialInstall()) {
$this->io->write('<info>Creating BLT templated files...</info>');
// The BLT command will not work at this point because the .git dir doesn't exist yet.
$success = $this->executeCommand($this->getVendorPath() .'/acquia/blt/blt.sh create-project', [], TRUE);
$success = $this->executeCommand($this->getVendorPath() . '/acquia/blt/blt.sh create-project', [], TRUE);
}
elseif ($options['blt']['update']) {
$this->io->write('<info>Updating BLT templated files...</info>');
Expand Down Expand Up @@ -223,6 +220,7 @@ protected function getOptions() {
* @param bool $display_output
* Optional. Defaults to FALSE. If TRUE, command output will be displayed
* on screen.
*
* @return bool
* TRUE if command returns successfully with a 0 exit code.
*/
Expand All @@ -240,7 +238,7 @@ protected function executeCommand($cmd, $args = [], $display_output = FALSE) {
$this->io->write('<comment> > ' . $command . '</comment>');
$io = $this->io;
$output = function ($type, $buffer) use ($io) {
$io->write($buffer, false);
$io->write($buffer, FALSE);
};
}
return ($this->executor->execute($command, $output) == 0);
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Command/ComposerMungeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class ComposerMungeCommand extends BaseCommand {

/**
* ${inheritdoc}
* ${inheritdoc}.
*/
protected function configure() {
$this
Expand All @@ -31,7 +31,7 @@ protected function configure() {
}

/**
* ${inheritdoc}
* ${inheritdoc}.
*/
protected function execute(InputInterface $input, OutputInterface $output) {
$file1 = $input->getArgument('file1');
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Command/ConfigurePhantomJsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class ConfigurePhantomJsCommand extends BaseCommand {

/**
* ${inheritdoc}
* ${inheritdoc}.
*/
protected function configure() {
$this
Expand All @@ -26,7 +26,7 @@ protected function configure() {
}

/**
* ${inheritdoc}
* ${inheritdoc}.
*/
protected function execute(InputInterface $input, OutputInterface $output) {
$repo_root = $input->getArgument('repo-root');
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Command/YamlMungeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class YamlMungeCommand extends BaseCommand {

/**
* ${inheritdoc}
* ${inheritdoc}.
*/
protected function configure() {
$this
Expand All @@ -34,7 +34,7 @@ protected function configure() {
}

/**
* ${inheritdoc}
* ${inheritdoc}.
*/
protected function execute(InputInterface $input, OutputInterface $output) {
$file1 = $input->getArgument('file1');
Expand Down
Loading

0 comments on commit a36d1cd

Please sign in to comment.