Pārlūkot izejas kodu

merged branch drak/vendors (PR #2652)

Commits
-------

86a8b9f Allow vendors checkout transport method to be overridden manually.

Discussion
----------

Allow vendors checkout transport method to be overridden manually.

In one particular environment I cannot checkout using vendors.php using the default http:// transport methods, but only git://

This patch gives complete freedom to override the default.

Side note: http:// as a transport method at github is deprecated as all http:// urls redirect to https://

My motivation for this patch is to allow continuous integration (previous phing patch closed which included this required change) since multiple regular checkouts to github via http protocol get blocked more but git based protocol transport don't.  Without this, vendors.php may not always work and it's required to get the dependencies in order to be able to run the unit tests.

---------------------------------------------------------------------------

by stealth35 at 2011/11/15 06:14:32 -0800

If `http` is deprecated why you put this in default ?

---------------------------------------------------------------------------

by drak at 2011/11/15 06:26:17 -0800

Since the current list of checkouts is using `http`, I just left it.  I try to keep topic branches laser focused so it's clear what the change was about.  If you would like, I can change it because it actually makes sense.  By the way, I double checked with `curl -I http://github.com/symfony/symfony.git` and the only response is a redirect to `https`.

---------------------------------------------------------------------------

by drak at 2011/11/15 18:40:16 -0800

Reopening on `master`.

---------------------------------------------------------------------------

by drak at 2011/11/15 21:32:09 -0800

Ok I've rebased this branch and force updated the branch so it's against 2.0 and has the changes discussed.
Fabien Potencier 13 gadi atpakaļ
vecāks
revīzija
d2d4e716ec
1 mainītis faili ar 10 papildinājumiem un 0 dzēšanām
  1. 10 0
      vendors.php

+ 10 - 0
vendors.php

@@ -25,6 +25,12 @@ if (!is_dir($vendorDir = dirname(__FILE__).'/vendor')) {
     mkdir($vendorDir, 0777, true);
 }
 
+// optional transport change
+$transport = false;
+if (isset($argv[1]) && in_array($argv[1], array('--transport=http', '--transport=https', '--transport=git'))) {
+    $transport = preg_replace('/^--transport=(.*)$/', '$1', $argv[1]);
+}
+
 $deps = array(
     array('doctrine', 'http://github.com/doctrine/doctrine2.git', '2.1.2'),
     array('doctrine-dbal', 'http://github.com/doctrine/dbal.git', '2.1.3'),
@@ -36,6 +42,10 @@ $deps = array(
 
 foreach ($deps as $dep) {
     list($name, $url, $rev) = $dep;
+    
+    if ($transport) {
+        $url = preg_replace('/^(http:|https:|git:)(.*)/', $transport . ':$2', $url);
+    }
 
     echo "> Installing/Updating $name\n";