Hello everyone -
I am just getting comfortable with ruby, having come over from the Java / .NET
world and I am a little confused about best practices regarding namespaces and
project organization.
I have wrapped all of the classes in my current project in a namespace using
modules but am a bit confused about how I should structure the files in the
filesystem... I am used to having a project layout that follows the namespace
hierarchy. For example:
project
(misc project docs)
src
s0nspark
app
my_app.rb <- main app entry point
my_app/
an_app_lib/
ext
(extensions to ruby classes)
lib
some_lib.rb <- main library stub loader thingie
some_lib/
another_lib.rb
another_lib
util
some_util
Is this feasible with ruby or am I opening up a bag of worms here? To be
specific, would it be "right" to define the namespace for "some_lib" above like so:
module s0nspark
module libs
module some_lib
(a class goes here)
end
end
end
... and then require the lib in an app that uses it like so:
require "s0nspark/libs/some_lib.rb"
with all of the necessary lib files loaded in some_lib.rb?
Would it be unwise to use relative paths for files that are loaded/required
within some_lib.rb? Is this making sense?
Thanks for any assistance in helping me cut through my fog... :-)
Cheers,
Tim