From: brabuhr on 22 Jul 2010 14:38 >> / >> bin/ #Put your executables here >> data/ #Everything else needed for the project >> doc/ #RDoc for the lib/ directory >> ext/ #C-Extensions go here >> lib/ #Everything internal is handled here >> - my_namespace.rb #Contains module methods for MyNamespace >> my_namespace/ #Directory for classes in MyNamespace >> - my_class.rb #Contains MyClass >> my_inner_namespace/ >> - my_2nd_class.rb > > So all my code looks like it would go under lib/ correct? > What does -my_namespace.rb refer to? Is this the Ruby class driver for > the applicaiton? Also my_inner_namespace.. not sure I understand this? I think he means something like: / lib/ library_name.rb # This is the file that consumers of this # library will require; it will create the # module and load the actual library. require './library_name/library_class' module LibraryName VERSION = "..." end library_name/ library_class.rb # The class that implements the library. module LibraryName class LibraryClass end end another_class.rb # A support class for the library. module LibraryName class AnotherClass end end submodule/ yet_another_class.rb # A support class in a submodule. module LibraryName module Submodule class YetAnotherClass end end end
From: Tim Pease on 22 Jul 2010 14:41 On Jul 22, 2010, at 11:41 AM, Carl Jenkins wrote: > What is/are the best-practice(s) for a Ruby project structure? > > 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? Take a look at Mr Bones. It encapsulates many ruby best-practices and lots of rake tasks to take care of the day-to-day development tasks gem install bones bones create new_project cd new_project rake -T # shows you all the available tasks rake bones:help # shows you the various project configuration settings Other tools in the same vein as Mr Bones are "hoe" and "jeweler" gem install hoe gem install jeweler I'm slightly partial to Mr Bones being the author and all. Blessings, TwP
From: Marvin Gülker on 22 Jul 2010 15:37 Tim Pease wrote: > On Jul 22, 2010, at 11:41 AM, Carl Jenkins wrote: > >> What is/are the best-practice(s) for a Ruby project structure? >> >> 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? > > Take a look at Mr Bones. It encapsulates many ruby best-practices and > lots of rake tasks to take care of the day-to-day development tasks > > > gem install bones > > bones create new_project > cd new_project > > rake -T # shows you all the available tasks > rake bones:help # shows you the various project configuration > settings > > > Other tools in the same vein as Mr Bones are "hoe" and "jeweler" > > gem install hoe > gem install jeweler > > > I'm slightly partial to Mr Bones being the author and all. > > Blessings, > TwP I'm not sure that's what the OP wants. He didn't state he wanted to build gems, he just wanted to know how a general Ruby projekt is structured (an end-user desktop app maybe?). Well, if one consideres a gem as the standard way to write a general Ruby project... ;-) Marvin -- Posted via http://www.ruby-forum.com/.
From: Intransition on 22 Jul 2010 16:50 On Jul 22, 1:41 pm, Carl Jenkins <carljenk...(a)gmail.com> wrote: > What is/are the best-practice(s) for a Ruby project structure? > > 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? http://wiki.github.com/proutils/setup/creating-packages
From: Mark T on 22 Jul 2010 21:11 My advice is to build a unique folder at root on a unix boxen (ex: RP1). In your profile, modify RUBYLIB to point to a sub folder of this. In your profile, modify GEM_HOME to point to an adjacent folder to this. Modify Then install Ruby to said folder with .configure option. Install gems. In your profile: RUBYOPT=rubygems, Then all updates to Ruby or gems will only require user perms. Your code can be in a subfolder of (RP1). Additionally, the entire folder structure can be easily backed up, transferred or rsync'd. Handy for remote instance installs. Use VMware/Virtualbox as local test area. Then get funky with code paths. MarkT
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: documentation from inside irb Next: HowTo get ruby to report a sumbolic link? |