/**
  * Make a single stub.
  *
  * @param string $stubName The source filename for the stub.
  */
 public function makeStub($stubName)
 {
     if (!isset($this->stubs[$stubName])) {
         return;
     }
     $sourceFile = $this->getSourcePath() . '/' . $stubName;
     $destinationFile = $this->getDestinationPath() . '/' . $this->stubs[$stubName];
     $destinationContent = $this->files->get($sourceFile);
     /*
      * Parse each variable in to the destination content and path
      */
     foreach ($this->vars as $key => $var) {
         $destinationContent = str_replace('{{' . $key . '}}', $var, $destinationContent);
         $destinationFile = str_replace('{{' . $key . '}}', $var, $destinationFile);
     }
     $this->makeDirectory($destinationFile);
     /*
      * Make sure this file does not already exist
      */
     if ($this->files->exists($destinationFile) && !$this->option('force')) {
         throw new Exception('Stop everything!!! This file already exists: ' . $destinationFile);
     }
     $this->files->put($destinationFile, $destinationContent);
 }
Beispiel #2
0
 /**
  * Determine if a file exists.
  *
  * @param string $path
  * @return bool 
  * @static 
  */
 public static function exists($path)
 {
     //Method inherited from \Illuminate\Filesystem\Filesystem
     return \October\Rain\Filesystem\Filesystem::exists($path);
 }