Prev: Expressive Languages for the JVM (JRuby/Mirah)
Next: telugu movies songs,telugu movie reviews,telugu movie songs,telugu songs,telugu movie news,telugu film news,telugu music,telugu movie stills,telugu websites,telugu songs download,telugu news,telugu mp3,telugu mp3 songs,telugu new songs
From: Rajarshi Chakravarty on 9 Aug 2010 01:41 Hi, Is there a syntax of 'require' that can dynamically pick up all source files searching in sub directories? I have many subdirectories under my root directory and each has some .rb files. The names and number of files in each subdirectory are different. My main program is in the root directory. It needs to be able to access all the .rb files. Regards, Raj -- Posted via http://www.ruby-forum.com/.
From: Tony Arcieri on 9 Aug 2010 02:14 [Note: parts of this message were removed to make it a legal post.] On Sun, Aug 8, 2010 at 11:41 PM, Rajarshi Chakravarty <raj_plays(a)yahoo.com>wrote: > Hi, > Is there a syntax of 'require' that can dynamically pick up all source > files searching in sub directories? There's my require_all gem, which will not only do this, but resolve dependencies between files http://github.com/tarcieri/require_all That said, I'm not really a fan of this method anymore. It's slow and has thread safety issues. I've been meaning to write a "sequel" to require_all, but never gotten around to it. -- Tony Arcieri Medioh! A Kudelski Brand
From: Jesús Gabriel y Galán on 9 Aug 2010 02:22 On Mon, Aug 9, 2010 at 7:41 AM, Rajarshi Chakravarty <raj_plays(a)yahoo.com> wrote: > Hi, > Is there a syntax of 'require' that can dynamically pick up all source > files searching in sub directories? > > I have many subdirectories under my root directory and each has some .rb > files. > The names and number of files in each subdirectory are different. > My main program is in the root directory. > It needs to be able to access all the .rb files. I did this once: Dir["#{libdir}/*/*.rb"].each do |x| puts "requiring #{File.join(File.dirname(x), File.basename(x, ".rb"))}" require File.join(File.dirname(x), File.basename(x, ".rb")) end it will require all "*.rb" files under a folder. Hope this helps, Jesus.
|
Pages: 1 Prev: Expressive Languages for the JVM (JRuby/Mirah) Next: telugu movies songs,telugu movie reviews,telugu movie songs,telugu songs,telugu movie news,telugu film news,telugu music,telugu movie stills,telugu websites,telugu songs download,telugu news,telugu mp3,telugu mp3 songs,telugu new songs |