Browse Source

Se quito un stash y se agregaron comentarios para saber que se esta ejecutando

gabriel 7 years ago
parent
commit
86313c0346
2 changed files with 21 additions and 6 deletions
  1. 9 2
      tools/src/Command/TagModulesCommand.php
  2. 12 4
      tools/src/ComposerRequireCommand.php

+ 9 - 2
tools/src/Command/TagModulesCommand.php

@@ -60,8 +60,6 @@ class TagModulesCommand extends Command
                     $git->config->add('user.name', 'drone', ["global" => true]);
                     // agrego el path del repositorio
 		    $git->setRepository($git_path);
-		    // guardo cualquier cambio anterior.
-		    $git->stash();
                     // necesito traer todos los branch's para ver si ya existe
                     $branchs = $git->branch(['all' => true]);
                     $findBranch = false;
@@ -76,19 +74,25 @@ class TagModulesCommand extends Command
                     }
                     if (!$findBranch) {
                         // si no existe el branch y estoy creando un branch nuevo
+                        $output->writeln('Creando la rama ' . $version);
                         $git->branch->create($version);
                     }
 		    // cambio a la rama de la version y agrego los archivos modificados
+                    $output->writeln('Checkout de la rama ' . $version);
                     $git->checkout($version);
                     $git->add('composer.json');
                     $git->add('composer.lock');
 
+                    $output->writeln('Push de los composer');
+                    $output->writeln('\t' . $cd_path . "; git commit -am 'Composer para la version " . $version . " y el tag " . $tag . "'");
                     shell_exec($cd_path . "; git commit -am 'Composer para la version " . $version . " y el tag " . $tag . "'");
+                    $output->writeln('\t' . "; git push " . $optionRemoteGit . " " . $version);
                     shell_exec($cd_path . "; git push " . $optionRemoteGit . " " . $version );
                     // estoy creando un tag
                     $tags = $git->tag();
                     if (!in_array($tag, $tags)) {
                         // el tag no existe
+                        $output->writeln('Creo el tag: ' . $tag);
                         if ($branchRemote == null) {
                             // el branch remote no existe
                             $git->tag->create($tag, $version);
@@ -98,6 +102,9 @@ class TagModulesCommand extends Command
                         }
                     }
                     // ejecuto el comando git
+                    $output->writeln('Push de la rama.');
+                    $output->writeln('\t' . "; git push " . $optionRemoteGit . " --tags ");
+		    // tengo que hacer el  --tags para que pase todos los tags
                     shell_exec($cd_path . "; git push " . $optionRemoteGit . " --tags ");
                 } catch (GitException $e) {
                     $output->writeln("SE PRODUJO UN ERROR EN " . $sec);

+ 12 - 4
tools/src/ComposerRequireCommand.php

@@ -44,30 +44,38 @@ class ComposerRequireCommand extends Command
                 $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');
                         if (strlen($pull) > 0) {
-                            shell_exec('cd ' . $sec . '; git stash; git checkout master; git pull origin ' . $pull);
+		            $output->writeln('\tgit pull origin ' . $pull);
+                            shell_exec('cd ' . $sec . '; git pull origin ' . $pull);
                         }
+		        $output->writeln('\tReemplazo composer.json');
                         foreach ($composer_data[$k] as $package => $version) {
                             if (strpos($packages, "*") !== false) {
                                 $preg = "|^" . str_replace("*", "[^\b]*", $packages) . "$|";
                                 if (preg_match($preg, $package)) {
                                     $composer_data[$k][$package] = (string)$new_version;
-                                    $output->writeln("\t" . $package . " = " . $new_version);
+                                    $output->writeln("\t\t" . $package . " = " . $new_version);
                                 }
                             } else {
                                 if (strcmp($packages, $package) === 0) {
                                     $composer_data[$k][$package] = (string)$new_version;
-				    $output->writeln("\t" . $package . " = " . $new_version);
+				    $output->writeln("\t\t" . $package . " = " . $new_version);
                                 }
                             }
                         }
                     }
                     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');
                     }
 		} catch (Throwable $t) {
-		    $output->writeln("Se produjo un error. Reestableciendo datos. ");
+		    $output->writeln('Se produjo un error. Reestableciendo datos.');
+		    $output->writeln('\tcd ' . $sec . '; git reset');
                     $shell_exec('cd ' . $sec . '; git reset');
 		}
             } else {