<commit_before><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */

  $package= 'xp.scriptlet';

  uses(
    'xp.scriptlet.WebApplication',
    'xp.scriptlet.WebConfiguration',
    'util.Properties'
  );

  /**
   * Inspect scriptlet coniguration
   *
   */
  class xpscriptletInspect extends Object {

    /**
     * Entry point method
     *
     * @param   string[] args
     */
    public static function main(array $args) {
      $docroot= realpath($args[3] ?: getcwd().'/static');
      $webroot= dirname($docroot);
      Console::writeLine('xpws-', $args[0], ' @ ', $args[1], ':', $args[2], ', ', $docroot, ' {');

      // Dump configured applications
      $conf= new xpscriptletWebConfiguration(new Properties($webroot.'/etc/web.ini'));
      foreach ($conf->mappedApplications($args[0]) as $url => $app) {
        Console::writeLine('  Route<', $url, '*> => ', str_replace("\n", "\n  ", $app->toString()));
      }

      Console::writeLine('}');
    }
  }
?>
<commit_msg>- Make this easily invokable via "xp xp.scriptlet.Inspect /path/to/doc_root"<commit_after><?php
/* This class is part of the XP framework
 *
 * $Id$ 
 */

  $package= 'xp.scriptlet';

  uses(
    'xp.scriptlet.WebApplication',
    'xp.scriptlet.WebConfiguration',
    'util.Properties'
  );

  /**
   * Inspect scriptlet coniguration
   *
   */
  class xpscriptletInspect extends Object {

    /**
     * Entry point method. Gets passed the following arguments from "xpws -i":
     * <ul>
     *   <li>#0: The document root - defaults to $CWD/static</li>
     *   <li>#1: The server profile - default to "dev"</li>
     *   <li>#2: The server address - default to "localhost:8080"</li>
     * </ul>
     *
     * @param   string[] args
     */
    public static function main(array $args) {
      $docroot= realpath(isset($args[0]) ? $args[0] : getcwd().'/static');
      $webroot= dirname($docroot);
      $profile= isset($args[1]) ? $args[1] : 'dev';
      $address= isset($args[2]) ? $args[2] : 'localhost:8080';
      Console::writeLine('xpws-', $profile, ' @ ', $address, ', ', $docroot, ' {');

      // Dump configured applications
      $conf= new xpscriptletWebConfiguration(new Properties($webroot.'/etc/web.ini'));
      foreach ($conf->mappedApplications($profile) as $url => $app) {
        Console::writeLine('  Route<', $url, '*> => ', str_replace("\n", "\n  ", $app->toString()));
      }

      Console::writeLine('}');
    }
  }
?>

{'fraction_non_alphanumeric': 0.19059304703476482, 'fraction_numerical': 0.00899795501022495, 'mean_word_length': 2.839874411302983, 'pattern_counts': {'":': 1, '<': 15, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6606530', 'n_tokens_mistral': 837, 'n_tokens_neox': 810, 'n_words': 173}