gabriel 6 years ago
parent
commit
c10120fffb
3 changed files with 37 additions and 35 deletions
  1. 2 0
      tools/installModules.sh
  2. 30 34
      tools/src/GetSource.php
  3. 5 1
      tools/src/Release.php

+ 2 - 0
tools/installModules.sh

@@ -170,6 +170,8 @@ then
         echo "NO SE INSTALAN LOS PAQUETES ADICIONALES"
     fi
     ###################################################################
+    echo ""
+    echo ""
     echo "Desea crear los archivos de instalacion."
     echo "Opciones:"
     echo "    Ingrese 'n' para omitir este paso."

+ 30 - 34
tools/src/GetSource.php

@@ -2,27 +2,23 @@
 
 namespace FD3;
 
+use FD3\Git;
+use PHPGit\Exception\GitException;
 use Symfony\Component\Console\Command\Command;
-use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputArgument;
+use Symfony\Component\Console\Input\InputInterface;
 use Symfony\Component\Console\Input\InputOption;
 use Symfony\Component\Console\Output\OutputInterface;
 
-use FD3\Git;
-use PHPGit\Exception\GitException;
-
 class GetSource extends Command
 {
     protected function configure()
     {
-        $this 
-        ->setName('get:source')
-
-        ->setDescription('Get the source using a ini file.')
-
-        ->setHelp('This command allows you to fetch code based on the git.ini file configuration...')
-
-	 ->addArgument('ini_file', InputArgument::REQUIRED, 'The ini file from where to get the source code config.')
+        $this
+            ->setName('get:source')
+            ->setDescription('Get the source using a ini file.')
+            ->setHelp('This command allows you to fetch code based on the git.ini file configuration...')
+            ->addArgument('ini_file', InputArgument::REQUIRED, 'The ini file from where to get the source code config.')
             ->addOption('remote-name', null, InputOption::VALUE_REQUIRED, 'Rename the remote to this name.', "upstream")
             ->addOption('push', null, InputOption::VALUE_NONE, 'Push to the remote.')
             ->addOption('timeout', null, InputOption::VALUE_OPTIONAL, 'Git process timeout in seconds', 10)
@@ -31,19 +27,19 @@ class GetSource extends Command
 
     protected function execute(InputInterface $input, OutputInterface $output)
     {
-	$file = $input->getArgument("ini_file");
-	
-	$realpath = realpath($file);
-	$dirname = dirname($realpath);
-	if(!chdir($dirname)){
-		throw new \Exception("Can't change working directory to ".$dirname);
-	}
-	
-	$content = parse_ini_file($realpath, true);
-	foreach($content as $sec => $conf){
-		$git = new Git();
+        $file = $input->getArgument("ini_file");
+
+        $realpath = realpath($file);
+        $dirname = dirname($realpath);
+        if (!chdir($dirname)) {
+            throw new \Exception("Can't change working directory to " . $dirname);
+        }
+
+        $content = parse_ini_file($realpath, true);
+        foreach ($content as $sec => $conf) {
+            $git = new Git();
             $git->setTimeout($input->getOption("timeout"));
-		$git_path = $dirname.'/'.$sec;
+            $git_path = $dirname . '/' . $sec;
 
             $url = $conf["url"];
             // Verifico si tiene ssh como protocolo y si la url es de gogs
@@ -52,17 +48,17 @@ class GetSource extends Command
                 $protocol = 'ssh://';
                 $url = $protocol . $url;
             }
-		try{
+            try {
                 $output->writeln($url . " -> " . $git_path);
                 $git->clone($url, $git_path);
-		}catch (GitException $e){
+            } catch (GitException $e) {
                 $git->init($git_path);
-		}
-		$git->setRepository($git_path);
+            }
+            $git->setRepository($git_path);
 
-		try{
+            try {
                 $git->remote->rm($input->getOption("remote-name"));
-		}catch (GitException $e){
+            } catch (GitException $e) {
             }
             $git->remote->add($input->getOption("remote-name"), $url);
             try {
@@ -78,10 +74,10 @@ class GetSource extends Command
                 $git->checkout($conf["branch"]);
             }
             $branches = $git->branch(array("all" => false, "remotes" => true));
-			
+
             if (isset($branches["remotes/" . $input->getOption("remote-name") . "/" . $conf["branch"]])) {
                 $git->merge($input->getOption("remote-name") . "/" . $conf["branch"]);
-		}
+            }
 
             $status = $git->status();
 
@@ -96,7 +92,7 @@ class GetSource extends Command
                     $git->push($input->getOption("remote-name"), $tag, array('force' => true));
                 }
             }
-	}
-	
+        }
+
     }
 }

+ 5 - 1
tools/src/Release.php

@@ -372,13 +372,17 @@ class Release extends Command
         foreach ($this->_modules_all as $name => $value) {
             if (isset($value['REQUIRED']) && $value['REQUIRED']) {
                 $modules[] = $name;
+                $output->writeln("Se instala el modulo $name, por ser una dependencia obligatoria");
             } else {
                 if ($this->checkDepends($modules, $value['DEPENDS'])) {
                     $modules[] = $name;
                     $value['REQUIRED'] = true;
+                    $output->writeln("Se instala el modulo $name, por tener las siguientes dependencias " .
+                        implode(",", $modules));
                 } else {
                     $helper = $this->getHelper('question');
-                    $question = new ConfirmationQuestion("$name? (Y/n)");
+                    $question = new ConfirmationQuestion((isset($value['HELP']) ? ($value['HELP'] . ". ") : "") .
+                        strtoupper($name) . "? (Y/n) ");
                     if ($helper->ask($input, $output, $question)) {
                         $modules [] = $name;
                         $value['REQUIRED'] = true;