<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>spec/packer_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -74,8 +74,8 @@ begin
 
   
   if options[:self] then
-    options[:table_name] = Amalgalite::Requires::Bootstrap::DEFAULT_TABLE
-    core_libs = (amalgalite_needs - Amalgalite::Requires.require_order).delete_if { |l| l.index(&quot;.rb&quot;).nil? }
+    options[:table_name] = Amalgalite::Requires::Bootstrap::DEFAULT_BOOTSTRAP_TABLE
+    core_libs = (amalgalite_needs - Amalgalite::Packer.amalgalite_require_order).delete_if { |l| l.index(&quot;.rb&quot;).nil? }
 
     #
     # check and make sure nothing is missed
@@ -83,11 +83,10 @@ begin
     core_libs.each do |l| 
       if l.index(&quot;malgalite&quot;) then
         STDERR.puts &quot;ERROR!  require_order needs an update #{l}&quot; 
-        STDERR.puts &quot;Tell jeremy he needs to run rake test:check_requires and fix&quot;
         exit 2
       end
     end
-    file_list = core_libs.concat( Amalgalite::Requires.require_order )
+    file_list = core_libs.concat( Amalgalite::Packer.amalgalite_require_order )
     if options[:compressed] then
       STDERR.puts &quot;Compressing --self is not allowed, reverting to uncompressed&quot;
       options[:compressed] = false</diff>
      <filename>bin/amalgalite-pack</filename>
    </modified>
    <modified>
      <diff>@@ -20,7 +20,7 @@ require 'rubygems'
 $: &lt;&lt; &quot;../lib&quot;
 $: &lt;&lt; &quot;../ext&quot;
 require 'amalgalite'
-require 'amalgalite/requires'
+require 'amalgalite/packer'
 VALID_ACTIONS = %w[ list retrieve store ]
 def usage 
   STDERR.puts &quot;Usage: #{File.basename($0)} ( #{VALID_ACTIONS.join(' | ')} )  file(s)&quot;
@@ -66,7 +66,7 @@ when 'store'
   require 'amalgalite/packer'
 
   packer = Amalgalite::Packer.new( :dbfile =&gt; 'filestore.db',
-                                   :compressed =&gt; true )
+                                   :compressed =&gt; false )
   packer.pack( file_list )
 
   #
@@ -79,7 +79,7 @@ when 'retrieve'
     STDERR.puts &quot;Dumping #{row['filename']} to stdout&quot;
     if row['compressed'] then
       s = row['contents'].to_s
-      STDOUT.puts Amalgalite::Requires.gunzip( s )
+      STDOUT.puts Amalgalite::Packer.gunzip( s )
     else
       row['contents'].write_to_io( STDOUT )
     end</diff>
      <filename>examples/blob.rb</filename>
    </modified>
    <modified>
      <diff>@@ -22,10 +22,10 @@ puts &quot;Before $\&quot; : #{$&quot;.inspect}&quot;
 # table 'files' orderd by column 'id'.  The 'path' column is added to $&quot; and the
 # code in 'data' is evaled.
 Amalgalite::Requires::Bootstrap.lift( &quot;dbfile&quot;          =&gt; &quot;filestore.db&quot;, 
-                                      &quot;table_name&quot;      =&gt; &quot;files&quot;, 
+                                      &quot;table_name&quot;      =&gt; &quot;rubylibs&quot;, 
                                       &quot;rowid_column&quot;    =&gt; &quot;id&quot;, 
-                                      &quot;filename_column&quot; =&gt; &quot;path&quot;, 
-                                      &quot;contents_column&quot; =&gt; &quot;data&quot; )
+                                      &quot;filename_column&quot; =&gt; &quot;filename&quot;, 
+                                      &quot;contents_column&quot; =&gt; &quot;contents&quot; )
 
 # Notice that a.rb is in the list of files that has been required
 puts &quot;After $\&quot; : #{$&quot;.inspect}&quot;</diff>
      <filename>examples/bootstrap.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,4 @@
+CONSTANT = &quot;bad&quot;
 class RequireMe
   def initialize( msg )
     @msg = msg</diff>
      <filename>examples/require_me.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,7 @@ $: &lt;&lt; &quot;../ext&quot;
 require 'rubygems'
 require 'amalgalite'
 
-style = ARGV.shift
+style = ARGV.shift || &quot;normal&quot;
 
 #
 # create the database 
