Changeset 214

Show
Ignore:
Timestamp:
09/23/2007 17:52:25 (15 months ago)
Author:
zimbatm
Message:

-50 octets gained by removing Camping::Apps.

Camping::Apps was only used by camping/db.rb. The array would also get filled
on each app reload, thus preventing the garbage collection of the old version.

Location:
trunk/lib
Files:
3 modified

Legend:

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

    r213 r214  
    9191  #   Camping::Apps # => [Blog, Tepee] 
    9292  #  
    93   Apps = [] 
    9493  C = self 
    9594  S = IO.read(__FILE__).sub(/^  S = I.+$/,'') 
     
    613612    # 
    614613    def goes(m) 
    615       eval S.gsub(/Camping/,m.to_s).gsub("A\pps = []","Cam\ping::Apps<<self"), TOPLEVEL_BINDING 
     614      eval S.gsub(/Camping/,m.to_s), TOPLEVEL_BINDING 
    616615    end 
    617616 
  • trunk/lib/camping.rb

    r213 r214  
    11%w[active_support markaby tempfile uri].map{|l|require l} 
    2 module Camping;Apps=[];C=self;S=IO.read(__FILE__).sub(/S=I.+$/,'') 
     2module Camping;C=self;S=IO.read(__FILE__).sub(/S=I.+$/,'') 
    33P="Cam\ping Problem!";module Helpers;def R(c,*g);p,h=/\(.+?\)/,g.grep(Hash) 
    44(g-=h).inject(c.urls.find{|x|x.scan(p).size==g.size}.dup){|s,a|s.sub p,C. 
     
    3636class ServerError<R();def get k,m,e;r(500,Mab.new{h1 P;h2"#{k}.#{m}";h3"#{e.class 
    3737} #{e.message}:";ul{e.backtrace.each{|bt|li(bt)}}}.to_s)end end;self;end;class<< 
    38 self;def goes m;eval S.gsub(/Camping/,m.to_s).gsub("A\pps=[]","Cam\ping::Apps<<\ 
    39 self"),TOPLEVEL_BINDING;end;def escape s;s.to_s.gsub(/[^ \w.-]+/n){'%'+($&. 
     38self;def goes m;eval S.gsub(/Camping/,m.to_s),TOPLEVEL_BINDING;end;def escape s 
     39s.to_s.gsub(/[^ \w.-]+/n){'%'+($&. 
    4040unpack('H2'*$&.size)*'%').upcase}.tr(' ','+')end;def un s;s.tr('+',' ').gsub( 
    4141/%([\da-f]{2})/in){[$1].pack('H*')}end;def qsp q,d='&;',y=nil,z=H[];m=proc{|_,o,n|o.u( 
  • trunk/lib/camping/db.rb

    r155 r214  
    7272  end 
    7373end 
    74 Camping::S.sub! "autoload:Base,'camping/db'", "" 
    75 Camping::S.sub! "def Y;self;end", $AR_EXTRAS 
    76 Camping::Apps.each do |app| 
    77     app::Models.module_eval $AR_EXTRAS 
     74Camping::S.sub! /autoload\s*:Base\s*,\s*['"]camping\/db['"]/, "" 
     75Camping::S.sub! /def\s*Y[;\s]*self[;\s]*end/, $AR_EXTRAS 
     76Object.constants.map{|c|Object.const_get(c)}.each do |c| 
     77  c::Models.module_eval $AR_EXTRAS if c.respond_to?(:run) 
    7878end