On Wed, Mar 9, 2011 at 6:30 AM, Roman Kononov <rkononov / gmail.com> wrote:

> I have following task - create single file from gem for executing it on
> dedicated server. I have implemented recursive walk of files tree. Main
> problem that order of file list i extracted from gem is wrong, i.e
>
> require "/simple_record/attributes"
> require "/simple_record/active_sdb"
> require "/simple_record/callbacks"
>
> but when i'm trying to merge these files into one in this precedence on
> file load i'm receiving NameError due to wrong files order.Any ideas how
> i could get proper list of gem files or make dependency graph, or export
> gem in single huge file?
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
Did you mean to have a leading slash on your require statement? That implies
you installed it in your root dir (which is probably not a good place for
it), I'd personally let Rubygems handle installation and location of gems,
in fact I did, and when I ran your code (on 1.9.1) I didn't get any errors.

But, to answer your question, looking at the gem, you can just require the
lib and it will require all those files for you:
https://github.com/appoxy/simple_record/blob/master/lib/simple_record.rb#L37-48

So you could just replace your three lines with: require("simple_record")
which also worked for me.

This is a fairly common convention, you can check out the gem's source code
with `$ gem open simple_record` (you'll first need to `$ gem install
gem-open`)