In reference to this question: Ideal ruby project structure I noticed that appname.rb is in lib, and is top level.
I was reading through a little of the Rake source code on Github, and I noticed their project structure is pretty much the same. They have a top level 'rake.rb' file in /lib, but I'm not sure what it's there for.
In The Pickaxe (Programming Ruby 1.9), they show an example of structuring a small project, with pretty much the same directory structure above, but there is no mention of the usage of a top level .rb in /lib.
So, my question is: What exactly is this thing typically used for in a Ruby project?
Sorry if this is a stupid question, I'm sure it is, but I'm relatively new to Ruby. I don't know that much Ruby-foo right now. ;)
Thanks.
Usually (and certainly in the example of rake) the appname.rb
file is a shortcut to require a lot of other files. If you take a look at that file in the Rake project on GitHub, most of what it does is require files in the lib/rake
directory and include modules as necessary. That file is what lets you require 'rake'
without having to know what individual files rake needs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With