コード例 #1
0
ファイル: TemplateReader.php プロジェクト: dhaval48/foreman
 /**
  * Constructor to set member vars, and read in the 
  * given config file as json, then convert it to an
  * associative array
  * 
  * @param string       $tpl
  * @param Filesystem   $fs 
  * @param BuildCommand $cmd
  */
 public function __construct($tpl, Filesystem $fs, BuildCommand $cmd)
 {
     $this->command = $cmd;
     $this->filesystem = $fs;
     $this->command->comment("Foreman", "Reading template from {$tpl}");
     $this->config = json_decode($this->filesystem->get($tpl), true);
 }
コード例 #2
0
ファイル: Laravel.php プロジェクト: dhaval48/foreman
 /**
  * Function to install Laravel
  * 
  * @return string directory where app was installed
  */
 public function install()
 {
     $this->command->comment("Foreman", "Installing fresh Laravel app");
     $this->builder->setPrefix('composer');
     $this->builder->setArguments(['create-project', 'laravel/laravel', $this->appDir, '--prefer-dist']);
     $this->builder->getProcess()->run();
     $this->command->comment("Foreman", "Done, Laravel installed at: {$this->appDir}");
     return $this->appDir;
 }
コード例 #3
0
ファイル: Structure.php プロジェクト: dhaval48/foreman
 /**
  * Function to create directories given in the template configuration
  * 
  * @return void
  */
 public function mkdirs()
 {
     $key = str_replace(TemplateReader::STRUCTURE . '.', '', TemplateReader::STRUCTURE_MKDIR);
     $data = array_get($this->config, $key);
     foreach ($data as $dir) {
         if (!empty($dir)) {
             $dir = Path::absolute($dir, $this->appDir);
             $this->command->comment("Make Directory", $dir);
             $this->filesystem->makeDirectory($dir, 0777, true);
         }
     }
 }
コード例 #4
0
ファイル: Composer.php プロジェクト: dhaval48/foreman
 /**
  * Function to process the Foreman template section related
  * to 'autoload > psr-4' and make the appropriate updates to the composer
  * directives held in memory.
  * 
  * @return void
  */
 public function autoloadPsr4()
 {
     $key = str_replace(TemplateReader::COMPOSER . '.', '', TemplateReader::COMPOSER_AUTOLOAD_PSR4);
     $data = array_get($this->config, $key);
     $psr4 = [];
     foreach ($data as $name => $value) {
         $this->command->comment("Composer", "Adding PSR4 entry {$name} => {$value}");
         $psr4[$name] = $value;
     }
     if (count($psr4) > 0) {
         array_set($this->composer, static::AUTOLOAD_PSR4, $psr4);
     }
 }