From 1dc82b222117d868e988f2d11908962d9fc3baff Mon Sep 17 00:00:00 2001 From: _why Date: Tue, 11 Jul 2006 19:36:42 +0000 Subject: [PATCH] * lib/camping.rb: ActiveRecord no longer required, but uses `autoload` to load ActiveRecord to keep backwards. * lib/camping/db.rb: moved AR code here, support for other drivers will be here. * Rakefile: dropped activerecord dep, still have activesupport. --- Rakefile | 2 +- lib/camping.rb | 7 +++---- lib/camping/db.rb | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 lib/camping/db.rb diff --git a/Rakefile b/Rakefile index 30db642..c40e5c2 100644 --- a/Rakefile +++ b/Rakefile @@ -59,7 +59,7 @@ spec = s.homepage = 'http://code.whytheluckystiff.net/camping/' s.executables = ['camping'] - s.add_dependency('activerecord', '>=1.14.2') + s.add_dependency('activesupport', '>1.3.1') s.add_dependency('markaby', '>0.4') s.add_dependency('metaid') s.required_ruby_version = '>= 1.8.2' diff --git a/lib/camping.rb b/lib/camping.rb index 6284e82..034fd70 100644 --- a/lib/camping.rb +++ b/lib/camping.rb @@ -1,4 +1,4 @@ -%w[active_record markaby metaid tempfile uri].map{|l|require l} +%w[active_support markaby metaid tempfile uri].map{|l|require l} module Camping;Apps=[];C=self;S=IO.read(__FILE__).sub(/S=I.+$/,'') P="Cam\ping Problem!";module Helpers;def R c,*g;p=/\(.+?\)/;g.inject(c. urls.find{|x|x.scan(p).size==g.size}.dup){|s,a|s.sub p,C.escape((a[ @@ -45,9 +45,8 @@ def qs_parse q,d='&;';m=proc{|_,o,n|o.u(n,&m)rescue([*o ]||"GET")).service *a;rescue Exception=>x;X::ServerError.new(r,e,'get').service( k,m,x)end;def method_missing m,c,*a;k=X.const_get c;k.new('', H['HTTP_HOST','','SCRIPT_NAME','','HTTP_COOKIE',''],m.to_s).service *a;end -end;module Views;include X,Helpers end;module Models;A= -ActiveRecord;Base=A::Base;def Base.table_name_prefix;"#{name[/\w+/]}_". -downcase.sub(/^(#{A}|camping)_/i,'')end end;class Mab