@@ -19,7 +19,7 @@ style = ARGV.shift
 dbfile = Amalgalite::Requires::Bootstrap::DEFAULT_DB
 File.unlink( dbfile ) if File.exist?( dbfile )
 require 'amalgalite/packer'
-options = {}
+options = { :verbose =&gt; true }
 if style == &quot;compressed&quot; then
   options[:compressed] = true
 end
@@ -27,12 +27,16 @@ p = Amalgalite::Packer.new( options )
 p.pack( [ &quot;require_me.rb&quot; ] )
 
 require 'amalgalite/requires'
-Amalgalite::Requires.new( :dbfile_name =&gt; p.dbfile )
-FileUtils.mv 'require_me.rb', 'rm.rb'
-require 'require_me'
-e = RequireMe.new( &quot;#{style} style works!&quot; )
-e.foo
-require 'require_me'
+begin 
+  Amalgalite::Requires.new( :dbfile_name =&gt; p.dbfile )
+  FileUtils.mv 'require_me.rb', 'rm.rb', :verbose =&gt; true
+  require 'require_me'
+  e = RequireMe.new( &quot;#{style} require style works!&quot; )
+  e.foo
+  require 'require_me'
+  puts 
 
-puts 
-FileUtils.mv 'rm.rb', 'require_me.rb'
+ensure
+  FileUtils.mv 'rm.rb', 'require_me.rb', :verbose =&gt; true
+  File.unlink( dbfile ) if File.exist?( dbfile )
+end</diff>
      <filename>examples/requires.rb</filename>
    </modified>
    <modified>
      <diff>@@ -69,11 +69,11 @@ VALUE am_bootstrap_lift( VALUE self, VALUE args )
     int  last_row_good; 
     char raise_msg[BUFSIZ];
 
-    VALUE     am_db_c  = rb_const_get( cARB, rb_intern(&quot;DEFAULT_DB&quot;) );
-    VALUE    am_tbl_c  = rb_const_get( cARB, rb_intern(&quot;DEFAULT_TABLE&quot;) );
-    VALUE     am_pk_c  = rb_const_get( cARB, rb_intern(&quot;DEFAULT_ROWID_COLUMN&quot;) );
-    VALUE  am_fname_c  = rb_const_get( cARB, rb_intern(&quot;DEFAULT_FILENAME_COLUMN&quot;) );
-    VALUE am_content_c = rb_const_get( cARB, rb_intern(&quot;DEFAULT_CONTENTS_COLUMN&quot;) );
+    VALUE     am_db_c     = rb_const_get( cARB, rb_intern(&quot;DEFAULT_DB&quot;) );
+    VALUE    am_tbl_c     = rb_const_get( cARB, rb_intern(&quot;DEFAULT_BOOTSTRAP_TABLE&quot;) );
+    VALUE     am_pk_c     = rb_const_get( cARB, rb_intern(&quot;DEFAULT_ROWID_COLUMN&quot;) );
+    VALUE  am_fname_c     = rb_const_get( cARB, rb_intern(&quot;DEFAULT_FILENAME_COLUMN&quot;) );
+    VALUE am_content_c    = rb_const_get( cARB, rb_intern(&quot;DEFAULT_CONTENTS_COLUMN&quot;) );
 
     char*     dbfile = NULL;
     char*    tbl_name = NULL;
@@ -199,11 +199,13 @@ void Init_amalgalite3_requires_bootstrap()
     rb_define_module_function(cARB, &quot;lift&quot;, am_bootstrap_lift, -2); 
 
     /* constants for default db, table, column, rowid, contents */ 
-    rb_define_const(cARB,              &quot;DEFAULT_DB&quot;, rb_str_new2( &quot;lib.db&quot; ));
-    rb_define_const(cARB,           &quot;DEFAULT_TABLE&quot;, rb_str_new2( &quot;bootstrap&quot; ));
-    rb_define_const(cARB,    &quot;DEFAULT_ROWID_COLUMN&quot;, rb_str_new2( &quot;id&quot; ));
-    rb_define_const(cARB, &quot;DEFAULT_FILENAME_COLUMN&quot;, rb_str_new2( &quot;filename&quot; ));
-    rb_define_const(cARB, &quot;DEFAULT_CONTENTS_COLUMN&quot;, rb_str_new2( &quot;contents&quot; ));
+    rb_define_const(cARB,                &quot;DEFAULT_DB&quot;, rb_str_new2( &quot;lib.db&quot; ));
+    rb_define_const(cARB,             &quot;DEFAULT_TABLE&quot;, rb_str_new2( &quot;rubylibs&quot; ));
+    rb_define_const(cARB,   &quot;DEFAULT_BOOTSTRAP_TABLE&quot;, rb_str_new2( &quot;bootstrap&quot; ));
+    rb_define_const(cARB,      &quot;DEFAULT_ROWID_COLUMN&quot;, rb_str_new2( &quot;id&quot; ));
+    rb_define_const(cARB,   &quot;DEFAULT_FILENAME_COLUMN&quot;, rb_str_new2( &quot;filename&quot; ));
+    rb_define_const(cARB,   &quot;DEFAULT_CONTENTS_COLUMN&quot;, rb_str_new2( &quot;contents&quot; ));
+    rb_define_const(cARB, &quot;DEFAULT_COMPRESSED_COLUMN&quot;, rb_str_new2( &quot;compressed&quot; ));
 
     return;
 }</diff>
      <filename>ext/amalgalite3_requires_bootstrap.c</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 require 'optparse'
 require 'ostruct'
-require 'amalgalite/requires'
+require 'pathname'
+require 'zlib'
+
+require 'amalgalite'
 module Amalgalite
   #
   # Pack items into an amalgalite database.  
@@ -13,23 +16,82 @@ module Amalgalite
     class &lt;&lt; self
       def default_options
         {
-          :table_name        =&gt; Requires.default_table_name,
-          :filename_column   =&gt; Requires.default_filename_column,
-          :contents_column   =&gt; Requires.default_contents_column,
-          :compressed_column =&gt; Requires.default_compressed_column,
+          :table_name        =&gt; Requires::Bootstrap::DEFAULT_TABLE,
+          :filename_column   =&gt; Requires::Bootstrap::DEFAULT_FILENAME_COLUMN,
+          :contents_column   =&gt; Requires::Bootstrap::DEFAULT_CONTENTS_COLUMN,
+          :compressed_column =&gt; Requires::Bootstrap::DEFAULT_COMPRESSED_COLUMN,
           :strip_prefix      =&gt; Dir.pwd,
           :compressed        =&gt; false,
           :verbose           =&gt; false,
         }
       end
+
+      #
+      # compress data
+      #
+      def gzip( data )
+        zipped = StringIO.new
+        Zlib::GzipWriter.wrap( zipped ) do |io|
+          io.write( data )
+        end
+        return zipped.string
+      end
+
+      # 
+      # uncompress gzip data
+      #
+      def gunzip( data )
+        data = StringIO.new( data )
+        Zlib::GzipReader.new( data ).read
+      end
+
+
+      #
+      # return the files in their dependency order for use for packing into a
+      # database
+      #
+      def amalgalite_require_order
+        @require_order ||= %w[
+          amalgalite.rb
+          amalgalite/blob.rb
+          amalgalite/boolean.rb
+          amalgalite/column.rb
+          amalgalite/statement.rb
+          amalgalite/trace_tap.rb
+          amalgalite/profile_tap.rb
+          amalgalite/type_map.rb
+          amalgalite/type_maps/storage_map.rb
+          amalgalite/type_maps/text_map.rb
+          amalgalite/type_maps/default_map.rb
+          amalgalite/database.rb
+          amalgalite/index.rb
+          amalgalite/paths.rb
+          amalgalite/table.rb
+          amalgalite/view.rb
+          amalgalite/schema.rb
+          amalgalite/version.rb
+          amalgalite/sqlite3/version.rb
+          amalgalite/sqlite3/constants.rb
+          amalgalite/sqlite3/status.rb
+          amalgalite/sqlite3/database/status.rb
+          amalgalite/sqlite3.rb
+          amalgalite/taps/io.rb
+          amalgalite/taps/console.rb
+          amalgalite/taps.rb
+          amalgalite/packer.rb
+          amalgalite/core_ext/kernel/require.rb
+          amalgalite/requires.rb
+        ]
+      end
     end
 
     # 
     # Create a new packer instance with the list of items to pack and all the
     # options
+    #
     def initialize(  options = {} )
-      @options        = Packer.default_options.merge( options )
-      @dbfile         = options[:dbfile] || Amalgalite::Requires::Bootstrap::DEFAULT_DB
+      @options = Packer.default_options.merge( options )
+      @dbfile  = @options[:dbfile] || Requires::Bootstrap::DEFAULT_DB
     end
 
     # 
@@ -63,6 +125,7 @@ module Amalgalite
 
     end
 
+
     #
     # Stores all the .rb files in the list into the given database.  The prefix
     # is the file system path to remove from the front of the path on each file
@@ -90,7 +153,7 @@ module Amalgalite
               contents = contents.join
 
               if options[:compressed] then
-                contents = Requires.gzip( contents )
+                contents = Packer.gzip( contents )
               end
               content_io = StringIO.new( contents )
               stmt.execute( &quot;$filename&quot;   =&gt; file_info.require_path,
@@ -123,10 +186,10 @@ module Amalgalite
     #
     def make_manifest( file_list )
       manifest = []
-      prefix_path = Pathname.new( options[:strip_prefix] )
+      prefix_path = ::Pathname.new( options[:strip_prefix] )
       file_list.each do |f|
-        file_path = Pathname.new( File.expand_path( f ) )
-        m = OpenStruct.new
+        file_path = ::Pathname.new( File.expand_path( f ) )
+        m = ::OpenStruct.new
         # if it is a directory then grab all the .rb files from it
         if File.directory?( file_path ) then
           manifest.concat( make_manifest( Dir.glob( File.join( f, &quot;**&quot;, &quot;*.rb&quot; ) ) ) )</diff>
      <filename>lib/amalgalite/packer.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,6 @@
 require 'amalgalite'
 require 'pathname'
+require 'zlib'
 
 module Amalgalite
   #
@@ -14,6 +15,20 @@ module Amalgalite
         @load_path ||= []
       end
 
+      #
+      # Global option to say whether to fall back to the original ruby requires
+      # or not
+      def fallback_to_ruby_requires
+        @fallback_to_ruby_requires ||= true
+      end
+
+      #
+      # Set whether or not to fallback to the original ruby requires or not.
+      #
+      def fallback_to_ruby_requires=( fallback )
+        @fallback_to_ruby_requires = fallback
+      end
+
       def db_connection_to( dbfile_name )
         unless connection = load_path_db_connections[ dbfile_name ] 
           connection = ::Amalgalite::Database.new( dbfile_name )
@@ -31,42 +46,23 @@ module Amalgalite
       end
 
       def default_dbfile_name
-        &quot;lib.db&quot;
+        Bootstrap::DEFAULT_DB
       end
 
       def default_table_name
-        &quot;rubylibs&quot;
+        Bootstrap::DEFAULT_TABLE
       end
 
       def default_filename_column
-        &quot;filename&quot;
+        Bootstrap::DEFAULT_FILENAME_COLUMN
       end
 
       def default_compressed_column
-        &quot;compressed&quot;
+        Bootstrap::DEFAULT_COMPRESSED_COLUMN
       end
 
       def default_contents_column
-        &quot;contents&quot;
-      end
-
-      # 
-      # uncompress gzip data
-      #
-      def gunzip( data )
-        data = StringIO.new( data )
-        Zlib::GzipReader.new( data ).read
-      end
-
-      #
-      # compress data
-      #
-      def gzip( data )
-        zipped = StringIO.new
-        Zlib::GzipWriter.wrap( zipped ) do |io|
-          io.write( data )
-        end
-        return zipped.string
+        Bootstrap::DEFAULT_CONTENTS_COLUMN
       end
 
       def require( filename )
@@ -89,44 +85,7 @@ module Amalgalite
         end
       end
 
-      #
-      # return the files in their dependency order for use for packing into a
-      # database
-      #
-      def require_order
-        @require_roder ||= %w[
-          amalgalite.rb
-          amalgalite/blob.rb
-          amalgalite/boolean.rb
-          amalgalite/column.rb
-          amalgalite/statement.rb
-          amalgalite/trace_tap.rb
-          amalgalite/profile_tap.rb
-          amalgalite/type_map.rb
-          amalgalite/type_maps/storage_map.rb
-          amalgalite/type_maps/text_map.rb
-          amalgalite/type_maps/default_map.rb
-          amalgalite/database.rb
-          amalgalite/index.rb
-          amalgalite/paths.rb
-          amalgalite/table.rb
-          amalgalite/view.rb
-          amalgalite/schema.rb
-          amalgalite/version.rb
-          amalgalite/sqlite3/version.rb
-          amalgalite/sqlite3/constants.rb
-          amalgalite/sqlite3/status.rb
-          amalgalite/sqlite3/database/status.rb
-          amalgalite/sqlite3.rb
-          amalgalite/taps/io.rb
-          amalgalite/taps/console.rb
-          amalgalite/taps.rb
-          amalgalite/core_ext/kernel/require.rb
-          amalgalite/requires.rb
-          amalgalite/packer.rb
-       ]
-     end
-    end
+   end
 
     attr_reader :dbfile_name
     attr_reader :table_name
@@ -136,11 +95,11 @@ module Amalgalite
     attr_reader :db_connection
 
     def initialize( opts = {} )
-      @dbfile_name       = opts[:dbfile_name]       || Requires.default_dbfile_name
-      @table_name        = opts[:table_name]        || Requires.default_table_name
-      @filename_column   = opts[:filename_column]   || Requires.default_filename_column
-      @contents_column   = opts[:contents_column]   || Requires.default_contents_column
-      @compressed_column = opts[:compressed_column] || Requires.default_compressed_column
+      @dbfile_name       = opts[:dbfile_name]       || Bootstrap::DEFAULT_DB
+      @table_name        = opts[:table_name]        || Bootstrap::DEFAULT_TABLE
+      @filename_column   = opts[:filename_column]   || Bootstrap::DEFAULT_FILENAME_COLUMN
+      @contents_column   = opts[:contents_column]   || Bootstrap::DEFAULT_CONTENTS_COLUMN
+      @compressed_column = opts[:compressed_column] || Bootstrap::DEFAULT_COMPRESSED_COLUMN
       @db_connection   = Requires.db_connection_to( dbfile_name )
       Requires.load_path &lt;&lt; self
     end</diff>
      <filename>lib/amalgalite/requires.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,10 +5,10 @@ describe &quot;Amalgalite::SQLite3::Version&quot; do
   it &quot;should have the sqlite3 version&quot; do
     Amalgalite::SQLite3::VERSION.should =~ /\d\.\d\.\d/
     Amalgalite::SQLite3::Version.to_s.should =~ /\d\.\d\.\d/
-    Amalgalite::SQLite3::Version.to_i.should == 3006004
+    Amalgalite::SQLite3::Version.to_i.should == 3006005
     Amalgalite::SQLite3::Version::MAJOR.should == 3
     Amalgalite::SQLite3::Version::MINOR.should == 6
-    Amalgalite::SQLite3::Version::RELEASE.should == 4
+    Amalgalite::SQLite3::Version::RELEASE.should == 5
     Amalgalite::SQLite3::Version.to_a.should have(3).items
   end
 end</diff>
      <filename>spec/sqlite3/version_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -44,14 +44,14 @@ Configuration.for('packaging') {
   formats {
     tgz true
     zip true
-    gem Configuration::Table.has_key?('gem')
+    rubygem  Configuration::Table.has_key?('rubygem')
   }
 }
 
 #-----------------------------------------------------------------------
 # Gem packaging
 #-----------------------------------------------------------------------
-Configuration.for(&quot;gem&quot;) {
+Configuration.for(&quot;rubygem&quot;) {
   spec &quot;gemspec.rb&quot;
   Configuration.for('packaging').files.all &lt;&lt; spec
 }</diff>
      <filename>tasks/config.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>97cbdf0edd03ec03afaebd771c63a5aa12a39088</id>
    </parent>
  </parents>
  <author>
    <name>Jeremy Hinegardner</name>
    <email>jeremy@hinegardner.org</email>
  </author>
  <url>http://github.com/copiousfreetime/amalgalite/commit/9103ecebd07ee4f04fdf07c1b137bca15b7e7b83</url>
  <id>9103ecebd07ee4f04fdf07c1b137bca15b7e7b83</id>
  <committed-date>2008-11-16T14:43:32-08:00</committed-date>
  <authored-date>2008-11-16T14:43:32-08:00</authored-date>
  <message>Refactor gzip, gunzip and amalgalite require files list into packer

* added DEFAULT_BOOTSTRAP_DB constant
* updated examples
* added packer tests</message>
  <tree>b94d22a3837e340284c9e577a44d5bc29e629c8c</tree>
  <committer>
    <name>Jeremy Hinegardner</name>
    <email>jeremy@hinegardner.org</email>
  </committer>
</commit>
