Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 13
- Log:
Initial import of Typo 2.6.0 sources from a downloaded Tarball.
Typo is a Ruby On Rails based blog engine.
- Author:
- adh
- Date:
- Sat Jul 22 22:25:02 +0100 2006
- Size:
- 1104 Bytes
1 | class Theme |
2 | cattr_accessor :cache_theme_lookup |
3 | @@cache_theme_lookup = false |
4 | |
5 | attr_accessor :name, :path |
6 | |
7 | def initialize(name, path) |
8 | @name, @path = name, path |
9 | end |
10 | |
11 | def layout |
12 | "../../themes/#{name}/layouts/default" |
13 | end |
14 | |
15 | def description |
16 | readme = File.read("#{path}/about.markdown") |
17 | HtmlEngine.transform(readme, "markdown smartypants") |
18 | end |
19 | |
20 | def self.themes_root |
21 | RAILS_ROOT + "/themes" |
22 | end |
23 | |
24 | def self.current_theme_path |
25 | "#{themes_root}/#{config[:theme]}" |
26 | end |
27 | |
28 | def self.current |
29 | theme_from_path(current_theme_path) |
30 | end |
31 | |
32 | def self.theme_from_path(path) |
33 | name = path.scan(/[-\w]+$/i).flatten.first |
34 | self.new(name, path) |
35 | end |
36 | |
37 | def self.find_all |
38 | installed_themes.inject([]) do |array, path| |
39 | array << theme_from_path(path) |
40 | end |
41 | end |
42 | |
43 | def self.installed_themes |
44 | cache_theme_lookup ? @theme_cache ||= search_theme_directory : search_theme_directory |
45 | end |
46 | |
47 | def self.search_theme_directory |
48 | Dir.glob("#{themes_root}/[-_a-zA-Z0-9]*").collect do |file| |
49 | file if File.directory?(file) |
50 | end.compact |
51 | end |
52 | end |