app.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php namespace CCConsole; use CCCli;
  2. /**
  3. * App console
  4. * stuff to maintain your application
  5. **
  6. *
  7. * @package ClanCatsFramework
  8. * @author Mario Döring <[email protected]>
  9. * @version 2.0
  10. * @copyright 2010 - 2014 ClanCats GmbH
  11. *
  12. */
  13. class app extends \CCConsoleController {
  14. /**
  15. * return an array with information about the script
  16. */
  17. public function help()
  18. {
  19. return array(
  20. 'name' => 'App',
  21. 'desc' => 'stuff to maintain your application',
  22. 'actions' => array(
  23. 'info' => 'show information about this application.',
  24. ),
  25. );
  26. }
  27. /**
  28. * print information about this application
  29. *
  30. * @param array $params
  31. */
  32. public function action_info( $params )
  33. {
  34. $app = \ClanCats::runtime();
  35. // print the app name
  36. $this->line( \CCForge_Php::make( 'comment',
  37. $app::$name.PHP_EOL.
  38. "*".PHP_EOL.
  39. "Running on ClanCatsFramework ".\ClanCats::VERSION.PHP_EOL.
  40. "© 2010 - ".date('Y')." ClanCats GmbH".PHP_EOL
  41. ), 'cyan' );
  42. // list printer
  43. $list = function( $array )
  44. {
  45. foreach( $array as $key => $value )
  46. {
  47. $this->line( $key.': '.CCCli::color( $value, 'green' ) );
  48. }
  49. };
  50. // print info
  51. $list( array(
  52. 'Runtime Class' => $app,
  53. 'CCF Version' => \ClanCats::version(),
  54. 'CCF Environment' => \ClanCats::environment(),
  55. 'Development env' => var_export( \ClanCats::in_development(), true ),
  56. 'File extention' => EXT,
  57. 'Core namespace' => CCCORE_NAMESPACE,
  58. ));
  59. // paths
  60. $this->line( PHP_EOL."Paths", 'cyan' );
  61. $list( \ClanCats::paths() );
  62. // paths
  63. $this->line( PHP_EOL."Directories", 'cyan' );
  64. $list( \ClanCats::directories() );
  65. // autoloader
  66. $this->line( PHP_EOL."Autoloader - namespaces", 'cyan' );
  67. $list( \CCFinder::$namespaces );
  68. }
  69. }