|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
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 -- Posted via http://www.ruby-forum.com/. |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
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 > What kind of silly errors? What is not working? Cheers, Mohit. 9/16/2007 | 11:51 PM. |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
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 you would add the code from jsmin.rb (that performs god knows what purpose) and have that code run against the files...for crawling a filesystem you would go about it like this: #!/usr/bin/ruby require 'find' res = [] $stdin.each_line do |file_path| res << File.size(file_path.strip) #File.size is only an example.. end #I dont know what jsmin.rb contains #so i cant say what to put there. ######### usage of this would be as follows find /etc/ -type f | ./program.rb # where /etc/ would be the directory that the # java files are in. -- Posted via http://www.ruby-forum.com/. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
2007/9/16, Chris Gallagher <cgallagher@gmail.com>:
> 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? How about this: Dir["**/*.js"].each { |js| system("ruby jsmin.rb #{js}") } -- http://pcdavid.net/ |
|
![]() |
| Outils de la discussion | |
|
|