Skip to content
Browse files

Changed license to LGPL 2.1;

Tweaked the PHAR;
Added composer.json;
Added docs;
Regenerated package.xml.
  • Loading branch information...
1 parent a045a37 commit 97e38d21ffd5ed32b65eae2936f5223d2c43d52c @boenrobot boenrobot committed
View
1 API-0.1.0
@@ -1 +0,0 @@
-Package Console_Color API release notes for version 0.1.0.
View
1 API-0.2.0
@@ -1 +0,0 @@
-Almost a complete rewrite.
View
2 CREDITS
@@ -1,3 +1,3 @@
-;Maintainer of PEAR2_Command_Color
+;Maintainers of PEAR2_Command_Color
Ivo Nascimento [ivonascimento] <ivo@o8o.com.br> (lead)
Vasil Rangelov [boen_robot] <boen.robot@gmail.com> (lead)
View
2 RELEASE-0.2.0
@@ -1,2 +0,0 @@
-* A brand new API.
-* CS fixes.
View
3 RELEASE-1.0.0
@@ -0,0 +1,3 @@
+First stable release.
+
+(complete rewrite from the alpha)
View
32 composer.json
@@ -0,0 +1,32 @@
+{
+ "name": "pear2/console_color",
+ "description": "Genetaror for ANSI color escape sequences.",
+ "keywords": ["pear2", "console", "color", "CLI", "ANSI", "generator"],
+ "homepage": "http://pear2.github.com/Console_Color/",
+ "license": "LGPL-2.1",
+ "authors": [
+ {
+ "name": "Vasil Rangelov",
+ "email": "boen.robot@gmail.com",
+ "role": "lead"
+ },
+ {
+ "name": "Ivo Nascimento",
+ "email": "ivo@o8o.com.br",
+ "role": "lead"
+ }
+ ],
+ "support": {
+ "issues": "http://github.com/pear2/Console_Color/issues",
+ "wiki": "http://github.com/pear2/Console_Color/wiki"
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "autoload": {
+ "psr-0": {
+ "PEAR2\\Console\\Color\\": "src/"
+ }
+ },
+ "minimum-stability": "dev"
+}
View
14 docs/apigen.neon
@@ -0,0 +1,14 @@
+source: ../src
+
+destination: PEAR2_Console_Color__ApiGen_Documentation
+
+extensions: php
+
+charset: UTF-8
+
+title: PEAR2_Console_Color documentation
+
+autocomplete:
+ - classes
+ - methods
+ - classconstants
View
1,789 docs/doxygen.ini
1,789 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
18 docs/phpdoc.dist.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpdoc>
+ <title>PEAR2_Console_Color documentation</title>
+ <parser>
+ <default-package-name>PEAR2_Console_Color</default-package-name>
+ <target>PEAR2_Console_Color__PhpDocumentor_Cache</target>
+ <extensions>
+ <extension>php</extension>
+ </extensions>
+ </parser>
+ <files>
+ <directory>../src/PEAR2/Console/Color/</directory>
+ <file>../src/PEAR2/Console/Color.php</file>
+ </files>
+ <transformer>
+ <target>PEAR2_Console_Color__PhpDocumentor_Documentation</target>
+ </transformer>
+</phpdoc>
View
2 extrasetup.php
@@ -8,7 +8,7 @@
* @category Console
* @package PEAR2_Console_Color
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version GIT: $Id$
* @link http://pear2.php.net/PEAR2_Console_Color
*/
View
25 package.xml
@@ -19,23 +19,27 @@ and it will automatically be converted to an escape sequence when used as a stri
<email>boen.robot@gmail.com</email>
<active>yes</active>
</lead>
- <date>2013-10-08</date>
- <time>17:00:17</time>
+ <date>2014-03-02</date>
+ <time>15:18:34</time>
<version>
- <release>0.2.0</release>
+ <release>1.0.0</release>
<api>0.2.0</api>
</version>
<stability>
- <release>alpha</release>
- <api>alpha</api>
+ <release>stable</release>
+ <api>stable</api>
</stability>
<license uri="http://www.opensource.org/licenses/bsd-license.php">New BSD License</license>
- <notes>* A brand new API.
-* CS fixes.
-
-Almost a complete rewrite.</notes>
+ <notes>First stable release.&#13;
+&#13;
+(complete rewrite from the alpha)</notes>
<contents>
<dir name="/">
+ <dir name="docs" baseinstalldir="/">
+ <file role="doc" name="apigen.neon"/>
+ <file role="doc" name="doxygen.ini"/>
+ <file role="doc" name="phpdoc.dist.xml"/>
+ </dir>
<dir name="src" baseinstalldir="/">
<dir name="PEAR2">
<dir name="Console">
@@ -95,6 +99,9 @@ Almost a complete rewrite.</notes>
</dependencies>
<phprelease>
<filelist>
+ <install name="docs/apigen.neon" as="apigen.neon"/>
+ <install name="docs/doxygen.ini" as="doxygen.ini"/>
+ <install name="docs/phpdoc.dist.xml" as="phpdoc.dist.xml"/>
<install name="src/PEAR2/Console/Color.php" as="PEAR2/Console/Color.php"/>
<install name="src/PEAR2/Console/Color/Backgrounds.php" as="PEAR2/Console/Color/Backgrounds.php"/>
<install name="src/PEAR2/Console/Color/Exception.php" as="PEAR2/Console/Color/Exception.php"/>
View
2 packagexmlsetup.php
@@ -8,7 +8,7 @@
* @category Console
* @package PEAR2_Console_Color
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version GIT: $Id$
* @link http://pear2.php.net/PEAR2_Console_Color
*/
View
18 src/PEAR2/Console/Color.php
@@ -7,9 +7,9 @@
*
* @category Console
* @package Console_Color
- * @author Ivo Nascimento <ivo@o8o.com.br>
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @author Ivo Nascimento <ivo@o8o.com.br>
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version GIT: $Id$
* @link http://pear.php.net/package/Console_Color
*/
@@ -29,20 +29,20 @@
* @package Console_Color
* @author Ivo Nascimento <ivo@o8o.com.br>
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear2.php.net/PEAR2_Console_Color
*/
class Color
{
/**
- * @var array List of valid font colors. Filled by
- * {@link fillValidators()}.
+ * @var array List of valid font colors.
+ * Filled by {@link fillValidators()}.
*/
protected static $validFonts = array();
/**
- * @var array List of valid background colors. Filled by
- * {@link fillValidators()}.
+ * @var array List of valid background colors.
+ * Filled by {@link fillValidators()}.
*/
protected static $validBackgorunds = array();
@@ -62,12 +62,12 @@ class Color
protected $flags = 0;
/**
- * @var int|null
+ * @var int|null The code for the currently specified font color.
*/
protected $font = null;
/**
- * @var int|null
+ * @var int|null The code for the currently specified background color.
*/
protected $backgorund = null;
View
5 src/PEAR2/Console/Color/Backgrounds.php
@@ -8,8 +8,7 @@
* @category Console
* @package PEAR2_Console_Color
* @author Ivo Nascimento <ivo@o8o.com.br>
- * @copyright 2011 Ivo Nascimento
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version GIT: $Id$
* @link http://pear2.php.net/PEAR2_Console_Color
*/
@@ -22,7 +21,7 @@
* @package PEAR2_Console_Color
* @author Ivo Nascimento <ivo@o8o.com.br>
* @copyright 2011 Ivo Nascimento
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear2.php.net/PEAR2_Console_Color
*/
abstract class Backgrounds
View
4 src/PEAR2/Console/Color/Exception.php
@@ -8,7 +8,7 @@
* @category Console
* @package PEAR2_Console_Color
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version GIT: $Id$
* @link http://pear2.php.net/PEAR2_Console_Color
*/
@@ -20,7 +20,7 @@
* @category Console
* @package PEAR2_Console_Color
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear2.php.net/PEAR2_Console_Color
*/
interface Exception
View
4 src/PEAR2/Console/Color/Flags.php
@@ -9,7 +9,7 @@
* @category Console
* @package PEAR2_Console_Color
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version GIT: $Id$
* @link http://pear2.php.net/PEAR2_Console_Color
*/
@@ -23,7 +23,7 @@
* @category Console
* @package PEAR2_Console_Color
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear2.php.net/PEAR2_Console_Color
*/
abstract class Flags
View
5 src/PEAR2/Console/Color/Fonts.php
@@ -8,8 +8,7 @@
* @category Console
* @package PEAR2_Console_Color
* @author Ivo Nascimento <ivo@o8o.com.br>
- * @copyright 2011 Ivo Nascimento
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version GIT: $Id$
* @link http://pear2.php.net/PEAR2_Console_Color
*/
@@ -22,7 +21,7 @@
* @package PEAR2_Console_Color
* @author Ivo Nascimento <ivo@o8o.com.br>
* @copyright 2011 Ivo Nascimento
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear2.php.net/PEAR2_Console_Color
*/
abstract class Fonts
View
4 src/PEAR2/Console/Color/Styles.php
@@ -8,7 +8,7 @@
* @category Console
* @package PEAR2_Console_Color
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version GIT: $Id$
* @link http://pear2.php.net/PEAR2_Console_Color
*/
@@ -22,7 +22,7 @@
* @category Console
* @package PEAR2_Console_Color
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear2.php.net/PEAR2_Console_Color
*/
abstract class Styles
View
4 src/PEAR2/Console/Color/UnexpectedValueException.php
@@ -8,7 +8,7 @@
* @category Console
* @package PEAR2_Console_Color
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version GIT: $Id$
* @link http://pear2.php.net/PEAR2_Console_Color
*/
@@ -23,7 +23,7 @@
* @package PEAR2_Console_Color
* @author Vasil Rangelov <boen.robot@gmail.com>
* @copyright 2011 Ivo Nascimento
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear2.php.net/PEAR2_Console_Color
*/
class UnexpectedValueException extends U implements Exception
View
79 stub.php
@@ -8,32 +8,19 @@
* @category Console
* @package PEAR2_Console_Color
* @author Vasil Rangelov <boen.robot@gmail.com>
- * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @version GIT: $Id$
* @link http://pear2.php.net/PEAR2_Console_Color
*/
-$isIncluded = count(get_included_files()) > 1;
-if ($isIncluded) {
+if (count(get_included_files()) > 1) {
Phar::mapPhar();
- $pkgDir = 'phar://' . __FILE__ . DIRECTORY_SEPARATOR .
- '@PACKAGE_NAME@-@PACKAGE_VERSION@' . DIRECTORY_SEPARATOR;
-
- //Set up autoloader
- if (class_exists('PEAR2\Autoload', true)) {
- //Called in this fashion to avoid parse errors on PHP =< 5.3.0
- call_user_func(
- array('PEAR2\Autoload', 'initialize'),
- $pkgDir . DIRECTORY_SEPARATOR . 'src'
- );
- } else {
- include_once $pkgDir . DIRECTORY_SEPARATOR
- . 'src' . DIRECTORY_SEPARATOR
- . 'PEAR2' . DIRECTORY_SEPARATOR
- . 'Autoload.php';
- }
- unset($pkgDir, $isIncluded);
+ include_once 'phar://' . __FILE__ . DIRECTORY_SEPARATOR
+ . '@PACKAGE_NAME@-@PACKAGE_VERSION@' . DIRECTORY_SEPARATOR
+ . 'src' . DIRECTORY_SEPARATOR
+ . 'PEAR2' . DIRECTORY_SEPARATOR
+ . 'Autoload.php';
return;
}
@@ -44,7 +31,7 @@
echo "@PACKAGE_NAME@ @PACKAGE_VERSION@\n";
if (version_compare(phpversion(), '5.3.0', '<')) {
- echo "\nThis package requires PHP 5.3.0 or later.";
+ echo "\nERROR: This package requires PHP 5.3.0 or later.\n";
exit(1);
}
@@ -55,47 +42,57 @@
}
}
if ($missing_extensions) {
- echo "\nYou must compile PHP with the following extensions enabled:\n",
+ echo "\nERROR: You must compile PHP with the following extensions enabled:\n",
implode(', ', $missing_extensions), "\n",
"or install the necessary extensions for your distribution.\n";
exit(2);
}
-if (extension_loaded('phar')) {
+$supportsPhar = extension_loaded('phar');
+if ($supportsPhar) {
try {
$phar = new Phar(__FILE__);
$sig = $phar->getSignature();
echo "{$sig['hash_type']} hash: {$sig['hash']}\n";
} catch (Exception $e) {
echo <<<HEREDOC
+
The PHAR extension is available, but was unable to read this PHAR file's hash.
-Regardless, you should not be having any trouble using the package by directly
-including this file. In the unlikely case that you can't include it
-successfully, you can instead extract one of the other archives, and include
-its autoloader.
-
-Exception details:
-HEREDOC
- . $e . "\n";
+
+HEREDOC;
+ if (false !== strpos($e->getMessage(), 'file extension')) {
+ echo <<<HEREDOC
+This can happen if you've renamed the file to ".php" instead of ".phar".
+Regardless, you should be able to include this file without problems.
+
+HEREDOC;
+ }
}
} else {
echo <<<HEREDOC
-If you wish to use this package directly from this archive, you need to install
-and enable the PHAR extension. Otherwise, you must instead extract this
-archive, and include the autoloader.
+
+WARNING: If you wish to use this package directly from this archive, you need
+ to install and enable the PHAR extension. Otherwise, you must instead
+ extract this archive, and include the autoloader.
HEREDOC;
}
-if (!$isNotCli) {
+echo "\n" . str_repeat('=', 80) . "\n";
+if ($isNotCli) {
echo <<<HEREDOC
+This package is not useful under this SAPI.
+Rerun this file from the command line to see if you can use it there.
-\033[30;42mIf you are reading this on a green background (and black text), then
-this terminal supports color escape sequences, i.e. this package would actually
-be useful in this environment.\033[0m
+HEREDOC;
+} else {
+ echo <<<HEREDOC
+\033[30;42m If you are reading this on a green background (and black text), then \033[0m
+\033[30;42m this terminal supports color escape sequences, i.e. this package would \033[0m
+\033[30;42m actually be useful in this environment. \033[0m
-\033[32;44mIn case your default background color is green, here's also a test
-with a blue background (and green text).\033[0m
+\033[32;44m In case your default background color is green, here's also a test \033[0m
+\033[32;44m with a blue background (and green text). \033[0m
If above you see something like "[30;42m", then this terminal does not support
color escape sequences.
@@ -103,8 +100,8 @@
HEREDOC;
if (substr(PHP_OS, 0, 3) === 'WIN') {
+ echo "\n" . str_repeat('=', 80) . "\n";
echo <<<HEREDOC
-
To add support for color escape sequences to Windows' command prompt,
install ANSICON.
See http://adoxa.hostmyway.net/ansicon/ or https://github.com/adoxa/ansicon.

0 comments on commit 97e38d2

Please sign in to comment.
Something went wrong with that request. Please try again.