Exemplo n.º 1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $skelton = realpath(__DIR__ . '/../../../skelton');
     $project_folder = new BaseIo($this->getApplication()->getProject()->getPath()->get());
     $skelton_folder = new BaseIo($skelton);
     # ask for confirmation if dir is not empty
     if ($project_folder->isEmpty() === false) {
         # as for confirmation
         $dialog = $this->getHelperSet()->get('dialog');
         if (!$dialog->askConfirmation($output, '<question>Folder is not empty continue? [y|n]</question>', false)) {
             return;
         }
     }
     $this->getApplication()->getProject()->build($project_folder, $skelton_folder, $output);
 }
Exemplo n.º 2
0
 public function __construct($base_folder)
 {
     parent::__construct($base_folder);
 }
Exemplo n.º 3
0
 public function testSkeltonExists()
 {
     $skelton = new Io(realpath(__DIR__ . '/../skelton'));
     $this->assertTrue(is_dir($skelton->path()));
     return $skelton;
 }
Exemplo n.º 4
0
 public function build(\Faker\Io\Io $folder, \Faker\Io\Io $skelton, \Symfony\Component\Console\Output\OutputInterface $output)
 {
     $mode = 0777;
     #check if root folder exists
     if (is_dir($folder->getBase()) === false) {
         throw new FakerException('Root directory does not exist');
     }
     #make config folders
     $config_path = $folder->getBase() . DIRECTORY_SEPARATOR . 'config';
     if (mkdir($config_path, $mode) === TRUE) {
         $output->writeln('<info>Created Config Folder</info>');
         //copy files into it
         $files = $skelton->iterator('config');
         foreach ($files as $file) {
             if ($this->copy($file, $config_path) === TRUE) {
                 $output->writeln('++ Copied ' . basename($file));
             }
         }
     }
     #make template folder
     $template_path = $folder->getBase() . DIRECTORY_SEPARATOR . 'template';
     if (mkdir($template_path, $mode) === TRUE) {
         $output->writeln('<info>Created Template Folder</info>');
         //copy files into it
         $files = $skelton->iterator('template');
         foreach ($files as $file) {
             if ($this->copy($file, $template_path) === TRUE) {
                 $output->writeln('++ Copied ' . basename($file));
             }
         }
     }
     #make extension extension folder
     $extension_path = $folder->getBase() . DIRECTORY_SEPARATOR . 'extension';
     if (mkdir($extension_path, $mode) === TRUE) {
         $output->writeln('<info>Created Extension Folder</info>');
         //copy files into it
         $files = $skelton->iterator('extension');
         foreach ($files as $file) {
             if ($this->copy($file, $extension_path) === TRUE) {
                 $output->writeln('++ Copied ' . basename($file));
             }
         }
     }
     #make dump folder
     $dump_path = $folder->getBase() . DIRECTORY_SEPARATOR . 'dump';
     if (mkdir($dump_path, $mode) === TRUE) {
         $output->writeln('<info>Created Dump Folder</info>');
     }
     #make sources folder
     $sources_path = $folder->getBase() . DIRECTORY_SEPARATOR . 'sources';
     if (mkdir($sources_path, $mode) === TRUE) {
         $output->writeln('<info>Created Sources Folder</info>');
         //copy files into it
         $files = $skelton->iterator('sources');
         foreach ($files as $file) {
             if ($this->copy($file, $sources_path) === TRUE) {
                 $output->writeln('++ Copied ' . basename($file));
             }
         }
     }
 }