The core structure of a standard Ruby project is basically:
lib/
foo.rb
foo/
share/
foo/
test/
helper.rb
test_foo.rb
HISTORY.md (or CHANGELOG.md)
LICENSE.txt
README.md
foo.gemspec
The share/
is rare and is sometimes called data/
instead. It is for general purpose non-ruby files. Most projects don't need it, but even when they do many times everything is just kept in lib/
, though that is probably not best practice.
The test/
directory might be called spec/
if BDD is being used instead of TDD, though you might also see features/
if Cucumber is used, or demo/
if QED is used.
These days foo.gemspec
can just be .gemspec
--especially if it is not manually maintained.
If your project has command line executables, then add:
bin/
foo
man/
foo.1
foo.1.md or foo.1.ronn
In addition, most Ruby project's have:
Gemfile
Rakefile
The Gemfile
is for using Bundler, and the Rakefile
is for Rake build tool. But there are other options if you would like to use different tools.
A few other not-so-uncommon files:
VERSION
MANIFEST
The VERSION
file just contains the current version number. And the MANIFEST
(or Manifest.txt
) contains a list of files to be included in the project's package file(s) (e.g. gem package).
What else you might see, but usage is sporadic:
config/
doc/ (or docs/)
script/
log/
pkg/
task/ (or tasks/)
vendor/
web/ (or site/)
Where config/
contains various configuration files; doc/
contains either generated documentation, e.g. RDoc, or sometimes manually maintained documentation; script/
contains shell scripts for use by the project; log/
contains generated project logs, e.g. test coverage reports; pkg/
holds generated package files, e.g. foo-1.0.0.gem
; task/
could hold various task files such as foo.rake
or foo.watchr
; vendor/
contains copies of the other projects, e.g. git submodules; and finally web/
contains the project's website files.
Then some tool specific files that are also relatively common:
.document
.gitignore
.yardopts
.travis.yml
They are fairly self-explanatory.
Finally, I will add that I personally add a .index
file and a var/
directory to build that file (search for "Rubyworks Indexer" for more about that) and often have a work
directory, something like:
work/
NOTES.md
consider/
reference/
sandbox/
Just sort of a scrapyard for development purposes.