C0 code coverage information
Generated on Sat Feb 02 17:44:24 +0100 2008 with rcov 0.8.1.2
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) 2008 Michael Fellinger m.fellinger@gmail.com
2 # All files in this distribution are subject to the terms of the Ruby license.
3
4 module Ramaze
5
6 # Loads and sets up contrib modules.
7 #
8 # For more information @see Ramaze::Contrib.load
9 #
10 # Usage:
11 #
12 # Ramaze.contrib :gzip_filter
13
14 def self.contrib(*args)
15 Ramaze::Contrib.load *args
16 end
17
18 # A module used for loading contrib modules.
19
20 module Contrib
21
22 # Loads and sets up contrib modules from /ramaze/contrib.
23 #
24 # === Usage:
25 #
26 # Ramaze::Contrib.load :gzip_filter
27 #
28 # === Creating a contrib module:
29 #
30 # module Ramaze::Contrib::Test
31 # def self.setup
32 # Inform.info "Test module set up"
33 # end
34 # end
35 # class TestController < Ramaze::Controller
36 # map '/test'
37 # def index; "Chunky Bacon!"; end
38 # end
39 #
40 # # Save that to your <app dir>/contrib and use like:
41 # Ramaze.contrib :test
42
43 def self.load(*contribs)
44 contribs.each do |name|
45 mod_name = name.to_s.camel_case
46 begin
47 const = Ramaze::Contrib.const_get(mod_name)
48 Ramaze::Global.contribs << const
49 const.startup if const.respond_to?(:startup)
50 Inform.dev "Loaded contrib: #{const}"
51 rescue NameError
52 files = Dir["{contrib,#{BASEDIR/:ramaze/:contrib}}/#{name}.{so,bundle,rb}"]
53 raise LoadError, "#{mod_name} not found" unless files.any?
54 require(files.first) ? retry : raise
55 end
56 end
57 end
58
59 # Will call .shutdown on all contrib modules which support it.
60 #---
61 # .shudown gets called by Ramaze :essentials.
62 #+++
63
64 def self.shutdown
65 Ramaze::Global.contribs.each do |contrib|
66 contrib.shutdown if contrib.respond_to?(:shutdown)
67 end
68 end
69
70 # Will load all contrib modules from options[:contrib]
71 #---
72 # .startup gets called by Ramaze :essentials.
73 #+++
74
75 def self.startup(options = {})
76 return unless options[:contrib]
77 [options[:contrib]].flatten.each do |contrib|
78 load(contrib)
79 end
80 end
81 end # class Contrib
82 end # class Ramaze
Generated using the rcov code coverage analysis tool for Ruby version 0.8.1.2.