public
Rubygem
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/wycats/merb-core.git
Search Repo:
remove Kernel#requires it wasn't being used.
get erubis compiled methods to take a locals={} hash in prep for hash as 
locals.
ezmobius (author)
Sun Mar 23 15:07:39 -0700 2008
commit  312181aade867323834c5031b7e9707f931e9ded
tree    6280af600d4c35194850e2d3476d431de40c1d54
parent  142d85ca7cf7c7a4f5a93b09be12978b39059125
...
198
199
200
201
 
202
203
204
...
198
199
200
 
201
202
203
204
0
@@ -198,7 +198,7 @@
0
     def def_method(object, method_name, filename=nil)
0
       m = object.is_a?(Module) ? :module_eval : :instance_eval
0
       setup = "@_engine = 'erb'"
0
- object.__send__(m, "def #{method_name}; #{setup}; #{@src}; end", filename || @filename || '(erubis)')
0
+ object.__send__(m, "def #{method_name}(locals={}); #{setup}; #{@src}; end", filename || @filename || '(erubis)')
0
     end
0
    
0
   end
...
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
...
89
90
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
93
94
0
@@ -89,30 +89,6 @@
0
       end
0
     end
0
   end
0
-
0
- # Attempts to require and logs a message of the require whether it is
0
- # successful or not.
0
- #
0
- # ==== Parameters
0
- # library<~to_s>:: The library to attempt to require.
0
- def requires(library)
0
- # TODO: Extract messages out into a messages file. This will also be the first step towards internationalization.
0
- # TODO: adjust this message once logging refactor is complete.
0
- require(library)
0
- message = "loading library '#{library}' from #{__app_file_trace__.first} ..."
0
- Merb.logger.debug(message)
0
- rescue LoadError
0
- # TODO: adjust the two messages below to use merb's logger.error/info once logging refactor is complete.
0
- message = "<e> Could not find '#{library}' as either a library or gem, loaded from #{__app_file_trace__.first}.\n"
0
- Merb.logger.error(message)
0
-
0
- # Print a helpful message
0
- message = " <i> Please be sure that if '#{library}': \n"
0
- message << " <i> * is a normal ruby library (file), be sure that the path of the library it is present in the $LOAD_PATH via $LOAD_PATH.unshift(\"/path/to/#{library}\") \n"
0
- message << " <i> * is included within a gem, be sure that you are specifying the gem as a dependency \n"
0
- Merb.logger.error(message)
0
- exit # Missing library/gem must be addressed.
0
- end
0
   
0
   # Does a basic require, and prints a message if an error occurs.
0
   #
...
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
...
13
14
15
 
 
 
 
 
 
 
 
16
 
 
 
 
 
 
17
18
19
0
@@ -13,21 +13,7 @@
0
     Merb.logger.should_receive(:error!).with("foo")
0
     Kernel.rescue_require("redcloth", "foo")
0
   end
0
-
0
- it "should be able to require files and throw a VERY useful error message if it fails" do
0
- Kernel.should_receive(:require).and_raise(LoadError)
0
- Kernel.should_receive(:exit).and_return(true)
0
- Merb.logger.should_receive(:error).once.with(/Could not find/)
0
- Merb.logger.should_receive(:error).once.with(/Please be sure/)
0
- Kernel.requires "foo"
0
- end
0
 
0
- it "should be able to require files and print a succeed message if it passes" do
0
- Kernel.should_receive(:require).and_return(true)
0
- Merb.logger.should_receive(:debug).with(/loading library 'foo'/)
0
- Kernel.requires "foo"
0
-
0
- end
0
   
0
 end
0
 

Comments

    No one has commented yet.