Ruby projects code organization

Hi all,

I’m finishing the first version of a project. I want to prepare it to
distribution.
It seems there is no standard about ruby projects code organization.
Is there any ?

I looked the Puppet’s project organization, but I don’t know if it
follows a standard.
Do you haveany advices, ideas or links to articles about it ?

Thanks :slight_smile:

On Aug 13, 11:54 am, Simon COURTOIS [email protected] wrote:

Hi all,

I’m finishing the first version of a project. I want to prepare it to
distribution.
It seems there is no standard about ruby projects code organization.
Is there any ?

There are some general standards. Best place to start:

Creating Packages with setup.rb

Beyond that, Hoe, a popular project management tool, defines a minimal
superset of this --if you want to use it.

I have started adding an admin/ directory to my projects to place all
administrative files. This helps separate the distributable files from
the files I use only for development. It also keeps the project root
directory from getting so huge. For example, my projects will look
something like this:

myapp/
COPYING
HISTORY
MANIFEST
METADATA
NEWS
README
admin/
build/
config/
depot/
forms/
log/
notes/
pkg/
plugins/
website/
bin/
demo/
data/
etc/
doc/
rdoc/
ri/
lib/
myapp/
man/
script/
test/

This is the full spread, many of these locations aren’t needed for
every project.

T.

On Aug 13, 2008, at 12:47 PM, Trans wrote:

There are some general standards. Best place to start:

Creating Packages with setup.rb

Beyond that, Hoe, a popular project management tool, defines a minimal
superset of this --if you want to use it.

Author’s plug … try out Mr Bones if Hoe is not your style …

http://codeforpeople.rubyforge.org/bones/

Blessings,
TwP

I’d suggest something a little shorter than what others have - these
are the bare minimum, that you must have for a usable gem IMHO:

my_project/

  • README.mkdn
  • Rakefile.rb
  • lib/
    • my_project.rb
    • my_project/
      • another_file.rb
  • spec/
    • spec_helper.rb
    • my_project_spec.rb
    • my_project/
      • another_file_spec.rb

Of course your requirements will vary, but the concept remains - a
‘lib’ folder in root, with a file named after your project (this way,
you can distribute your project as a RubyGem, and people can require 'my_project' to use your library) as well as a folder named the same
(so they can cherry-pick code from your project if they so like -
require 'my_project/core_ext/string' for instance would allow them
to use your String class extensions without having to add the weight
of your entire project to their own).

Spec’ing is a must, IMHO, but that’s up to you - if you do so, it’s
expedient to have a duplicate of your ‘lib’ folder named ‘spec’
instead, a file mirroring each file in your project in name, with
_spec appended to it’s name.

Tim P. wrote:

Creating Packages with setup.rb

Beyond that, Hoe, a popular project management tool, defines a minimal
superset of this --if you want to use it.

Author’s plug … try out Mr Bones if Hoe is not your style …
http://codeforpeople.rubyforge.org/bones/

Blessings,
TwP
Ok :slight_smile: Thank you both, I’ll look a your links, 'seems nice.