From: Carl Jenkins Date: 2010-07-24T03:28:17+09:00 Subject: Re: Typical Ruby (non-rails) project structure. Richard Conroy wrote: > On Thu, Jul 22, 2010 at 6:41 PM, Carl Jenkins > wrote: > >> What is/are the best-practice(s) for a Ruby project structure? >> > > Use the gem structure. Its pretty universal for packaging, structuring > and > even deploying Ruby projects. Rails projects use their own structure, > but > its well documented too. > > >> As I am just learning Ruby I put everything in one file but, now I am >> learning about Modules etc.. >> >> In Java, classes where in packages which helped with code organization. >> Is there a typical way to layout a Ruby project structure? > > > Note that in Java packages also map 1:1 with the directory structure of > the > classes, that is quite strict. In Ruby, the hierarchy of namespaces has > no implications on how ruby files are loaded. > > I haven't seen much information, beyond the replies here, that implies > any consensus on how these files are structured or named. > > It is worth researching exactly how 'require' and the load path works in > Ruby. It is a bit alien coming from a Java background, but the mechanics > of how it works will imply its own best practices. When using them gem structure for example I have something like this. new_proj/ bin/ lib/ common/ -new_file.rb spec/ test/ -new_test.rb In order to test the new_file.rb my new_test.rb must have the path to the new_file.rb as the require correct? Something like require '../lib/common/new_file' Or is there a different way to do that? Thanks for all the help - (everyone) this is most helpful! -- Posted via http://www.ruby-forum.com/.