瀏覽代碼

Merged in FD3-387 (pull request #26)

FD3-398 fix nombres de containers
Guillermo Espinoza 7 年之前
父節點
當前提交
ac99dc7120
共有 1 個文件被更改,包括 17 次插入11 次删除
  1. 17 11
      tools/src/Release.php

+ 17 - 11
tools/src/Release.php

@@ -76,6 +76,11 @@ class Release extends Command
      */
     private $_user_system;
 
+    /**
+    * @var string $directory Directorio de instalación
+    */
+    private $directory;
+
     /**
      * Constructor.
      *
@@ -242,13 +247,13 @@ class Release extends Command
                     $input->setOption("modules", $modules);
                 }
                 $this->AddModules(explode(",", $input->getOption("modules")));
-                $dir = $input->getArgument('dir');
-                if (!is_dir($dir)) {
-                    mkdir($dir, 0777, true);
+                $this->directory = $input->getArgument('dir');
+                if (!is_dir($this->directory)) {
+                    mkdir($this->directory, 0777, true);
                 }
-                if (file_exists($dir . "/" . $this->_running_log)) {
+                if (file_exists($this->directory . "/" . $this->_running_log)) {
                     $helper = $this->getHelper('question');
-                    $question = new ConfirmationQuestion('The ' . realpath($dir) . "/" . $this->_running_log . ' file exist. Read file or take parameters? (Y/n)', true);
+                    $question = new ConfirmationQuestion('The ' . realpath($this->directory) . "/" . $this->_running_log . ' file exist. Read file or take parameters? (Y/n)', true);
                     if ($helper->ask($input, $output, $question)) {
                         $this->setParametersFormFile($input);
                     }
@@ -258,19 +263,19 @@ class Release extends Command
                 $this->_dir = realpath($dir);
 
                 if (!$this->_client) {
-                    $this->_client = basename(realpath($dir));
+                    $this->_client = basename(realpath($this->directory));
                 }
 
                 $docker_tag = $input->getOption("docker-tag");
 
-	        $this->internal_user_id = 2;	    
+	        $this->internal_user_id = 2;
 
                 $this->_ansible_vars["DOMAIN"] = $this->_domain;
                 $this->_ansible_vars["CLIENT"] = $this->_client;
                 $this->_ansible_vars["CMD_USERNAME"] = $this->_user_system['users'][$this->internal_user_id]['user'];
                 $this->_ansible_vars["CMD_PASSWORD"] = $this->_user_system['users'][$this->internal_user_id]['password'];
 
-                $dObj = new DevOps\FileSystem(realpath($dir));
+                $dObj = new DevOps\FileSystem(realpath($this->directory));
                 $dObj->dirExists()->realpath();
                 $this->_dObj = $dObj;
 
@@ -295,7 +300,7 @@ class Release extends Command
 
                 $dObj->file('install.yml')->content(
                     yaml::dump(array(
-                            "install_dir" => realpath($dir),
+                            "install_dir" => realpath($this->directory),
                             'docker_apps' => "base," . implode(",", $this->_ansible_vars),
                             'domain' => $this->_domain,
                         )
@@ -1085,10 +1090,11 @@ class Release extends Command
     {
         $tmp = "";
         $all = "[all]\n";
+        $prefix = basename(realpath($this->directory));
         foreach ($composer->getServices() as $key => $value) {
             $tmp .= "[$key]\n";
-            $tmp .= basename($this->_dir) . "_" . $key . "_1\n\n";
-            $all .= basename($this->_dir) . "_" . $key . "_1\n";
+            $tmp .= $prefix . "_" . $key . "_1\n\n";
+            $all .= $prefix . "_" . $key . "_1\n";
         }
 
         $this->_dObj->file("inventory.ini")->content($tmp . $all);