"It uses constants and global variables." Oh, no, please, don't do this. You're making your life needlessly difficult.
You really need to avoid using global constants and variables unless you literally have no other option. They're extremely difficult to keep orderly and tend to cause chaos in any non-trivial program.
Organize everything in your program into one or more module
or class
definitions. Give them meaningful names. You'll use a module
for "collection of method" containers, class
for something that encapsulates a process or an entity of some sort.
This distinction is sometimes hard to make, but thinking about the problem carefully and trying different approaches will be necessary to do it properly.
The basics of my Ruby code are a directory called bin/
for any sort of executables, lib/
for the library files, test/
for testing code, and a README
file to explain what it all does. The last two are especially important as untested code is nothing but trouble, and undocumented code is even worse.
You'll only need a Rakefile
if you have some kind of processes you need to perform on a routine basis. Packaging a gem
is one such thing, or as with Rails, managing database migrations. Most projects don't need one of these, but it's sometimes helpful to include one that simply runs tests or produces documentation.
The format of a Rakefile
is super simple, and there are literally millions of examples out there. Find one that does what you need and adapt it to your particular structure.