Professional Web Applications Themes

Where to install data files? - Ruby

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...

  1. #1

    Default Where to install data files?

    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 Guest

  2. #2

    Default Re: Where to install data files?


    Marek Janukowicz said: 

    You might consider creating a RubyGem. Each gems installs in its own
    directory. See http://rubygems.rubyforge.org/wiki/wiki.pl

    --
    -- Jim Weirich org http://onestepback.org
    -----------------------------------------------------------------
    "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)



    Jim Guest

  3. #3

    Default Re: Where to install data files?

    --fwqqG+mf3f7vyBCB
    Content-Type: text/plain; cht=us-ascii
    Content-Disposition: inline
    Content-Transfer-Encoding: quoted-printable

    On Wed, Feb 04, 2004 at 06:20:04AM +0900, Marek Janukowicz wrote: 

    The nice thing about putting it in something like /usr/share is rbconfig
    sets the location for you:

    require 'rbconfig'
    puts Config::CONFIG['datadir'] # =3D> /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/ =3D=3D=3D 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 =3D File.join(dir, filename)
    return try_file if File.readable?(try_file)
    end
    end

    --
    Zachary P. Landau <net>
    GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc

    --fwqqG+mf3f7vyBCB
    Content-Type: application/pgp-signature
    Content-Disposition: inline

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.2.4 (GNU/Linux)

    iD8DBQFAIBa2CwWyMCTlrZkRAgu4AJ9TSAbds8/QYnMsKY9gd6SMmt88qgCeLmWD
    ubemwhdEPPn3WwTvRvsL9CU=
    =eiz7
    -----END PGP SIGNATURE-----

    --fwqqG+mf3f7vyBCB--


    Zachary Guest

  4. #4

    Default Re: Where to install data files?

    On Wed, 4 Feb 2004 06:41:08 +0900, Jim Weirich wrote: 
    >
    > You might consider creating a RubyGem. Each gems installs in its own
    > directory. See http://rubygems.rubyforge.org/wiki/wiki.pl[/ref]

    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...

    --
    Marek Janukowicz
    Marek Guest

Similar Threads

  1. How to install the jar files for the cf extensions
    By WestSide in forum Macromedia Flex General Discussion
    Replies: 0
    Last Post: May 19th, 06:55 AM
  2. New MX Install - Data Source Verifies
    By schep in forum Coldfusion Database Access
    Replies: 2
    Last Post: March 7th, 06:48 PM
  3. can't install - failure to move files
    By photogirl in forum Adobe Photoshop 7, CS, CS2 & CS3
    Replies: 0
    Last Post: July 15th, 04:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139