Hi,
the Ruby built-in Find module lacks a lot of features the
GNU find tools has. I wrote a new one (~170 lines).
http://www.bertram-scharpf.de/tmp/find.rb
Maybe somebody likes it.
Bertram
Hi,
the Ruby built-in Find module lacks a lot of features the
GNU find tools has. I wrote a new one (~170 lines).
http://www.bertram-scharpf.de/tmp/find.rb
Maybe somebody likes it.
Bertram
On Oct 7, 6:41 am, Bertram S. [email protected] wrote:
Hi,
the Ruby built-in Find module lacks a lot of features the
GNU find tools has. I wrote a new one (~170 lines).http://www.bertram-scharpf.de/tmp/find.rb
Maybe somebody likes it.
I wrote file-find not long ago:
http://raa.ruby-lang.org/project/file-find/
Regards,
Dan
On Sun, 7 Oct 2007, Daniel B. wrote:
Maybe somebody likes it.
I wrote file-find not long ago:
Time to merge stuff into Ruby proper if so many (…) people see the
need
to improve the aparently meager features of the built-in find?
*t
–
Tomas P.'s Mailing L. wrote:
–
Tomas P.
http://sourcepole.com - Linux & Open Source Solutions
As long as it doesn’t get more bigger and fatter then GNU Find is…
Then I’d be happy
Both seem complementary. Bertram has sorting built-in and is not
backwards compatible.
After a quick look, Bertram’s code also has silly inefficient things
like:
dir = (Dir.open @fullpath do |d| d.entries end) - SPECIAL_DIRS
which can just be:
dir = Dir.entries(@fullpath) - SPECIAL_DIRS
and the Etc module may be checked several times depending on what you
request.
Daniel’s has searching based on different much more rich criteria and
also breaks backwards compatibility. It lacks sorting and the docs
lack simple examples. I did not check the code yet.
On Oct 7, 3:17 pm, Tomas P.'s Mailing L. [email protected]
wrote:
Maybe somebody likes it.
I wrote file-find not long ago:
Time to merge stuff into Ruby proper if so many (…) people see the need
to improve the aparently meager features of the built-in find?
*t
My experience on ruby-core tells me that the odds of getting the
radical changes we would want into the stdlib are about nil unless
there’s a general outcry.
Regards,
Dan
Hi,
Am Montag, 08. Okt 2007, 20:35:04 +0900 schrieb gga:
dir = Dir.entries(@fullpath) - SPECIAL_DIRS
Argh!
and the Etc module may be checked several times depending on what you
request.
I already corrected this yesterday and upload it now.
Bertram
On Oct 7, 2007, at 6:41 AM, Bertram S. wrote:
Hi,
the Ruby built-in Find module lacks a lot of features the
GNU find tools has. I wrote a new one (~170 lines).http://www.bertram-scharpf.de/tmp/find.rb
Maybe somebody likes it.
this is one of the very smallest directories i am working with:
[cfadmin@yacht cfadmin]$ find /mnt/yacht0/data/night_files/|wc -l
69287
[cfadmin@yacht cfadmin]$ ruby a.rb
user system total real
bertram.scharpf.find 2.140000 1.230000 3.370000 ( 7.602333)
alib.util.find 1.360000 0.440000 1.800000 ( 1.812519)
[cfadmin@yacht cfadmin]$ cat a.rb
require ‘benchmark’
require ‘alib’
require ‘bertram.scharpf.find.rb’
top = ‘/mnt/yacht0/data/night_files/’
Benchmark.bm do |b|
b.report(‘bertram.scharpf.find’){ Find.open(top){|x|} }
b.report(‘alib.util.find’){ alib.util.find(top){|x|} }
end
also there is alib.util.find2 which yields the stat together with the
path, preventing and extra stat on the pathname. in practice doing
something like
def method_missing m, *a, &b
stat.send m, *a, &b
end
means you have to use a ton of code since it’s possible that
f.size ### no error
f.mtime ### ENOENT
btw mine
http://codeforpeople.com/lib/ruby/alib/alib-0.5.0/lib/alib-0.5.0/
find2.rb
isn’t a spectacular implementation, it is based on Motoyuki
Kasahara’s 2001 lib, which used to be on the raa, called find2 - but
it’s reasonably fast, does depth and breath, caches stats, and
handles files evaporation from the filesystem or not being accessible
due to permissions errors.
i think all these libraries prove that a new find mechanism needs to
be incorporated into the stdlib! we should take the best features
from all the various libs and propose a new library that is backward
compatible with the built-in find.
kind regards.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs