Permalink
Browse files

Add command to generate projects.yml and do so on every building of t…

…he website
  • Loading branch information...
1 parent cfe5672 commit e6c56ea67c55221cbf82c6491044664100e6e111 @beberlei beberlei committed Nov 15, 2012
Showing with 697 additions and 421 deletions.
  1. +1 −1 bin/build-apidocs.php
  2. +63 −3 bin/build-projects.php
  3. +3 −0 build.xml
  4. +54 −3 composer.lock
  5. +547 −413 pages/source/projects.yml
  6. +29 −1 projects.yml
@@ -5,7 +5,7 @@
* Apigen (www.apigen.org) is required.
*/
-require_once __DIR__ . "/../vendor/.composer/autoload.php";
+require_once __DIR__ . "/../vendor/autoload.php";
if (!isset($argv[1])) {
echo "missing argument\n";
@@ -5,9 +5,69 @@
* directory
*/
-require_once __DIR__ . "/../vendor/.composer/autoload.php";
+use Symfony\Component\Yaml\Yaml;
-$file = __DIR__ . "/../projects.yml";
-$data = \Symfony\Component\Yaml\Yaml::parse($file);
+require_once __DIR__ . "/../vendor/autoload.php";
+$file = __DIR__ . "/../projects.yml";
+$projects = Yaml::parse($file);
+
+foreach ($projects as $projectName => $projectData) {
+ echo "Starting Project " . $projectName . "\n";
+ $tagData = json_decode(file_get_contents("https://api.github.com/repos/doctrine/" . $projectData['repository'] . "/tags"), true);
+
+ if ( ! $tagData) {
+ continue;
+ }
+
+ usort($tagData, function($a, $b) {
+ return version_compare($a['name'], $b['name']);
+ });
+
+ foreach ($projectData['versions'] as $version => $versionData) {
+ echo "Starting Branch " . $version . "\n";
+ $projectData['versions'][$version]['releases'] = array();
+ foreach ($tagData as $tag) {
+ if (strpos($tag['name'], $version) === 0) {
+ echo "Preparing " . $tag['name'] . "\n";
+
+ $release = array(
+ 'package_name' => sprintf($projectData['file'], $projectData['package'], $tag['name']),
+ 'git_checkout_command' => '$ git clone git://github.com/doctrine/' . $projectData['repository'] . '.git ' . $projectData['slug'] . '<br>$ cd ' . $projectData['slug'] . '<br>$ git checkout ' . $tag['name'],
+ 'pear_install_command' => '$ pear channel-discover pear.doctrine-project.org<br>pear install doctrine/' . $projectData['package'].'-' . $tag['name'],
+ 'composer' => !isset($versionData['composer']) || $version['composer']
+ );
+
+ $projects[$projectName]['versions'][$version]['releases'][$tag['name']] = $release;
+ }
+ }
+ }
+}
+
+file_put_contents(__DIR__ . "/../pages/source/projects.yml", Yaml::dump($projects, 8, 2));
+
+function get_package_name($package, $tag)
+{
+ $downloadDir = "http://www.doctrine-project.org/downloads/";
+ $fileNames = array(
+ $package . "-" . $tag . "-full.tar.gz",
+ $package . "-" . strtolower($tag) . "-full.tar.gz",
+ $package . "-" . $tag . ".tgz"
+ );
+
+ $packageName = null;
+ $ch = curl_init();
+ foreach ($fileNames as $fileName) {
+ curl_setopt($ch, CURLOPT_URL, $downloadDir . "/" . $fileName);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
+ curl_exec($ch);
+
+ $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+ if ($code == 200) {
+ $packageName = $fileName;
+ break;
+ }
+ }
+}
View
@@ -13,6 +13,9 @@
</target>
<target name="build">
+ <exec executable="php" dir=".">
+ <arg value="bin/build-projects.php" />
+ </exec>
<exec executable="make" dir="pages/">
<arg value="html" />
</exec>
View
@@ -2,8 +2,59 @@
"hash": "6f6b13187be7602e136abe238340170a",
"packages": [
{
- "package": "symfony\/yaml",
- "version": "2.1.0-dev"
+ "name": "symfony/yaml",
+ "version": "v2.1.3",
+ "target-dir": "Symfony/Component/Yaml",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/Yaml",
+ "reference": "v2.1.3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://github.com/symfony/Yaml/zipball/v2.1.3",
+ "reference": "v2.1.3",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "time": "2012-10-29 04:15:41",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.1-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-0": {
+ "Symfony\\Component\\Yaml": ""
+ }
+ },
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "http://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Yaml Component",
+ "homepage": "http://symfony.com"
}
+ ],
+ "packages-dev": null,
+ "aliases": [
+
+ ],
+ "minimum-stability": "stable",
+ "stability-flags": [
+
]
-}
+}
Oops, something went wrong.

0 comments on commit e6c56ea

Please sign in to comment.