Esempio n. 1
0
 public function testGetAbsolutePath()
 {
     $baseDir = '/path/to/app';
     $relPath1 = 'another/given/path';
     $relPath2 = 'file';
     $this->assertEquals($baseDir . DIRECTORY_SEPARATOR . $relPath1, Path::absolute($relPath1, $baseDir));
     $this->assertEquals($baseDir . DIRECTORY_SEPARATOR . $relPath2, Path::absolute($relPath2, $baseDir));
     $this->assertEquals('/file', Path::absolute('/file', $baseDir));
     $this->assertEquals('\\file', Path::absolute('\\file', $baseDir));
     $this->assertEquals('c:\\file', Path::absolute('c:\\file', $baseDir));
 }
Esempio n. 2
0
 /**
  * Function to write out the built up composer.json
  * file based on the directives parsed from the Foreman
  * template file
  * 
  * @return void
  */
 public function writeComposerJson()
 {
     $composerJson = Path::absolute('composer.json', $this->appDir);
     $this->command->comment('Foreman', "Writing composer file to {$composerJson}");
     $this->filesystem->put($composerJson, $this->getComposerJson());
 }
Esempio n. 3
0
 /**
  * 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);
         }
     }
 }
Esempio n. 4
0
 public function testMakeDirectories()
 {
     $appDir = '/path/to/app';
     $mFS = m::mock('Illuminate\\Filesystem\\Filesystem');
     $mCmd = m::mock('Console\\BuildCommand');
     foreach ($this->getConfig()['mkdir'] as $dir) {
         $mCmd->shouldReceive('comment')->once()->with("Make Directory", $dir);
         $mFS->shouldReceive('makeDirectory')->once()->with(Path::absolute($dir, $appDir), 0777, true);
     }
     $structure = new Structure($dir, $this->getConfig(), $mFS, $mCmd);
     $structure->mkdirs();
 }