Where should I install data files for the library I wrote? They are
connected with .rb files, so they should stay in the same directory, but
setup.rb does not install anything but .rb files from lib/ subdirectory.
The default data dir (/usr/share on my Gentoo Linux) does not seems
appropiate, too (I want my library to be installed in one place).
Maybe there should be something like java .jar files, which can contain
not only java class files, but also the resource files (corrent me if
I’m wrong)?
···
–
Marek Janukowicz
Marek Janukowicz said:
Where should I install data files for the library I wrote? They are
connected with .rb files, so they should stay in the same directory, but
setup.rb does not install anything but .rb files from lib/ subdirectory.
The default data dir (/usr/share on my Gentoo Linux) does not seems
appropiate, too (I want my library to be installed in one place).
Maybe there should be something like java .jar files, which can contain
not only java class files, but also the resource files (corrent me if
I’m wrong)?
You might consider creating a RubyGem. Each gems installs in its own
directory. See http://rubygems.rubyforge.org/wiki/wiki.pl
···
“Beware of bugs in the above code; I have only proved it correct,
not tried it.” – Donald Knuth (in a memo to Peter van Emde Boas)
The nice thing about putting it in something like /usr/share is rbconfig
sets the location for you:
require 'rbconfig'
puts Config::CONFIG['datadir'] # => /usr/share on my machine
That being said, I have one project that uses a .glade file. I decided
to put it next to the .rb files, as you said. I had to modify setup.rb
slightly to allow this though. I changed the following:
def ruby_scripts
collect_filenames_auto().select {|n| /.rb\z/ === n }
end
to just
def ruby_scripts
collect_filenames_auto()
end
You could keep the select and just add your datafile extensions there
too, of course. Just as a bonus, this is the code I use to find the data
file in the ruby path:
def find_in_path(filename)
$LOAD_PATH.find do |dir|
try_file = File.join(dir, filename)
return try_file if File.readable?(try_file)
end
end
···
On Wed, Feb 04, 2004 at 06:20:04AM +0900, Marek Janukowicz wrote:
Where should I install data files for the library I wrote? They are
connected with .rb files, so they should stay in the same directory, but
setup.rb does not install anything but .rb files from lib/ subdirectory.
The default data dir (/usr/share on my Gentoo Linux) does not seems
appropiate, too (I want my library to be installed in one place).
Maybe there should be something like java .jar files, which can contain
not only java class files, but also the resource files (corrent me if
I’m wrong)?
–
Zachary P. Landau kapheine@hypa.net
GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc
Actually I just looked at RubyGems before asking the question, but now
I see I need to make a closer look
Btw. what is the status of
RubyGems development? I don’t see anything new for about 2 months…
···
On Wed, 4 Feb 2004 06:41:08 +0900, Jim Weirich wrote:
Where should I install data files for the library I wrote? They are
connected with .rb files, so they should stay in the same directory, but
setup.rb does not install anything but .rb files from lib/ subdirectory.
The default data dir (/usr/share on my Gentoo Linux) does not seems
appropiate, too (I want my library to be installed in one place).
Maybe there should be something like java .jar files, which can contain
not only java class files, but also the resource files (corrent me if
I’m wrong)?
You might consider creating a RubyGem. Each gems installs in its own
directory. See http://rubygems.rubyforge.org/wiki/wiki.pl
–
Marek Janukowicz