Joe Van Dyk
6/23/2005 8:06:00 AM
I just realized that using Rubyscript2exe with sqlite probably isn't a
good idea, since the database disappears once the application gets
shut down, and I need the database to persist between application
launches. Hm.
On 6/23/05, Joe Van Dyk <joevandyk@gmail.com> wrote:
> Hi,
>
> I'm in an environment where it's kind of a pain in the ass to install
> external software on production machines. So, if I write a Ruby
> application that uses Tk + Tk extensions + ActiveRecord + Sqlite +
> whatever else, it's quite difficult to install all those pre-requistes
> on the machines (now, a combination of Redhat 8, 9, Enterprise Redhat,
> and IRIX).
>
> What I'd really like to do is to be able to package up Ruby, Sqlite,
> ActiveRecord, Tk extensions, all in one directory and say "there's my
> application. Run it."
>
> I'm having some luck with rubyscript2exe, but I'm running into
> problems getting the other stuff in the directory. For instance, I'm
> trying to bundle sqlite functionality.
>
> joe@ubuntu:~/test $ ls
> libsqlite3.so rubyscript2exe.rb test.db test.rb
>
> joe@ubuntu:~/test $ cat test.rb
>
> require 'rubygems'
> require_gem 'activerecord'
>
> RUBYSCRIPT2EXE_LIB = ["libsqlite3.so"]
>
> ActiveRecord::Base.establish_connection(
> :adapter => 'sqlite3',
> :dbfile => 'test.db'
> )
>
> class Partition < ActiveRecord::Base
> end
>
> p = Partition.new
> p.user = Time.now
> p.save
>
> for partition in Partition.find_all
> puts "partition user is #{partition.user} and partition title is
> #{partition.title}"
> end
>
> joe@ubuntu:~/test $ ruby rubyscript2exe.rb test.rb
> Tracing test ...
> Gathering files...
> /usr/lib/ruby/1.8/dl/import.rb:33:in `initialize': libsqlite3.so:
> cannot open shared object file: No such file or directory
> (RuntimeError)
> from /usr/lib/ruby/1.8/dl/import.rb:33:in `dlopen'
> from /usr/lib/ruby/1.8/dl/import.rb:33:in `dlload'
> from /usr/lib/ruby/1.8/dl/import.rb:31:in `each'
> from /usr/lib/ruby/1.8/dl/import.rb:31:in `dlload'
> from /usr/lib/ruby/site_ruby/1.8/sqlite3/driver/dl/api.rb:63
> from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
> `require__'
> from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
> `require'
> from /usr/lib/ruby/gems/1.8/gems/activesupport-1.0.0/lib/active_support/dependencies.rb:190:in
> `require'
> ... 16 levels...
> from /usr/lib/ruby/gems/1.8/gems/activerecord-1.7.0/lib/active_record/base.rb:856:in
> `initialize_without_callbacks'
> from /usr/lib/ruby/gems/1.8/gems/activerecord-1.7.0/lib/active_record/callbacks.rb:224:in
> `initialize'
> from test.rb:15:in `new'
> from test.rb:15
> Copying files...
> Stripping...
> Creating test_linux ...
>
>
> Why can't it find libsqlite3.so?
>
> Anyways, anyone have any advice on how to properly package
> applications so I can avoid having to install anything outside the
> application directory?
>