Author: Nick Sagona, III (nick@popphp.org)
コード例 #1
0
ファイル: LoaderTest.php プロジェクト: nicksagona/PopPHP
 public function testClassmap()
 {
     $classmap = __DIR__ . '/../tmp/classmap.php';
     if (file_exists($classmap)) {
         unlink($classmap);
     }
     Classmap::generate(__DIR__ . '/../../../src', $classmap);
     $this->fileExists($classmap);
     $a = new Autoloader();
     $a->loadClassMap($classmap);
     $this->assertInstanceOf('Pop\\Config', new \Pop\Config(array()));
     unlink($classmap);
 }
コード例 #2
0
ファイル: pop.php プロジェクト: nicksagona/PopPHP
     echo '-----------------------' . PHP_EOL;
     // Check if the source folder and output file arguments were passed
     if (empty($argv[2]) || empty($argv[3])) {
         echo Install::cliError(1);
         // Else, check if the source folder exists
     } else {
         if (!file_exists($argv[2])) {
             echo Install::cliError(2);
             // Else, check if the output file ends in '.php'
         } else {
             if (strtolower(substr($argv[3], -4)) != '.php') {
                 echo Install::cliError(3);
                 // Else, generate the class map file
             } else {
                 echo 'Generating class map file \'' . $argv[3] . '\' from source folder \'' . $argv[2] . '\'' . PHP_EOL;
                 Classmap::generate($argv[2], $argv[3]);
                 // Add project to the bootstrap file
                 $input = Install::cliInput('Add classmap to the bootstrap file? (Y/N) ');
                 if ($input == 'y') {
                     $location = Install::getBootstrap();
                     $bootstrap = new File($location . '/bootstrap.php');
                     $bootstrap->write("\$autoloader->loadClassMap('" . addslashes(realpath($argv[3])) . "');" . PHP_EOL . PHP_EOL, true)->save();
                 }
                 echo 'Done.' . PHP_EOL . PHP_EOL;
             }
         }
     }
     // Else, install project
 } else {
     if ($argv[1] == '-i' || $argv[1] == '--install') {
         // Check if the project install file argument was passed