|
@@ -40,18 +40,21 @@ class ComposerRequireCommand extends Command
|
|
|
foreach ($content as $sec => $conf) {
|
|
|
$composer_file = $sec . "/composer.json";
|
|
|
if (file_exists($composer_file)) {
|
|
|
+ $output->writeln("----------------------------------------------------------------------");
|
|
|
$output->writeln($sec);
|
|
|
$composer_data = json_decode(file_get_contents($composer_file), true);
|
|
|
try {
|
|
|
foreach (array("require", "require-dev") as $k) {
|
|
|
$output->writeln('Ejecutando:');
|
|
|
- $output->writeln('\tgit stash; git checkout master; git pull origin master');
|
|
|
- shell_exec('cd ' . $sec . '; git stash; git checkout master; git pull origin master');
|
|
|
+ $command = 'cd ' . $sec . '; git stash; git fetch; git checkout master; git pull origin master';
|
|
|
+ $output->writeln("\t" . $command);
|
|
|
+ shell_exec($command);
|
|
|
if (strlen($pull) > 0) {
|
|
|
- $output->writeln('\tgit pull origin ' . $pull);
|
|
|
- shell_exec('cd ' . $sec . '; git pull origin ' . $pull);
|
|
|
+ $command = 'cd ' . $sec . '; git pull origin ' . $pull);
|
|
|
+ $output->writeln("\t" . $command);
|
|
|
+ shell_exec($command);
|
|
|
}
|
|
|
- $output->writeln('\tReemplazo composer.json');
|
|
|
+ $output->writeln("\t" . 'Reemplazo composer.json');
|
|
|
foreach ($composer_data[$k] as $package => $version) {
|
|
|
if (strpos($packages, "*") !== false) {
|
|
|
$preg = "|^" . str_replace("*", "[^\b]*", $packages) . "$|";
|
|
@@ -59,7 +62,7 @@ class ComposerRequireCommand extends Command
|
|
|
$composer_data[$k][$package] = (string)$new_version;
|
|
|
$output->writeln("\t\t" . $package . " = " . $new_version);
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
if (strcmp($packages, $package) === 0) {
|
|
|
$composer_data[$k][$package] = (string)$new_version;
|
|
|
$output->writeln("\t\t" . $package . " = " . $new_version);
|
|
@@ -70,13 +73,15 @@ class ComposerRequireCommand extends Command
|
|
|
file_put_contents($composer_file, json_encode($composer_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
|
|
|
if ($dockerCompose) {
|
|
|
$output->writeln('Composer update');
|
|
|
- $output->writeln('\tdocker-compose exec ' . $sec . ' bin/composer-update.sh');
|
|
|
- shell_exec('docker-compose exec ' . $sec . ' bin/composer-update.sh');
|
|
|
+ $command = 'docker-compose exec ' . $sec . ' bin/composer-update.sh';
|
|
|
+ $output->writeln("\t" . $command);
|
|
|
+ shell_exec($command);
|
|
|
}
|
|
|
} catch (Throwable $t) {
|
|
|
$output->writeln('Se produjo un error. Reestableciendo datos.');
|
|
|
- $output->writeln('\tcd ' . $sec . '; git reset');
|
|
|
- $shell_exec('cd ' . $sec . '; git reset');
|
|
|
+ $command = 'cd ' . $sec . '; git reset');
|
|
|
+ $output->writeln("\t" . $command);
|
|
|
+ $shell_exec($command);
|
|
|
}
|
|
|
} else {
|
|
|
$output->writeln($sec . " no composer.json found");
|
|
@@ -84,3 +89,4 @@ class ComposerRequireCommand extends Command
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|