Browse Source

Expose the Driver of the VcsRepository

Jordi Boggiano 13 years ago
parent
commit
9f55335011
1 changed files with 18 additions and 6 deletions
  1. 18 6
      src/Composer/Repository/VcsRepository.php

+ 18 - 6
src/Composer/Repository/VcsRepository.php

@@ -37,20 +37,32 @@ class VcsRepository extends ArrayRepository
         $this->debug = $debug;
     }
 
-    protected function initialize()
+    public function getDriver()
     {
-        parent::initialize();
-
-        $debug = $this->debug;
-
         foreach ($this->drivers as $driver) {
             if ($driver::supports($this->url)) {
                 $driver = new $driver($this->url);
                 $driver->initialize();
-                break;
+                return $driver;
+            }
+        }
+
+        foreach ($this->drivers as $driver) {
+            if ($driver::supports($this->url, true)) {
+                $driver = new $driver($this->url);
+                $driver->initialize();
+                return $driver;
             }
         }
+    }
+
+    protected function initialize()
+    {
+        parent::initialize();
+
+        $debug = $this->debug;
 
+        $driver = $this->getDriver();
         if (!$driver) {
             throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
         }