Module: Merb::Plugins
- Defined in:
- lib/merb-core/plugins.rb
Class Method Summary collapse
-
.add_generators(*generators) ⇒ Object
Parameters *generators:: Generator paths to add to the list of plugin generators.
-
.add_rakefiles(*rakefiles) ⇒ Object
Parameters *rakefiles:: Rakefiles to add to the list of plugin Rakefiles.
-
.config ⇒ Object
Returns Hash:: The configuration loaded from Merb.root / “config/plugins.yml” or, if the load fails, an empty hash whose default value is another Hash.
-
.generators ⇒ Object
Returns Array(String):: All Generator load paths Merb uses for plugins.
-
.rakefiles ⇒ Object
Returns Array(String):: All Rakefile load paths Merb uses for plugins.
Class Method Details
.add_generators(*generators) ⇒ Object
Parameters
- *generators
-
Generator paths to add to the list of plugin generators.
Notes
This is the recommended way to register your plugin’s generators in Merb.
55 56 57 |
# File 'lib/merb-core/plugins.rb', line 55 def self.add_generators(*generators) Merb.add_generators *generators end |
.add_rakefiles(*rakefiles) ⇒ Object
44 45 46 |
# File 'lib/merb-core/plugins.rb', line 44 def self.add_rakefiles(*rakefiles) Merb.add_rakefiles *rakefiles end |
.config ⇒ Object
Returns
- Hash
-
The configuration loaded from Merb.root / “config/plugins.yml” or, if the load fails, an empty hash whose default value is another Hash.
9 10 11 12 13 14 15 16 |
# File 'lib/merb-core/plugins.rb', line 9 def self.config @config ||= begin # this is so you can do Merb.plugins.config[:helpers][:awesome] = "bar" config_hash = Hash.new {|h,k| h[k] = {}} file = Merb.root / "config" / "plugins.yml" config_hash.merge((File.exists?(file) && YAML.load_file(file)) || {}) end end |
.generators ⇒ Object
Returns
- Array(String)
-
All Generator load paths Merb uses for plugins.
26 27 28 |
# File 'lib/merb-core/plugins.rb', line 26 def self.generators Merb.generators end |