Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Directory layout for pure Ruby project

Tags:

I'm starting to learn ruby. I'm also a day-to-day C++ dev. For C++ projects I usually go with following dir structure

/  -/bin <- built binaries  -/build <- build time temporary object (eg. .obj, cmake intermediates)  -/doc <- manuals and/or Doxygen docs  -/src  --/module-1  --/module-2  -- non module specific sources, like main.cpp  - IDE project files (.sln), etc. 

What dir layout for Ruby (non-Rails, non-Merb) would you suggest to keep it clean, simple and maintainable?

like image 323
Marcin Gil Avatar asked Sep 11 '08 11:09

Marcin Gil


2 Answers

As of 2011, it is common to use jeweler instead of newgem as the latter is effectively abandoned.

like image 118
troutwine Avatar answered Sep 30 '22 19:09

troutwine


Bundler includes the necessary infrastructure to generate a gem:

$ bundle gem --coc --mit --test=minitest --exe spider Creating gem 'spider'... MIT License enabled in config Code of conduct enabled in config       create  spider/Gemfile       create  spider/lib/spider.rb       create  spider/lib/spider/version.rb       create  spider/spider.gemspec       create  spider/Rakefile       create  spider/README.md       create  spider/bin/console       create  spider/bin/setup       create  spider/.gitignore       create  spider/.travis.yml       create  spider/test/test_helper.rb       create  spider/test/spider_test.rb       create  spider/LICENSE.txt       create  spider/CODE_OF_CONDUCT.md       create  spider/exe/spider Initializing git repo in /Users/francois/Projects/spider Gem 'spider' was successfully created. For more information on making a RubyGem visit https://bundler.io/guides/creating_gem.html 

Then, in lib/, you create modules as needed:

lib/   spider/     base.rb   crawler/     base.rb   spider.rb     require "spider/base"     require "crawler/base" 

Read the manual page for bundle gem for details on the --coc, --exe and --mit options.

like image 22
François Beausoleil Avatar answered Sep 30 '22 18:09

François Beausoleil