Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 1374 Bytes
1 | require File.dirname(__FILE__) + '/../lib/haml/template' |
2 | require 'rubygems' |
3 | require 'active_support' |
4 | require 'action_view' |
5 | require 'profiler' |
6 | require 'stringio' |
7 | |
8 | module Haml |
9 | # A profiler for HAML, mostly for development use. This simply implements |
10 | # the Ruby profiler for profiling HAML code. |
11 | class Profiler |
12 | |
13 | # Creates a new profiler that looks for templates in the base |
14 | # directory. |
15 | def initialize(base = File.join(File.dirname(__FILE__), 'templates')) |
16 | ActionView::Base.register_template_handler("haml", Haml::Template) |
17 | unless base.class == ActionView::Base |
18 | @base = ActionView::Base.new(base) |
19 | else |
20 | @base = base |
21 | end |
22 | end |
23 | |
24 | # Profiles HAML on the given template with the given number of runs. |
25 | # The template name shouldn't have a file extension; this will |
26 | # automatically look for a HAML template. |
27 | # |
28 | # Returns the results of the profiling as a string. |
29 | def profile(runs = 100, template_name = 'standard') |
30 | # Runs the profiler, collects information |
31 | Profiler__::start_profile |
32 | runs.times { @base.render template_name } |
33 | Profiler__::stop_profile |
34 | |
35 | # Outputs information to a StringIO, returns result |
36 | io = StringIO.new |
37 | Profiler__::print_profile(io) |
38 | io.pos = 0 |
39 | result = io.read |
40 | io.close |
41 | return result |
42 | end |
43 | |
44 | end |
45 | end |