Afficher un message
Vieux 16/09/2007, 18h07   #3
Terry Poulin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Run script against every file in a directory

Mohit Sindhwani wrote:
> Chris Gallagher wrote:
>> Hi,
>>
>> I'm currently tryin to implement a ruby script which will run through a
>> directory of javascript files and run jsmin.rb against each of them as a
>> part of my build script. im running into a number of silly issues so im
>> just wondering if theres anyone out there thats done this kind of thing?
>>
>> Cheers,
>>
>> Chris
>>


Well in a Unix Shell this would probably do it, as would a for loop with a bit
of change:

find /directory -name "*.js" -type f -exec jsmin.rb {} \;


In Ruby, I would suggest using ether the Find class or the Filescan gem. You
can use it to recurse through the directory and then have the ruby script
execute jsmin.rb with the file name as an argument.

TerryP.


--

Email and shopping with the feelgood factor!
55% of income to good causes. http://www.ippimail.com


  Réponse avec citation
 
Page generated in 0,05459 seconds with 9 queries