Re: dependency check
| From: | Nilesh Govindarajan | Date: | Fri, 22 Jul 2011 13:33:54 +0000 |
| Subject: | Re: dependency check | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-314156@lists.php.net to get a copy of this message | ||
On 07/22/2011 06:56 PM, Alex Nikitin wrote:
>
>
> Or you could just grep the directory, not saying you have to do this,
> but this was kind of fun to write anyways, if i spent more time on it, i
> could perfect it, but i dont have that kind of time, so this will still
> give you a few doubles, but it shouldn't give you false-positives as
> long as you have all the extensions in that grep regex (and you cant
> make it more generic without introducing false-positives)...
>
> grep -oiPR "[a-zA-Z0-9]+\.(php|js|png|
> jpg|css|htm|html)" directory | awk 'function getfiles(input, files, i,
> n, file) {result = ""; n=split(input, files, ":"); for(i=0; i<=n; i++) {
> if(files[i] !~ /^\s*$/) print files[i];}} {getfiles($0)}' | sort -biu
>
> This should give you all the files that reference files and the files
> they reference.
>
> --
> The trouble with programmers is that you can never tell what a
> programmer is doing until it’s too late. ~Seymour Cray
>
It is possible to use the shell tools, but it is a big trouble to handle
spaces and special characters in shell scripting if your filenames have
them, quite rare with self created applications, but you can't say, and
hence I suggested python/php script method.
--
Regards,
Nilesh Govindarajan
@nileshgr on twitter/identica