fix builds of relative paths
[pharext/pharext] / src / pharext / SourceDir / Basic.php
index fa180fee5896eede4bcefb5aebf2032a9c45e07b..e5b2d230c36ea071dc4e28133a09895df2abd7f1 100644 (file)
@@ -4,6 +4,7 @@ namespace pharext\SourceDir;
 
 use pharext\Cli\Args;
 use pharext\License;
+use pharext\PackageInfo;
 use pharext\SourceDir;
 
 use FilesystemIterator;
@@ -16,21 +17,26 @@ use RecursiveIteratorIterator;
 class Basic implements IteratorAggregate, SourceDir
 {
        use License;
-       
+       use PackageInfo;
+
        private $path;
-       
+
        public function __construct($path) {
-               $this->path = $path;
+               $this->path = realpath($path);
        }
-       
+
        public function getBaseDir() {
                return $this->path;
        }
-       
+
+       /**
+        * @inheritdoc
+        * @return array
+        */
        public function getPackageInfo() {
-               return [];
+               return $this->findPackageInfo($this->getBaseDir());
        }
-       
+
        public function getLicense() {
                if (($file = $this->findLicense($this->getBaseDir()))) {
                        return $this->readLicense($file);
@@ -41,7 +47,7 @@ class Basic implements IteratorAggregate, SourceDir
        public function getArgs() {
                return [];
        }
-       
+
        public function setArgs(Args $args) {
        }
 
@@ -62,7 +68,7 @@ class Basic implements IteratorAggregate, SourceDir
                $rii = new RecursiveIteratorIterator($rci);
                foreach ($rii as $path => $child) {
                        if (!$child->isDir()) {
-                               yield $path;
+                               yield realpath($path);
                        }
                }
        }