Re: Where does data provided by ruby packages go?
On Tue, 19 Jan 2010 11:14:46 -0300
Antonio Terceiro <terceiro@softwarelivre.org> wrote:
> If you use setup.rb as your "build system", it will install everything
> under data/ into /usr/share/, so you should probably use the following
> layout:
>
> yourproject/
> setup.rb
> data/
> yourproject/
> file1.ext
> file2.ext
...
Thanks. Yeah, I discovered this the first time I tried setup.rb and
adjusted the directory structure accordingly so that data would end up
in /usr/share/sample/
> And use something like this (in lib/sample.rb, the paths need adjusting otherwise):
>
> class Sample
> def datadir
> @datadir ||= [
> File.join(File.dirname(__FILE__), '../data/sample'),
> File.join(Config::CONFIG['datadir'], 'sample')
> ].select { |dir| File.exist?(dir) }
> end
> end
>
> You should also probably raise an exception in the case that select does not
> find any directory whatsoever.
Yup. Actually, when I discussed this on irc, Paul van Tilburg
suggested:
http://svn.luon.net/filedetails.php?repname=goat&path=/trunk/lib/pre-setup.rb
http://svn.luon.net/filedetails.php?repname=goat&path=/trunk/lib/post-clean.rb
I like this approach. This is what I envisioned people were doing
anyway. I just was never able to find any examples of it being done
and was concerned about not reinventing the wheel.
Ben
Reply to: