Hi Jim
Questions for a small ruby application. The application will not result
in a ruby library at all.Hope your “Ruby Project Directory Structure” is also valid for a simple
application.
Good question. I have this scenario all the time.
a) There are a couple of .rb files which hold the ruby classes for the
application. Where do these files go to? bin/ or lib/
lib/
The executable can be installed in the ruby_path/bin or some
other path. When it calls require ‘my_lib’, it will find your .rb
classes installed under ruby_path/lib/ruby/site_ruby/1.x/ .
b) A ruby file is called start1.rb and start2.rb which starts the
applications (each creates an instance object of the main application,
sort of client-server). Does this file go into bin/ or does it go into
examples as it showes how to start the application or is it a
replacement for the setup.rb file?
When I used setup.rb I was thinking of the app written by Minero
Aoki. From what I can tell, most raa packages are installed via:
ruby install.rb setup
ruby install.rb config
ruby install.rb install
I would say that if your startx apps are absolutely required to
run your app, then they should go in bin/. If, as you say, they
are examples, the they should go under examples.
- Also there are a couple of data (input files) for the application.
Where do those data (input files) go?
That’s a good question. If the data files are configurable by
the user, it might be best to put them under $HOME/.myapprc,
or to read them from the command line.
In the case where they are static and part of the app database,
you may wnat to store them in the ruby_lib path.
I have a situation similar to this at work where we have an
app that requires a database of netlist templates. We want this
to be invisible to the user, so we have a class that controls
these templates. We put the templates in a directory under the
class and it finds them with:
template_path = File.join(File.dirname(__FILE__), "template")
ruby_path/lib/site_ruby/1.8/my_app/template.rb
ruby_path/lib/site_ruby/1.8/my_app/template/template1
ruby_path/lib/site_ruby/1.8/my_app/template/template2