Sha256: e9f48a4a44aec2d88779eb89dd88ca7b59fa300b8d60264d35216c0c106cfc06

Contents?: true

Size: 1.21 KB

Versions: 24

Compression:

Stored size: 1.21 KB

Contents

#!/usr/bin/env ruby

# An example of requiring all the files in a table via the Bootstrap::lift
# method.
#
# First use the blob.rb example in this same directory to load the a.rb file
# into an example database:
#
#   ruby blob.rb store a.rb
#
# Then run this example.
#

# Require "ONLY" then binary extension, do not +require+ the ruby based code
$: << "../ext"
require 'amalgalite3'

# See what the load path is, notice that it is very small
puts "Before $\" : #{$LOADED_FEATURES.inspect}"

# tell the binary extension to "require" every file in the filestore.db in the
# table 'files' orderd by column 'id'.  The 'path' column is added to $LOADED_FEATURES and the
# code in 'data' is evaled.
Amalgalite::Requires::Bootstrap.lift( "dbfile"          => "filestore.db", 
                                      "table_name"      => "rubylibs", 
                                      "rowid_column"    => "id", 
                                      "filename_column" => "filename", 
                                      "contents_column" => "contents" )

# Notice that a.rb is in the list of files that has been required
puts "After $\" : #{$LOADED_FEATURES.inspect}"

# and look we prove that the code was eval'd appropriately
a = A.new
a.a

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
amalgalite-0.5.0-x86-mswin32-60 examples/bootstrap.rb
amalgalite-0.5.1 examples/bootstrap.rb
amalgalite-0.5.1-x86-mswin32-60 examples/bootstrap.rb
amalgalite-0.5.0 examples/bootstrap.rb
amalgalite-0.7.0 examples/bootstrap.rb
amalgalite-0.7.0-x86-mswin32-60 examples/bootstrap.rb
amalgalite-0.6.0 examples/bootstrap.rb
amalgalite-0.6.0-x86-mswin32-60 examples/bootstrap.rb
amalgalite-0.7.3 examples/bootstrap.rb
amalgalite-0.7.1-x86-mswin32-60 examples/bootstrap.rb
amalgalite-0.7.1 examples/bootstrap.rb
amalgalite-0.7.3-x86-mswin32-60 examples/bootstrap.rb
amalgalite-0.7.4-x86-mswin32-60 examples/bootstrap.rb
amalgalite-0.7.5-x86-mswin32-60 examples/bootstrap.rb
amalgalite-0.7.4 examples/bootstrap.rb
amalgalite-0.7.5 examples/bootstrap.rb
amalgalite-0.7.6-x86-mswin32-60 examples/bootstrap.rb
amalgalite-0.7.7 examples/bootstrap.rb
amalgalite-0.7.6 examples/bootstrap.rb
amalgalite-0.7.7-x86-mswin32-60 examples/bootstrap.rb