Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Packaging

  • Loading branch information...
commit df19e3665254f206dfa1e7f22e4ad8a0cf365529 1 parent b5379bb
@alganet alganet authored
View
2  .gitignore
@@ -1,6 +1,8 @@
.buildpath
.project
.settings/
+tests/reports
+pirum
nbproject
*.7z
*.jar
View
53 Makefile
@@ -0,0 +1,53 @@
+default:
+ @echo "Respect Foundation"
+ @echo 'Please see "make help" for instructions'
+
+help:
+ @echo "Respect Foundation\n"
+ @echo "Available targets:"
+ @echo "help\t\t This message"
+ @echo "test\t\t Run all tests"
+ @echo "coverage\t Run all tests and write HTML coverage reports"
+ @echo "dev\t\t Install the necessary packages to develop this project"
+ @echo "pear-patch\t Creates a PEAR package incrementing the patch revision number (1.1.x)"
+ @echo "pear-minor\t Creates a PEAR package incrementing the minor revision number (1.x.0)"
+ @echo "pear-major\t Creates a PEAR package incrementing the major revision number (x.0.0)"
+ @echo "pirum\t\t PKG=FooPackage.tgz REPO=GitHubFooUser/GitHubFooRepo Send all tgz pear packages to Pirum repository (requires git write access)"
+
+test:
+ @cd tests;phpunit .
+
+coverage:
+ @cd tests;phpunit --coverage-html=reports/coverage .
+ @echo "Done. Reports available on tests/reports/coverage/index.html"
+
+dev:
+ @echo "Installing PEAR packages... (please run as root if needed)"
+ pear upgrade
+ pear config-set auto_discover 1
+ -pear channel-discover respect.li/pear
+ pear install --soft --force pear.phpunit.de/PHPUnit
+ pear install --soft --force pear.pirum-project.org/Pirum
+ pear install --soft --force --alldeps -o package.xml
+
+pear-patch:
+ @echo "Generating package.xml"
+ php bin/pear-package.php patch ${STABILITY}
+ pear package package.xml
+
+pear-minor:
+ @echo "Generating package.xml"
+ php bin/pear-package.php minor ${STABILITY}
+ pear package package.xml
+
+pear-major:
+ @echo "Generating package.xml"
+ php bin/pear-package.php major ${STABILITY}
+ pear package package.xml
+
+pirum:
+ @echo "Cloning channel from git ${REPO}"
+ rm -Rf pirum;git clone git@github.com:${REPO}.git pirum
+ pirum add pirum ${PKG};pirum build pirum;
+ cd pirum;git add .;git commit -m "Added ${PKG}";git push
+ @echo "Success! Pushed ${PKG}"
View
69 bin/pear-package.php
@@ -0,0 +1,69 @@
+<?php
+
+chdir(__DIR__);
+date_default_timezone_set('UTC');
+
+$version_type = isset($argv[1]) ? "{$argv[1]}_version" : "patch_version";
+$stability = isset($argv[2]) ? $argv[2] : null;
+$package_xml_file = '../package.xml';
+
+if (!file_exists($package_xml_file))
+ die("package.xml does not exists");
+
+$package_data = simplexml_load_file($package_xml_file);
+$dir_name = (string) $package_data->contents->dir['name'];
+$target = realpath("../$dir_name");
+$base_install_dir = (string) $package_data->contents->dir['baseinstalldir'];
+unset($package_data->contents->dir);
+$main_dir = $package_data->contents->addChild('dir');
+$main_dir['name'] = $dir_name;
+$main_dir['baseinstalldir'] = $base_install_dir;
+
+foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($target), RecursiveIteratorIterator::LEAVES_ONLY) as $php_file) {
+ $file = $main_dir->addChild('file');
+ $file['role'] = 'php';
+ $file['baseinstalldir'] = $base_install_dir;
+ $file['install-as'] = str_replace($target, '', $php_file);
+ $file['name'] = $dir_name . $file['install-as'];
+}
+
+$package_data->date = date('Y-m-d');
+$package_data->time = date('H:i:s');
+$current_version = $package_data->version->release;
+list($major_version, $minor_version, $patch_version) = explode('.', $current_version);
+
+if (isset($$version_type))
+ $$version_type++;
+else
+ $patch_version++;
+
+switch ($version_type) {
+ case 'major_version':
+ $minor_version = 0;
+ case 'minor_version':
+ $patch_version = 0;
+}
+
+$changelog = $package_data->changelog->addChild('release');
+
+$package_version = "$major_version.$minor_version.$patch_version";
+$stability = $stability ? : $package_data->stability->release;
+
+$changelog->version->api
+ = (string) $changelog->version->release
+ = (string) $package_data->version->api
+ = (string) $package_data->version->release
+ = (string) $package_version;
+$changelog->stability->api
+ = (string) $changelog->stability->release
+ = (string) $package_data->stability->api
+ = (string) $package_data->stability->release
+ = (string) $stability;
+$changelog->license = $package_data->license;
+$changelog->license['uri'] = $package_data->license['uri'];
+
+$dom = new DOMDocument('1.0');
+$dom->preserveWhiteSpace = false;
+$dom->formatOutput = true;
+$dom->loadXML($package_data->asXML());
+$dom->save($package_xml_file);
View
63 library/Respect/package.xml
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<package packagerversion="1.9.4" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
- http://pear.php.net/dtd/tasks-1.0.xsd
- http://pear.php.net/dtd/package-2.0
- http://pear.php.net/dtd/package-2.0.xsd">
- <name>Loader</name>
- <channel>respect.github.com/pear</channel>
- <summary>Hello. I love to load things.</summary>
- <description>Hello. I love to load things.</description>
- <lead>
- <name>Alexandre Gomes Gaigalas</name>
- <user>alganet</user>
- <email>alexandre@gaigalas.net</email>
- <active>yes</active>
- </lead>
- <date>2011-08-17</date>
- <time>17:40:45</time>
- <version>
- <release>0.1.1</release>
- <api>0.1.1</api>
- </version>
- <stability>
- <release>alpha</release>
- <api>alpha</api>
- </stability>
- <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
- <notes>
-Hello. I love to load things.
- </notes>
- <contents>
- <dir baseinstalldir="Respect" name="/">
- <file baseinstalldir="Respect" md5sum="42898e73648f14f45a200e2912368747" name="Loader.php" role="php" />
- </dir>
- </contents>
- <dependencies>
- <required>
- <php>
- <min>5.3</min>
- </php>
- <pearinstaller>
- <min>1.4.0</min>
- </pearinstaller>
- </required>
- </dependencies>
- <phprelease />
- <changelog>
- <release>
- <version>
- <release>0.1.1</release>
- <api>0.1.1</api>
- </version>
- <stability>
- <release>alpha</release>
- <api>alpha</api>
- </stability>
- <date>2011-08-17</date>
- <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
- <notes>
-Hello. I love to load things.
- </notes>
- </release>
- </changelog>
-</package>
View
71 package.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.9.4" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
+ <name>Loader</name>
+ <channel>respect.li/pear</channel>
+ <summary>Hello. I love to load things.</summary>
+ <description>Hello. I love to load things.</description>
+ <lead>
+ <name>Alexandre Gomes Gaigalas</name>
+ <user>alganet</user>
+ <email>alexandre@gaigalas.net</email>
+ <active>yes</active>
+ </lead>
+ <date>2011-11-25</date>
+ <time>20:41:55</time>
+ <version>
+ <release>0.1.2</release>
+ <api>0.1.2</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
+ <notes>
+Hello. I love to load things.
+ </notes>
+ <contents>
+ <dir name="library/Respect" baseinstalldir="Respect">
+ <file role="php" baseinstalldir="Respect" install-as="/Loader.php" name="library/Respect/Loader.php"/>
+ </dir>
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>5.3</min>
+ </php>
+ <pearinstaller>
+ <min>1.4.0</min>
+ </pearinstaller>
+ </required>
+ </dependencies>
+ <phprelease/>
+ <changelog>
+ <release>
+ <version>
+ <release>0.1.1</release>
+ <api>0.1.1</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <date>2011-08-17</date>
+ <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
+ <notes>
+Hello. I love to load things.
+ </notes>
+ </release>
+ <release>
+ <version>
+ <release>0.1.2</release>
+ <api>0.1.2</api>
+ </version>
+ <stability>
+ <release>alpha</release>
+ <api>alpha</api>
+ </stability>
+ <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
+ </release>
+ </changelog>
+</package>
Please sign in to comment.
Something went wrong with that request. Please try again.