Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic path for composer task #701

Merged
merged 29 commits into from Feb 14, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleanup
  • Loading branch information
Alex Verbruggen committed Mar 24, 2017
commit 9a919f04225abbb08669d79789fe601e92ab00a6
61 changes: 35 additions & 26 deletions classes/phing/tasks/ext/ComposerTask.php
Original file line number Diff line number Diff line change
@@ -35,37 +35,39 @@
class ComposerTask extends Task
{
/**
* @var string the path to php interpreter
* Path to php interpreter
* @var string
*/
private $php = '';

/**
*
* @var string the Composer command to execute
* Composer command to execute
* @var string
*/
private $command = null;

/**
*
* Commandline object
* @var Commandline
*/
private $commandLine = null;

/**
*
* @var string path to Composer application
* Path to Composer application
* @var string
*/
private $composer = 'composer.phar';

/**
*
* Constructor.
*/
public function __construct()
{
$this->commandLine = new Commandline();
}

/**
* Initialize the interpreter with the Phing property php.interpreter
* Initialize the interpreter with the Phing property php.interpreter.
*/
public function init()
{
@@ -83,7 +85,7 @@ public function setPhp($php)
}

/**
* gets the path to php executable.
* Gets the path to php executable.
*
* @return string
*/
@@ -93,7 +95,8 @@ public function getPhp()
}

/**
* sets the Composer command to execute
* Sets the Composer command to execute.
*
* @param string $command
*/
public function setCommand($command)
@@ -102,7 +105,8 @@ public function setCommand($command)
}

/**
* return the Composer command to execute
* Return the Composer command to execute.
*
* @return String
*/
public function getCommand()
@@ -111,7 +115,8 @@ public function getCommand()
}

/**
* sets the path to Composer application
* Sets the path to Composer application.
*
* @param string $console
*/
public function setComposer($console)
@@ -120,7 +125,10 @@ public function setComposer($console)
}

/**
* returns the path to Composer application
* Returns the path to Composer application.
*
* If the filepath is non existant, try to find it on the system.
*
* @return string
*/
public function getComposer()
@@ -139,7 +147,7 @@ public function getComposer()
}

/**
* creates a nested arg task
* Creates a nested arg task.
*
* @return Arg Argument object
*/
@@ -150,7 +158,19 @@ public function createArg()
}

/**
* Prepares the command string to be executed
* Check is php is running on Windows.
*
* @return boolean
*/
private function isWindows()
{
$operatingSystemName = php_uname('s');
return strtoupper(substr($operatingSystemName, 0, 3)) === 'WIN';
}

/**
* Prepares the command string to be executed.
*
* @return string
*/
private function prepareCommandLine()
@@ -166,17 +186,6 @@ private function prepareCommandLine()
return $commandLine;
}

/**
*
* @return boolean
*/
private function isWindows()
{
$operatingSystemName = php_uname('s');
return strtoupper(substr($operatingSystemName, 0, 3)) === 'WIN';
}


/**
* Executes the Composer task.
*/