summaryrefslogtreecommitdiff
path: root/bin/rr
diff options
context:
space:
mode:
authorparamtamtam <[email protected]>2020-12-07 21:51:18 +0500
committerparamtamtam <[email protected]>2020-12-07 21:51:35 +0500
commit5d62c5508e820248fe150aeda23b85225bc23d04 (patch)
tree1ff6b04cc014918bf8ee0e5fba0d7fdc971217a9 /bin/rr
parentb22078ce707d21ac17ea1727a4174c44ef57ae69 (diff)
GitHub action added, /bin/rr updated
Diffstat (limited to 'bin/rr')
-rwxr-xr-xbin/rr25
1 files changed, 11 insertions, 14 deletions
diff --git a/bin/rr b/bin/rr
index e3e2c1d0..68e38591 100755
--- a/bin/rr
+++ b/bin/rr
@@ -11,7 +11,8 @@ declare(strict_types=1);
foreach ([
__DIR__ . '/../../../autoload.php',
__DIR__ . '/../vendor/autoload.php',
- __DIR__ . '/vendor/autoload.php'
+ __DIR__ . '/vendor/autoload.php',
+ __DIR__ . '/../vendor_php/autoload.php'
] as $file) {
if (file_exists($file)) {
define('RR_COMPOSER_INSTALL', $file);
@@ -51,28 +52,24 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
+use function Couchbase\defaultDecoder;
class RRHelper
{
/**
- * Returns version of RoadRunner based on build.sh file
+ * Returns version of RoadRunner based on current package version.
*
- * @return string Version of RoadRunner
- * @throws Exception
+ * @return string Version of RoadRunner (eg.: `1.8.0`)
*/
public static function getVersion(): string
{
- $file = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'build.sh';
- $fileResource = fopen($file, 'r') or die(1);
- while (!feof($fileResource)) {
- $line = fgets($fileResource, 4096);
- $matches = [];
- if (preg_match("/^RR_VERSION=(.*)/", $line, $matches)) {
- return trim($matches[1]);
- }
+ $version = \PackageVersions\Versions::getVersion('spiral/roadrunner');
+
+ if (\is_int($delimiter_position = \mb_strpos($version, '@'))) {
+ $version = \mb_substr($version, 0, (int) $delimiter_position);
}
- fclose($fileResource);
- throw new Exception("Can't find version of RoadRunner");
+
+ return \ltrim($version, 'vV');
}
/**