For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > January 2008 > Re: [PEAR] Questions about PEAR/PackageFileManager2.php









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] Questions about PEAR/PackageFileManager2.php
Dmitri

2008-01-03, 7:04 pm

I figured out how to do add replacements to only files in 'classes'
directory and also how to install the 'classes' directory without using
the actual directory.

Like this in the makexml.php

foreach (glob("classes/*.php") as $file)
{
$pfm->addReplacement($file, 'package-info',
'@package_version@', 'version');
$pfm->addInstallAs($file, '/'.basename($file));
}

This worked for me.


Dmitri wrote:

> Hello!
>
> I am creating my first package that should be installable with pear
> installer
>
> I am using PEAR/PackageFileManager2.php
>
> I want to add the replacement task
> <tasks:replace from="@package_version@" to="version"
> type="package-info" />
>
> but only to php files
>
> I added this line to my createxml.php file which uses
> PackageFileManager2.php:
>
> $pfm->addGlobalReplacement('package-info', '@package_version@',
> 'version');
>
> but now it added the replace task to all files, even to html files.
>
> How can I limit adding this task to php files only?
>
>
> Question2: I my project directory structure I have directory /classes/
> where all the classes are located.
> In the actual package I don't want to have this extra directory and
> want all classes to be installed in the package root directory
> So, it my package name is SHAREDLOG, then I think the package will be
> installed (at least on my server) in /usr/local/php/lib/php/SHAREDLOG/
>
> How can I make it so that all the files from /classes/ dir be moved to
> root dir? I know I can use install as, but this will require to
> manually add this 'install as' to every file in classes dir.
> I have many classes there. Is there a way to use install as for a
> whole directory?
>
> Thank you.
>



--

Open Source ALL content management
with streaming video
http://wiki.sharedlog.com
David Jean Louis

2008-01-03, 7:04 pm


> I figured out how to do add replacements to only files in 'classes'
> directory and also how to install the 'classes' directory without
> using the actual directory.
>
> Like this in the makexml.php
>
> foreach (glob("classes/*.php") as $file)
> {
> $pfm->addReplacement($file, 'package-info',
> '@package_version@', 'version');
> $pfm->addInstallAs($file, '/'.basename($file));
> }


Indeed, it would be handy to add the glob() thing to
PackageFileManager::addReplacement().

I have filled a feature request (with a patch) here:
http://pear.php.net/bugs/bug.php?id=12820


David <izi@php.net>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com