Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
feat(composer) Kitab can be used as a dependency.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Jul 5, 2017
1 parent 4a8ab03 commit 99cd896
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
31 changes: 22 additions & 9 deletions src/Bin/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ public function run()
}

$finder = new Finder();
$finder->in($directoryToScan);
$finder
->in($directoryToScan)
->notIn('/^vendor$/');

if (is_dir($outputDirectory)) {
$since = time() - filemtime($outputDirectory);
Expand Down Expand Up @@ -162,13 +164,24 @@ public function run()

$autoloader = $temporaryAutoloader->getStreamName();
} else {
$command =
dirname(dirname(__DIR__)) . DS .
'vendor' . DS .
'atoum' . DS .
'atoum' . DS .
'bin' . DS .
'atoum';
if (WITH_COMPOSER) {
$command =
dirname(__DIR__, 4) . DS .
'atoum' . DS .
'atoum' . DS .
'bin' . DS .
'atoum';
$composerAutoloader = realpath(dirname(__DIR__, 4) . DS . 'autoload.php');
} else {
$command =
dirname(__DIR__, 2) . DS .
'vendor' . DS .
'atoum' . DS .
'atoum' . DS .
'bin' . DS .
'atoum';
$composerAutoloader = realpath(dirname(__DIR__, 2) . DS . 'vendor' . DS . 'autoload.php');
}

if (false === file_exists($command)) {
throw new \RuntimeException(
Expand All @@ -186,7 +199,7 @@ public function run()
$temporaryAutoloader = new File\Write($temporaryAutoloaderPath, File\File::MODE_TRUNCATE_WRITE);
$temporaryAutoloader->writeAll(
'<?php' . "\n\n" .
'require_once \'' . str_replace("'", "\\'", realpath(dirname(__DIR__, 2) . DS . 'vendor' . DS . 'autoload.php')) . '\';' . "\n" .
'require_once \'' . str_replace("'", "\\'", $composerAutoloader) . '\';' . "\n" .
(!empty($autoloader) ? 'require_once \'' . str_replace("'", "\\'", realpath($autoloader)) . '\';' : '')
);

Expand Down
2 changes: 1 addition & 1 deletion src/Finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ public function __construct()
$this
->files()
->name('/\.php$/')
->notIn('#^\.(git|hg)$#');
->notIn('/^\.(git|hg)$/');
}
}

0 comments on commit 99cd896

Please sign in to comment.