This repository has been archived by the owner on Mar 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20df9a3
commit 71c634b
Showing
7 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Sweetchuck\Robo\Bundler\Task; | ||
|
||
use Sweetchuck\Robo\Bundler\Utils; | ||
|
||
class BundlePlatformRubyVersionTask extends BaseTask | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected $taskName = 'BundlePlatformRubyVersion'; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected $action = 'platform'; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function getCommandOptions(): array | ||
{ | ||
return [ | ||
'ruby' => [ | ||
'type' => 'flag', | ||
'value' => true, | ||
], | ||
] + parent::getCommandOptions(); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function runProcessOutputs() | ||
{ | ||
$this->assets['full'] = ''; | ||
if ($this->actionExitCode === 0) { | ||
$parts = explode(' ', trim($this->actionStdOutput), 2) + [1 => '']; | ||
$rubyVersion = Utils::parseRubyVersion($parts[1]); | ||
foreach ($rubyVersion as $key => $value) { | ||
$this->assets[$key] = $value; | ||
} | ||
} | ||
|
||
return $this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Sweetchuck\Robo\Bundler\Tests\Acceptance\Task; | ||
|
||
use Sweetchuck\Robo\Bundler\Test\AcceptanceTester; | ||
use Sweetchuck\Robo\Bundler\Test\Helper\RoboFiles\BundleRoboFile; | ||
|
||
class BundlePlatformRubyVersionCest | ||
{ | ||
public function runInstallSuccess(AcceptanceTester $I) | ||
{ | ||
$id = 'bundle:platform:ruby-version'; | ||
$I->runRoboTask($id, BundleRoboFile::class, 'bundle:platform:ruby-version'); | ||
|
||
$exitCode = $I->getRoboTaskExitCode($id); | ||
$stdOutput = $I->getRoboTaskStdOutput($id); | ||
|
||
$I->assertEquals(0, $exitCode); | ||
$I->assertEquals( | ||
implode(PHP_EOL, [ | ||
'full: 2.3.1p112', | ||
'base: 2.3.1', | ||
'major: 2', | ||
'minor: 3', | ||
'fix: 1', | ||
'patch: 112', | ||
'', | ||
]), | ||
$stdOutput | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters