C0 code coverage information
Generated on Tue Oct 16 11:40:54 -0400 2007 with rcov 0.8.0
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
1 # Copyright (C) 2004-2006 Laurent Sansonetti
2 #
3 # Alexandria is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License as
5 # published by the Free Software Foundation; either version 2 of the
6 # License, or (at your option) any later version.
7 #
8 # Alexandria is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public
14 # License along with Alexandria; see the file COPYING. If not,
15 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 # Boston, MA 02111-1307, USA.
17
18 module Alexandria
19 class WebTheme
20 attr_reader :name, :css_file, :preview_file, :pixmaps_directory
21
22 def self.all
23 themes_dir = [
24 # System dir
25 File.join(Alexandria::Config::DATA_DIR, "web-themes"),
26
27 # User dir
28 File.join(ENV['HOME'], '.alexandria', '.web-themes')
29 ]
30 themes_dir.map { |x| self.load(x) }.flatten
31 end
32
33 def has_pixmaps?
34 File.exists?(@pixmaps_directory)
35 end
36
37 #######
38 private
39 #######
40
41 def self.load(themes_dir)
42 themes = []
43 if File.exists?(themes_dir)
44 Dir.entries(themes_dir).each do |file|
45 # ignore hidden files
46 next if file =~ /^\./
47 # ignore non-directories
48 path = File.join(themes_dir, file)
49 next unless File.directory?(path)
50 # ignore CVS directories
51 next if file == 'CVS'
52
53 css_file = File.join(path, file + ".css")
54 preview_file = File.join(path, "preview.jpg")
55 [css_file, preview_file].each do |file|
56 raise "#{file} not found" unless File.exists?(file)
57 end
58 themes << WebTheme.new(css_file, preview_file,
59 File.join(path, file, "pixmaps"))
60 end
61 else
62 FileUtils.mkdir_p(themes_dir)
63 end
64 return themes
65 end
66
67 def initialize(css_file, preview_file, pixmaps_directory)
68 @name = File.basename(css_file, ".css").capitalize
69 @css_file = css_file
70 @preview_file = preview_file
71 @pixmaps_directory = pixmaps_directory
72 end
73 end
74 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.