Browse files

Initial project structure from Foundation

  • Loading branch information...
1 parent 98d2623 commit f8e6b65d5f6ba8988a244b1053961d2a7c0ff07d @alganet alganet committed Feb 14, 2012
Showing with 803 additions and 0 deletions.
  1. +10 −0 .travis.yml.incomplete
  2. +27 −0 LICENSE
  3. +110 −0 Makefile
  4. 0 README
  5. +36 −0 README.md
  6. +158 −0 bin/common-inc.php
  7. +51 −0 bin/composer-package.php
  8. +67 −0 bin/pear-package.php
  9. +50 −0 bin/phar-package.php
  10. +163 −0 bin/replace-vars.php
  11. +29 −0 composer.json
  12. +56 −0 package.xml
  13. +28 −0 tests/bootstrap.php
  14. +18 −0 tests/phpunit.xml
View
10 .travis.yml.incomplete
@@ -0,0 +1,10 @@
+language: php
+script: make test
+
+php:
+ - 5.3
+ - 5.4
+
+before_script:
+ - "sudo apt-get install -y php-pear"
+ - "sudo make dev"
View
27 LICENSE
@@ -0,0 +1,27 @@
+Copyright (c) 2009-2012, Alexandre Gaigalas.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of Alexandre Gaigalas nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
View
110 Makefile
@@ -0,0 +1,110 @@
+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 "patch\t\t Updates the package.xml and composer.json increasing the patch revision number (1.1.x)"
+ @echo "minor\t\t Updates the package.xml and composer.json increasing the minor revision number (1.x.0)"
+ @echo "major\t\t Updates the package.xml and composer.json increasing the major revision number (x.0.0)"
+ @echo "pear\t\t Creates a PEAR package from the current package.xml"
+ @echo "phar\t\t Creates a Phar package from the current package.xml"
+ @echo "pirum-push\t PKG=FooPackage.tgz REPO=GitHubFooUser/GitHubFooRepo Send a tgz pear package to Pirum repository (requires git write access)"
+ @echo "phar-push\t PKG=FooPackage.phar REPO=GitHubFooUser/GitHubFooRepo Send a phar packages to phar 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
+
+patch:
+ @echo "Generating package.xml and composer.json patch version"
+ @echo
+ php bin/pear-package.php patch ${STABILITY}
+ @echo
+ php bin/composer-package.php patch ${STABILITY}
+
+minor:
+ @echo "Generating package.xml and composer.json minor version"
+ @echo
+ php bin/pear-package.php minor ${STABILITY}
+ @echo
+ php bin/composer-package.php minor ${STABILITY}
+
+major:
+ @echo "Generating package.xml and composer.json major version"
+ @echo
+ php bin/pear-package.php major ${STABILITY}
+ @echo
+ php bin/composer-package.php major ${STABILITY}
+
+pear:
+ @echo "Generating package tgz"
+ pear package package.xml
+
+phar:
+ @echo "Generating package phar"
+ php -dphar.readonly=0 bin/phar-package.php
+
+pirum-push:
+ @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}"
+
+phar-push:
+ @echo "Cloning channel from git ${REPO}"
+ -rm -Rf phar
+ git clone git@github.com:${REPO}.git phar
+ cp ${PKG} phar
+ cd phar;git add .;git commit -m "Added ${PKG}";git push
+ @echo "Success! Pushed ${PKG}"
+
+foundation:
+ @echo "Cloning Foundation from GitHub"
+ -rm -Rf .foundation-tmp
+ git clone git://github.com/Respect/Foundation.git .foundation-tmp
+ @echo "Renaming .dist files and removing repo metadata"
+ rm .foundation-tmp/README.md
+ rm .foundation-tmp/LICENSE
+ mv .foundation-tmp/README.md.dist .foundation-tmp/README.md
+ mv .foundation-tmp/LICENSE.dist .foundation-tmp/LICENSE
+ mv .foundation-tmp/package.xml.dist .foundation-tmp/package.xml
+ mv .foundation-tmp/composer.json.dist .foundation-tmp/composer.json
+ -mkdir bin
+ -mkdir tests
+ -mkdir library
+ -cp -f .foundation-tmp/bin/common-inc.php bin
+ -cp -f .foundation-tmp/bin/composer-package.php bin
+ -cp -f .foundation-tmp/bin/pear-package.php bin
+ -cp -f .foundation-tmp/bin/phar-package.php bin
+ -cp -f .foundation-tmp/bin/replace-vars.php bin
+ -cp -f .foundation-tmp/tests/bootstrap.php tests
+ -cp -f .foundation-tmp/tests/phpunit.xml tests
+ -cp -f .foundation-tmp/.travis.yml .
+ -cp -n .foundation-tmp/LICENSE .
+ -cp -n .foundation-tmp/README.md .
+ -cp -n .foundation-tmp/package.xml .
+ -cp -n .foundation-tmp/composer.json .
+ echo "Removing temp files"
+ rm -Rf .foundation-tmp
+ @php bin/replace-vars.php
+ @echo "Done!"
View
0 README
No changes.
View
36 README.md
@@ -0,0 +1,36 @@
+Respect\Cli [![Build Status](https://secure.travis-ci.org/Respect/Cli.png)](http://travis-ci.org/Respect/Cli)
+================
+
+Makes your code speak CLI
+
+License Information
+===================
+
+Copyright (c) 2009-2012, Alexandre Gaigalas.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of Alexandre Gaigalas nor the names of its
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
View
158 bin/common-inc.php
@@ -0,0 +1,158 @@
+<?php
+
+if (basename(__FILE__) == basename($_SERVER['PHP_SELF'])) {
+ fwrite(STDERR, 'This file can not be called directly.' . PHP_EOL);
+ exit(1);
+}
+
+chdir(__DIR__);
+date_default_timezone_set('UTC');
+
+/**
+ * @param string $message
+ * @param resource $stream
+ * @return void
+ */
+function write($message, $stream = STDOUT)
+{
+ if ($stream === STDERR && 'xterm-color' == getenv('TERM')) {
+ $message = "\033[31m{$message}\033[0m";
+ }
+ fwrite($stream, $message);
+}
+
+/**
+ * @param string|array[optional] $message
+ * @param resource $stream
+ * @return void
+ */
+function writeln($message = '', $stream = STDOUT)
+{
+ if (is_array($message)) {
+ foreach ($message as $value) {
+ writeln($value, $stream);
+ }
+ } else {
+ write($message . PHP_EOL, $stream);
+ }
+}
+
+/**
+ * @param string $message
+ * @return void
+ */
+function writeln_error($message = '')
+{
+ writeln($message, STDERR);
+}
+
+/**
+ * @param string $question
+ * @param bool[optional] $trim
+ * @return string
+ */
+function ask($question, $trim = true)
+{
+ writeln($question);
+ write('> ');
+ $reply = fread(STDIN, 8192);
+ if (true === $trim) {
+ $reply = trim($reply);
+ }
+ return $reply;
+}
+
+/**
+ * @param string $version
+ * @param string $type
+ * @return string
+ */
+function increase_version($version, $type)
+{
+ $pieces = explode('.', $version);
+ $pieces = array_map('intval', $pieces);
+ $pieces = array_pad($pieces, 3, 0);
+
+ list($major_version, $minor_version, $patch_version) = $pieces;
+
+ if (5 === strpos($type, '_version') && isset($$type)) {
+ $$type++;
+ } else {
+ $patch_version++;
+ }
+ switch ($type) {
+ case 'major_version':
+ $minor_version = 0;
+ case 'minor_version':
+ $patch_version = 0;
+ }
+ return "{$major_version}.{$minor_version}.{$patch_version}";
+}
+
+/**
+ * @author umbrae@gmail.com
+ * @link http://www.php.net/manual/en/function.json-encode.php#80339
+ * @param mixed $data
+ * @return string
+ */
+function json_encode_formatted($data)
+{
+ if (defined('JSON_PRETTY_PRINT')) {
+ return json_encode($data, JSON_PRETTY_PRINT);
+ }
+
+ $json = json_encode($data);
+ $tab = ' ';
+ $formated = '';
+ $level = 0;
+ $in_string = false;
+ $length = strlen($json);
+
+ for ($c = 0; $c < $length; $c++) {
+ $char = $json[$c];
+ switch ($char) {
+ case '{':
+ case '[':
+ if (!$in_string) {
+ $formated .= $char . PHP_EOL . str_repeat($tab, $level + 1);
+ $level++;
+ } else {
+ $formated .= $char;
+ }
+ break;
+ case '}':
+ case ']':
+ if (!$in_string) {
+ $level--;
+ $formated .= PHP_EOL . str_repeat($tab, $level) . $char;
+ } else {
+ $formated .= $char;
+ }
+ break;
+ case ',':
+ if (!$in_string) {
+ $formated .= ',' . PHP_EOL . str_repeat($tab, $level);
+ } else {
+ $formated .= $char;
+ }
+ break;
+ case ':':
+ if (!$in_string) {
+ $formated .= ': ';
+ } else {
+ $formated .= $char;
+ }
+ break;
+ case '"':
+ if ($c > 0 && $json[$c - 1] != '\\') {
+ $in_string = !$in_string;
+ }
+ default:
+ $formated .= $char;
+ break;
+ }
+ }
+
+ return $formated;
+}
+
View
51 bin/composer-package.php
@@ -0,0 +1,51 @@
+<?php
+
+/* Common */
+require __DIR__ . '/common-inc.php';
+
+$version_type = isset($argv[1]) ? "{$argv[1]}_version" : "patch_version";
+$filename = '../composer.json';
+
+if (!file_exists($filename)) {
+ writeln_error('The file "composer.json" does not exists');
+ exit(1);
+}
+
+$parsed_json = json_decode(file_get_contents($filename), true);
+
+if (!isset($parsed_json['version'])) {
+ writeln_error('There is no defined version in the "composer.json" file');
+ exit(2);
+}
+
+$matches = array();
+$pattern = '^([0-9]+\.[0-9]+\.[0-9]+)-?(.+)?$';
+if (!preg_match("/{$pattern}/", $parsed_json['version'], $matches)) {
+ writeln_error(array(
+ sprintf('"%s" has not a valid "Respect\Foundation" version format', $parsed_json['version']),
+ sprintf('Versions must match with "%s"', $pattern)
+ ));
+ exit(3);
+}
+
+$version_number = increase_version($matches[1], $version_type);
+
+if (array_key_exists(2, $argv)) {
+ $stability = $argv[2];
+} elseif (isset($matches[2]) && $version_type == 'patch_version') {
+ $stability = $matches[2];
+} else {
+ $stability = '';
+}
+
+
+$current_version = $parsed_json['version'];
+$parsed_json['version'] = $version_number . ($stability && $stability != 'stable' ? '-' . $stability : '');
+
+$json = json_encode_formatted($parsed_json);
+file_put_contents($filename, $json, LOCK_EX);
+
+writeln(array(
+ sprintf('Updated version "%s" to "%s" in the "composer.json" file.', $current_version, $parsed_json['version']),
+ $argv[0] . ': done!'
+));
View
67 bin/pear-package.php
@@ -0,0 +1,67 @@
+<?php
+
+/* Common */
+require __DIR__ . '/common-inc.php';
+
+$version_type = isset($argv[1]) ? "{$argv[1]}_version" : "patch_version";
+$stability = isset($argv[2]) ? $argv[2] : 'stable';
+$package_xml_file = '../package.xml';
+
+if (!file_exists($package_xml_file)) {
+ writeln_error('"package.xml" does not exists');
+ exit(1);
+}
+
+$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) {
+ if (!$php_file->isFile())
+ continue;
+ $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');
+$changelog = $package_data->changelog->addChild('release');
+$current_version = (string) $package_data->version->release;
+$package_version = increase_version($current_version, $version_type);
+$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);
+
+writeln(array(
+ sprintf(
+ 'Updated version "%s" to "%s" in the "package.xml" file.',
+ $current_version,
+ $package_version
+ ),
+ $argv[0] . ': done!'
+));
View
50 bin/phar-package.php
@@ -0,0 +1,50 @@
+<?php
+
+/* Common */
+require __DIR__ . '/common-inc.php';
+
+$package_xml_file = '../package.xml';
+
+if (!file_exists($package_xml_file)) {
+ writeln_error('"package.xml" does not exists');
+ exit(1);
+}
+
+$package_data = simplexml_load_file($package_xml_file);
+$project_name = preg_replace('/[\/\\:.]/', '', $package_data->name);
+$phar_name = "{$project_name}.phar";
+
+$phar = new Phar("../{$phar_name}", 0, $phar_name);
+
+foreach ($package_data->contents->dir->file as $file) {
+ $phar->addFile(realpath("../{$file['name']}"), "{$file['baseinstalldir']}{$file['install-as']}");
+}
+
+$phar->addFromString("autoload.php", <<<'LOADER'
+<?php
+ set_include_path(__DIR__ . PATH_SEPARATOR . get_include_path());
+ spl_autoload_register(function($className)
+ {
+ $fileParts = explode('\\', ltrim($className, '\\'));
+
+ if (false !== strpos(end($fileParts), '_'))
+ array_splice($fileParts, -1, 1, explode('_', current($fileParts)));
+
+ $fileName = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php';
+
+ if (stream_resolve_include_path($fileName))
+ require $fileName;
+ });
+
+LOADER
+);
+
+$phar->setStub("<?php Phar::mapPhar('$phar_name'); include 'phar://$phar_name/autoload.php'; __HALT_COMPILER();");
+
+writeln(array(
+ sprintf(
+ 'Phar file "%s" created with success.',
+ $phar_name
+ ),
+ $argv[0] . ': done!'
+));
View
163 bin/replace-vars.php
@@ -0,0 +1,163 @@
+<?php
+
+/* Common */
+require __DIR__ . '/common-inc.php';
+
+writeln('Replacing file variables.');
+writeln();
+
+$data = array();
+$keys = array(
+ array(
+ 'key' => '{{Project Name}}',
+ 'ask' => 'Type the name of the project'
+ ),
+ array(
+ 'key' => '{{Project Version}}',
+ 'ask' => 'Type the version of the project (like 2.4.0, 1.0.0, ...)',
+ 'default' => '0.1.0',
+ 'pattern' => '[0-9]+\.[0-9]+\.[0-9]+',
+ ),
+ array(
+ 'key' => '{{Project Stability}}',
+ 'ask' => 'Type the stability of the project (like stable, alpha, beta, RC1, ...)',
+ 'default' => 'stable'
+ ),
+ array(
+ 'key' => '{{Project Description}}',
+ 'ask' => 'Type a description for the project'
+ ),
+ array(
+ 'key' => '{{Project Summary}}',
+ 'ask' => 'Type a summary for the project',
+ 'default' => function () use (&$data) {
+ if (isset($data['{{Project Description}}'])) {
+ return $data['{{Project Description}}'];
+ }
+ },
+ ),
+ array(
+ 'key' => '{{Project Homepage}}',
+ 'ask' => 'Type the project\'s homepage URL'
+ ),
+ array(
+ 'key' => '{{Project Path}}',
+ 'ask' => 'Type the path of the project. Considering library/{{Project Path}}'
+ ),
+ array(
+ 'key' => '{{Project Namespace}}',
+ 'ask' => 'Type the project namespace',
+ 'default' => function () use (&$data) {
+ if (isset($data['{{Project Path}}'])) {
+ return strtr($data['{{Project Path}}'], '/', '\\');
+ }
+ },
+ ),
+ array(
+ 'key' => '{{Project Repo}}',
+ 'ask' => 'Type the project repository URL'
+ ),
+ array(
+ 'key' => '{{Project Channel}}',
+ 'ask' => 'Type the project PEAR repository channel'
+ ),
+ array(
+ 'key' => '{{Lead Developer Name}}',
+ 'ask' => 'Type your name'
+ ),
+ array(
+ 'key' => '{{Lead Developer Email}}',
+ 'ask' => 'Type your email'
+ ),
+ array(
+ 'key' => '{{Lead Developer Username}}',
+ 'ask' => 'Type your username (of the project\'s repository)'
+ ),
+);
+
+$count = count($keys);
+for ($i=0; $i<$count; $i++) {
+ $options = $keys[$i];
+
+ /** Defaut va.ues **/
+ if (!isset($options['default'])) {
+ $default = null;
+ } elseif (is_callable($options['default'])) {
+ $default = call_user_func($options['default']);
+ } else {
+ $default = $options['default'];
+ }
+
+ /* Displays the ask */
+ $message = $options['ask'];
+ if (null !== $default) {
+ $message .= sprintf(' [ optional, default is: "%s" ]', $default);
+ } else {
+ $message .= ' [ required ]';
+ }
+ $value = ask($message);
+
+ /* Checks the user's input */
+ if (empty($value) && null === $default) {
+ $i--;
+ continue;
+ } elseif (!empty($value)
+ && isset($options['pattern'])
+ && !preg_match("/{$options['pattern']}/", $value)) {
+ writeln_error($argv[0] . ': value must match with ' . $options['pattern']);
+ writeln_error();
+ $i--;
+ continue;
+ }
+
+ $data[$options['key']] = $value ?: $default;
+}
+writeln();
+
+$files = array(
+ 'composer.json',
+ 'LICENSE',
+ 'package.xml',
+ 'README.md'
+);
+foreach ($files as $file) {
+ $filename = '../' . $file;
+ if (!file_exists($filename)) {
+ writeln_error(sprintf('"%s" does not exists', $file));
+ continue;
+ }
+ $content = file_get_contents($filename);
+ $search = array_keys($data);
+ $replace = array_values($data);
+
+ if ('composer.json' == $file) {
+ $replace = array_map(
+ function ($string, $key) {
+ if ('{{Project Stability}}' == $key
+ && 'stable' == $string) {
+ return '';
+ }
+ $string = json_encode($string);
+ $string = substr($string, 1, -1);
+ $string = str_replace('\/', '/', $string);
+ return $string;
+ },
+ $replace,
+ $search
+ );
+ } elseif ('package.xml' == $file) {
+ $replace = array_map(
+ function ($string) {
+ if (defined('ENT_XML1')) {
+ return htmlentities($string, ENT_XML1);
+ }
+ return htmlentities($string);
+ },
+ $replace
+ );
+ }
+ $content = str_replace($search, $replace, $content);
+ file_put_contents($filename, $content, LOCK_EX);
+ writeln(sprintf('"%s" updated with your data', $file));
+}
+writeln();
View
29 composer.json
@@ -0,0 +1,29 @@
+{
+ "name": "Cli",
+ "version": "0.1.1-alpha",
+ "type": "library",
+ "description": "Makes your code speak CLI",
+ "homepage": "http:\/\/respect.li",
+ "repositories": {
+ "repository": {
+ "vcs": {
+ "url": "http:\/\/github.com\/Respect\/Cli"
+ }
+ }
+ },
+ "license": "BSD Style",
+ "authors": [
+ {
+ "name": "Alexandre Gaigalas",
+ "email": "alexandre@gaigalas.net"
+ }
+ ],
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "autoload": {
+ "psr-0": {
+ "Respect\\Cli": "library"
+ }
+ }
+}
View
56 package.xml
@@ -0,0 +1,56 @@
+<?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>Cli</name>
+ <channel>http://respect.li/pear/</channel>
+ <summary>Makes your code speak CLI</summary>
+ <description>Makes your code speak CLI</description>
+ <lead>
+ <name>Alexandre Gaigalas</name>
+ <user>alganet</user>
+ <email>alexandre@gaigalas.net</email>
+ <active>yes</active>
+ </lead>
+ <date>2012-02-14</date>
+ <time>19:42:53</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>-</notes>
+ <contents>
+ <dir name="library/Respect/Cli" baseinstalldir="Respect/Cli"/>
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>5.3</min>
+ </php>
+ <pearinstaller>
+ <min>1.4.0</min>
+ </pearinstaller>
+ <package>
+ <name>Config</name>
+ <channel>respect.li/pear</channel>
+ </package>
+ </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>
+ <license uri="http://www.opensource.org/licenses/bsd-license.php">BSD Style</license>
+ </release>
+ </changelog>
+</package>
View
28 tests/bootstrap.php
@@ -0,0 +1,28 @@
+<?php
+
+date_default_timezone_set('UTC');
+
+$pear_path = trim(`pear config-get php_dir`);
+set_include_path('../library'
+ . PATH_SEPARATOR . $pear_path
+ . PATH_SEPARATOR . get_include_path());
+
+/**
+ * Autoloader that implements the PSR-0 spec for interoperability between
+ * PHP software.
+ */
+spl_autoload_register(
+ function($className) {
+ $fileParts = explode('\\', ltrim($className, '\\'));
+
+ if (false !== strpos(end($fileParts), '_'))
+ array_splice($fileParts, -1, 1, explode('_', current($fileParts)));
+
+ $file = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php';
+
+ foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) {
+ if (file_exists($path = $path . DIRECTORY_SEPARATOR . $file))
+ return require $path;
+ }
+ }
+);
View
18 tests/phpunit.xml
@@ -0,0 +1,18 @@
+<phpunit backupGlobals="false"
+ backupStaticAttributes="false"
+ bootstrap="bootstrap.php"
+ cacheTokens="true"
+ colors="true"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ processIsolation="false"
+ stopOnFailure="false"
+ syntaxCheck="false"
+ verbose="false">
+ <filter>
+ <whitelist>
+ <directory>../library/</directory>
+ </whitelist>
+ </filter>
+</phpunit>

0 comments on commit f8e6b65

Please sign in to comment.