Beispiel #1
0
 public function accept(SplFileInfo $item)
 {
     if ('file' !== $item->getType()) {
         return false;
     }
     if ($this->isInVcsDirectory($item)) {
         return false;
     }
     return true;
 }
Beispiel #2
0
 /**
  * @test
  */
 public function constructor()
 {
     $projectRootPath = realpath(__DIR__ . '/../_files');
     $itemPath = $projectRootPath . '/README.txt';
     $pluginManager = $this->getMock('Sherpa\\Plugin\\PluginManager', array(), array(), '', false);
     $splFileInfo = new SplFileInfo($itemPath, $pluginManager, $projectRootPath);
     $this->assertSame($itemPath, $splFileInfo->getPathname());
     $this->assertSame($projectRootPath, $splFileInfo->getProjectRootPath());
     $this->assertSame($pluginManager, $splFileInfo->getPluginManager());
 }
Beispiel #3
0
 public function isInVcsDirectory(SplFileInfo $item)
 {
     // Bazaar
     if (false !== strpos($item->getPathName(), '.bzr/')) {
         return true;
     }
     // CVS
     if (false !== strpos($item->getPathName(), 'CVS/')) {
         return true;
     }
     // Darcs
     if (false !== strpos($item->getPathName(), '_darcs/')) {
         return true;
     }
     // Git
     if (false !== strpos($item->getPathName(), '.git/')) {
         return true;
     }
     // Mercurial
     if (false !== strpos($item->getPathName(), '.hg/')) {
         return true;
     }
     // Monotone
     if (false !== strpos($item->getPathName(), '_MNT/')) {
         return true;
     }
     // Subversion
     if (false !== strpos($item->getPathName(), '.svn/')) {
         return true;
     }
     return false;
 }
Beispiel #4
0
 /**
  * Class constructor
  *
  * @param string        $itemPath        Path of the item
  * @param PluginManager $pluginManager   Plugin manager
  * @param string        $projectRootPath Path of the project root
  *
  * return void
  */
 public function __construct($itemPath, PluginManager $pluginManager, $projectRootPath)
 {
     parent::__construct($itemPath);
     $this->setPluginManager($pluginManager)->setProjectRootPath($projectRootPath);
 }