CPAN-Search-Lite

 view release on metacpan or  search on metacpan

build/gen_conf.pl  view on Meta::CPAN

  }
  else {
    warn "Will not insert configuration for pod sources\n";
  }
  $html_root = prompt('Path to store html files?',
                      catdir($httpd, 'htdocs', 'CPAN'));
  if ($html_root = check_dir($html_root)) {
    $cfg->newval('CPAN', 'html_root', $html_root);
  }
  else {
    warn "Will not insert configuration for html files\n";
  }
}
else {
  $cfg->newval('CPAN', 'no_mirror', 1);
  my $CPAN = prompt('Location to store CPAN index files?',
                    catdir($home, '.cpan', 'build'));
  if ($CPAN = check_dir($CPAN)) {
    $cfg->newval('CPAN', 'CPAN', $CPAN);
  }
  else {
    die "Must have a valid location to store index files";
  }
  my $remote_mirror = prompt('CPAN mirror to fetch index files?',
                            'http://www.cpan.org');
  $cfg->newval('CPAN', 'remote_mirror', $remote_mirror);
}

unless (prompt_y('Gather Win32 ppm package information?')) {
  $cfg->newval('CPAN', 'no_ppm', 1);
}

if (prompt_y('Guess unassigned module categories?')) {
  my $cat_threshold = prompt('Threshold value for guesses?', 0.998);
  $cfg->newval('CPAN', 'cat_threshold', $cat_threshold);
}
else {
  $cfg->newval('CPAN', 'no_cat', 1);
}
$cfg->newval('CPAN', 'DEBUG', 1);

my $multiplex;
if (prompt_y('Use a multiplexer for mirror redirects?')) {
  $multiplex = prompt('Address of multiplexer',
                         'http://www.perl.com/CPAN');
  $cfg->newval('CPAN', 'multiplex', $multiplex);
}

print <<'END';

For the database, as well as needing the name, we will
also require the user and password who has permission to
create/query/alter/drop tables. It is assumed the database 
has already been created, and that this user has already 
been set up with the proper privileges.

END

my $db = prompt('Name of database?', 'pause');
$cfg->newval('DB', 'db', $db);
my $user = WIN32 ? $ENV{USERNAME} : getpwuid($>);
$user = prompt('User to create/query/alter/drop tables?', $user);
$cfg->newval('DB', 'user', $user);
my $passwd = prompt("Password for '$user'?", 'q1w2e3r4');
$cfg->newval('DB', 'passwd', $passwd);
my $host = hostname;

my %config;
my ($tt2, $static);
my $web = prompt_y('Set up configuration for a web server?');
if ($web) {
  print <<'END';

We now gather some information for configuring the
web server.

END
  $config{db_sub} = $cfg->val('DB', 'db');
  $config{nobody_sub} = prompt('User to query tables?', 'nobody');
  $config{no_pass_sub} = prompt("Password for '$config{nobody_sub}'?", 
                                'p0o9i8u7');

  $tt2 = prompt('Location of installed tt2 templates?',
                   catdir($httpd, 'tt2'));
  if ($tt2 = check_dir($tt2)) {
    $cfg->newval('WWW', 'tt2', $tt2);
    $config{tt2_sub} = $tt2;
  }
  else {
    die "Need a valid directory for tt2 pages\n";
  }
  my $geoip = prompt('Location of list of CPAN mirrors?',
                     catfile($tt2, 'cpan.txt'));
  if ($geoip = check_dir(dirname($geoip))) {
    $cfg->newval('WWW', 'geoip', $geoip);
  }
  else {
    warn "Will not insert configuration for CPAN mirrors list\n";
  }
  unless ($html_root) {
    $html_root = prompt('Path to store html files?',
                        catdir($httpd, 'htdocs', 'CPAN'));
    unless (check_dir($html_root)) {
      die "Need a valid directory for html files\n";
    }
  }
  $config{store_sub} = $html_root;
  $static = catdir $html_root, 'faqs';
  $static = prompt('Path to store static pages?', 
                   $static);
  unless (check_dir($static)) {
    die "Need a valid directory to store static html files\n";
  }
  $config{static_store_sub} = $static;

  my $css = prompt("Name of css file? (relative to $html_root)",
                   'cpan.css');
  $cfg->newval('WWW', 'css', $css);
  my $up = prompt("image to indicate 'up' (relative to $html_root)?",
                  'up.png');
  $cfg->newval('WWW', 'up_img', $up);



( run in 1.334 second using v1.01-cache-2.11-cpan-56fb94df46f )