From: Intransition Date: 2012-01-06T01:26:21+09:00 Subject: Re: organizing a complex gem ------=_Part_650_2527163.1325780778964 Content-Type: multipart/alternative; boundary="----=_Part_651_5174578.1325780778964" ------=_Part_651_5174578.1325780778964 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Thursday, January 5, 2012 2:21:18 AM UTC-5, Chad Perrin wrote: > > On Thu, Jan 05, 2012 at 02:39:38PM +0900, Intransition wrote: > > Use dot directory: > > > > $HOME/.yourappname/ > > > > In there the end-user can edit a `config` file (maybe config.yml, or > > config.rb or whatever the appropriate extension). And also the data > files > > you mention can go there too, e.g. `$HOME/.yourappname/foo.dat`. > > Where would I store this within the gem/project directory hierarchy, > though? That's the real question I have with regard to where to put my > config and data files right now, and not so much where to install them > later (which I was thinking of doing in a manner quite like what you > describe here). > Ah, you mean for a default setup? You should keep it in your project, either in `lib` somewhere or if you what to be FHS strict use `data/foo/` which should be installed to `/usr/share/foo/`. However for the later, RubyGems doesn't install data to share, so you will have to access that from the gem itself (maybe using `RbConfig.datadir`?) -- which is why I say just using `lib` is much easier. Then have your program setup the user defaults on an initial run. ------=_Part_651_5174578.1325780778964 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

On Thursday, January 5, 2012 2:21:18 AM UTC-5, Chad Perrin wrote:On Thu, Jan 05, 2012 at 02:39:38= PM +0900, Intransition wrote:
> Use dot directory:
>
> &= nbsp; $HOME/.yourappname/
>
> In there the end-user can edit a= `config` file (maybe config.yml, or
> config.rb or whatever the app= ropriate extension). And also the data files
> you mention can go th= ere too, e.g. `$HOME/.yourappname/foo.dat`.

Where would I store this with= in the gem/project directory hierarchy,
though?  That's the real qu= estion I have with regard to where to put my
config and data files right= now, and not so much where to install them
later (which I was thinking = of doing in a manner quite like what you
describe here).


Ah, you mean for a default setup? You should keep it i= n your project, either in `lib` somewhere or if you what to be FHS strict u= se `data/foo/` which should be installed to `/usr/share/foo/`. However for = the later, RubyGems  doesn't install data to share, so you will h= ave to access that from the gem itself (maybe using `RbConfig.datadir`?) --= which is why I say just using `lib` is much easier.

Then have your program setup the user defaults on an initial run.<= div>

------=_Part_651_5174578.1325780778964-- ------=_Part_650_2527163.1325780778964--