[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pear-dev
Subject:    [PEAR-DEV] PEAR 2.0 question
From:       66.65.38.153
Date:       2004-09-25 3:32:03
Message-ID: 20040925033205.75138.qmail () pb1 ! pair ! com
[Download RAW message or body]

Hi,

One of the questions I have about PEAR 2.0 has to do with file roles.  I 
don't have any answers, but I wonder if there are ideas on these issues.

Basically, the biggest difference between PEAR and other systems out 
there is that when you install a package by downloading and unzipping, 
all the files are in 1 place.  With PEAR, they're scattered into 
different directories based on file role.

I wonder if there is a way to make it easier to find these files, 
especially on shared hosts.  In other words, it's easy to find DB.php, 
you just "require_once 'DB.php';", but finding the tests is harder.  you 
first have to

$ pear config-show tests_dir

and then look there - assuming that tests_dir wasn't changed between $ 
pear install DB and now.

The only other way to do this is to use replacements, so the installer 
configures this information at install-time.

I wonder if there are ideas on how to make it easier to find all parts 
of a package that don't add too much WTF factor?

One thought would be a per-package solution that doesn't require any 
changes to the installer at all, a configuration "snapshot" file that 
would be installed in a fixed place, and simply be created at package-time:

<file role="php" name="channelname_PackageName_config.php">
  <replace from="@DATA-DIR@" to="data_dir" type="pear-config"/>
  <replace from="@TESTS-DIR@" to="tests_dir" type="pear-config"/>
  <replace from="@DOC-DIR@" to="doc_dir" type="pear-config"/>
  <replace from="@PACKAGE-NAME@" to="name" type="package-info"/>
</file>
PackageName_config.php:
<?php
if ('@DATA-DIR@' == '@' . 'DATA-DIR@') {
     // locations for non-PEAR install
     $data_dir = dirname(__FILE__) . '/data';
     $tests_dir = dirname(__FILE__) . '/tests';
     $doc_dir = dirname(__FILE__) . '/docs';
} else {
     // locations for PEAR install - if you see bunches of @,
     // use the locations above
     $data_dir = '@DATA-DIR@/@PACKAGE-NAME@/data';
     $tests_dir = '@TESTS-DIR@/@PACKAGE-NAME@/tests';
     $doc_dir = '@DOC-DIR@/@PACKAGE-NAME@/docs';
}
?>

Or, we could recommend that people include this config file directly. 
This would allow packages that use replacements for path purposes to 
function without the installer too - a nice side effect.

Basically, the thinking here is that although the data_dir can be found 
using config-get, it can also be changed, and once it is changed, the 
only other way to find data files is to list the files that were 
installed.  With the config.php file idea, there is a record stamped in 
stone and easily found, too, since it can be parsed by humans as well as 
programs.

The channelname_PackageName_config files would have to be installed in 
the baseinstalldir for this idea to work with non-PEAR installs.

Greg

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic