Changeset 180

Show
Ignore:
Timestamp:
01/06/2007 12:45:38 (23 months ago)
Author:
why
Message:
  • lib/camping.rb: added query-string building to R().
  • lib/camping-unabridged.rb: ditto.
  • lib/camping/reloader.rb: that sqlite3 message is appearing when other drivers are used with the reloader.
Location:
trunk/lib
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/lib/camping-unabridged.rb

    r179 r180  
    204204    # 
    205205    def R(c,*g) 
    206       p=/\(.+?\)/ 
    207       g.inject(c.urls.find{|x|x.scan(p).size==g.size}.dup){|s,a| 
     206      p,h=/\(.+?\)/,g.grep(Hash) 
     207      (g-=h).inject(c.urls.find{|x|x.scan(p).size==g.size}.dup){|s,a| 
    208208        s.sub p,C.escape((a[a.class.primary_key]rescue a)) 
    209       } 
     209      }+(h.any?? "?"+h[0].map{|x|x.map{|z|C.escape z}*"="}*"&": "") 
    210210    end 
    211211 
  • trunk/lib/camping.rb

    r179 r180  
    11%w[active_support markaby tempfile uri].map{|l|require l} 
    22module Camping;Apps=[];C=self;S=IO.read(__FILE__).sub(/S=I.+$/,'') 
    3 P="Cam\ping Problem!";module Helpers;def R c,*g;p=/\(.+?\)/;g.inject(c. 
    4 urls.find{|x|x.scan(p).size==g.size}.dup){|s,a|s.sub p,C.escape((a[ 
    5 a.class.primary_key]rescue a))}end;def URL c='/',*a;c=R(c,*a)if c. 
     3P="Cam\ping Problem!";module Helpers;def R(c,*g);p,h=/\(.+?\)/,g.grep(Hash) 
     4(g-=h).inject(c.urls.find{|x|x.scan(p).size==g.size}.dup){|s,a|s.sub p,C. 
     5escape((a[a.class.primary_key]rescue a))}+(h.any?? "?"+h[0].map{|x|x.map{|z|C. 
     6escape z}*"="}*"&": "")end;def URL c='/',*a;c=R(c,*a)if c. 
    67respond_to?:urls;c=self/c;c="//"+@env.HTTP_HOST+c if c[/^\//];URI(c)end;def/p 
    78p[/^\//]?@root+p : p end;def errors_for o;ul.errors{o.errors.each_full{|x|li x} 
  • trunk/lib/camping/reloader.rb

    r164 r180  
    147147                end 
    148148 
    149                 begin 
    150                     Camping::Models::Session.create_schema 
    151                 rescue MissingSourceFile 
    152                     puts "** #$0 stopped: SQLite3 not found, please install." 
    153                     puts "** See http://code.whytheluckystiff.net/camping/wiki/BeAlertWhenOnSqlite3 for instructions." 
    154                     exit 
    155                 end 
     149                Camping::Models::Session.create_schema 
    156150 
    157151                if @database and @database[:adapter] == 'sqlite3'