sourcedir: guess basic package info
[pharext/pharext] / src / pharext / SourceDir / Git.php
index e17a3055c15d1b5fd534e73f3bdbb3f529afbc67..9c51c7d25febbbb651eacb9d7e47251f01ab883b 100644 (file)
@@ -2,15 +2,22 @@
 
 namespace pharext\SourceDir;
 
-use pharext\Command;
 use pharext\Cli\Args;
+use pharext\Exception;
+use pharext\ExecCmd;
+use pharext\License;
+use pharext\PackageInfo;
 use pharext\SourceDir;
+use pharext\Tempfile;
 
 /**
  * Extension source directory which is a git repo
  */
 class Git implements \IteratorAggregate, SourceDir
 {
+       use License;
+       use PackageInfo;
+       
        /**
         * Base directory
         * @var string
@@ -38,7 +45,18 @@ class Git implements \IteratorAggregate, SourceDir
         * @return array
         */
        public function getPackageInfo() {
-               return [];
+               return $this->findPackageInfo($this->getBaseDir());
+       }
+
+       /**
+        * @inheritdoc
+        * @return string
+        */
+       public function getLicense() {
+               if (($file = $this->findLicense($this->getBaseDir()))) {
+                       return $this->readLicense($file);
+               }
+               return "UNKNOWN";
        }
 
        /**