Browse files

Combine -r and -L load commands to execute in order

Previously, -r files would be loaded before the DB constant was
established.  Now, it holds the information in the same data
structure as the -L option, which enables it to be loaded in
the same order.  So if you specify -L before -r, the -L dir will
be loaded before the -r dir is required, and vice versa.
  • Loading branch information...
1 parent 7811c62 commit 05c66330e5027a97a478c1c1a4c115b2aafc7084 @jeremyevans committed Feb 14, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 bin/sequel
4 bin/sequel
@@ -78,7 +78,7 @@ opts = do |opts|
opts.on("-r", "--require lib", "require the library, before executing your script") do |v|
- require v
+ load_dirs << [v]
opts.on("-t", "--trace", "Output the full backtrace if an exception is raised") do
@@ -132,7 +132,7 @@ end
DB = connect_proc[db]
- load_dirs.each{|d| Dir["#{d}/**/*.rb"].each{|f| load(f)}}
+ load_dirs.each{|d| d.is_a?(Array) ? require(d.first) : Dir["#{d}/**/*.rb"].each{|f| load(f)}}
if migrate_dir
Sequel.extension :migration
Sequel::Migrator.apply(DB, migrate_dir, migrate_ver)

0 comments on commit 05c6633

Please sign in to comment.