public
Rubygem
Description: Let Merb apps load Rails model plugins from plugins/
Clone URL: git://github.com/ivey/merb_has_rails_plugins.git
Tweaked configuration options to closer reflect ivey's original defaults.
fractious (author)
Mon Jun 30 10:17:08 -0700 2008
commit  f4e98331686deb2f2177c03a1c20fcd03b1bea26
tree    2b61b2fa9034a48aa36ee631117cf875e0137679
parent  856d935f8c2f32a3c6915897f596441dfa774856
0
...
11
12
13
14
15
16
17
 
 
 
 
18
19
...
11
12
13
 
 
 
 
14
15
16
17
18
19
0
@@ -11,9 +11,9 @@ Please send bug reports to Michael Ivey directly for the time being:
0
 Repo forked by fractious to provide configuration options:
0
 
0
 Merb::Plugins.config[:merb_has_rails_plugins]
0
- :rails_env - Rails environment - probably want to leave this as the default
0
- :rails_root - Path to your rails root
0
- :plugins_root - Path to your rails plugins directory
0
- :only - Optional array of the subset of plugins you want to load i.e. ['acts_as_hasselhoff', 'foo_fu']
0
+ :rails_env - Rails environment - probably want to leave this as the default: Merb.env
0
+ :rails_root - Path to your rails root (you may want to set this if your running a merb app within a rails app)
0
+ :plugins_root - Path to your rails plugins directory. Defaults to Merb.root / 'plugins'
0
+ :only - Optional array of the subset of plugins you want to load i.e. ['acts_as_hasselhoff', 'foo_fu']
0
 
0
 
...
1
2
3
4
5
6
 
 
 
7
8
9
10
11
12
 
 
 
13
14
15
16
 
17
18
19
 
20
21
22
...
24
25
26
27
28
29
30
...
1
2
3
 
 
 
4
5
6
7
8
9
 
 
 
10
11
12
13
 
14
 
15
16
 
17
18
19
20
21
...
23
24
25
 
26
27
28
0
@@ -1,22 +1,21 @@
0
 # make sure we're running inside Merb
0
 if defined?(Merb::Plugins)
0
 
0
- # :rails_env - Rails environment - probably want to leave this as the default
0
- # :rails_root - Path to your rails root
0
- # :plugins_root - Path to your rails plugins directory
0
+ # :rails_env - Rails environment - probably want to leave this as the default: Merb.env
0
+ # :rails_root - Path to your rails root (you may want to set this if your running a merb app within a rails app)
0
+ # :plugins_root - Path to your rails plugins directory. Defaults to Merb.root / 'plugins'
0
   # :only - Optional array of the subset of plugins you want to load i.e. ['acts_as_hasselhoff', 'foo_fu']
0
   defaults = {
0
    :rails_env => Merb.env,
0
- :rails_root => Merb.root / '..',
0
- :plugins_root => Merb.root / '..' / 'vendor' / 'plugins',
0
- :only => nil,
0
+ :rails_root => nil,
0
+ :plugins_root => Merb.root / 'plugins',
0
+ :only => nil,
0
   }
0
-
0
   config = Merb::Plugins.config[:merb_has_rails_plugins]
0
- config = defaults.merge config
0
+ config = defaults.merge(config)
0
    
0
- RAILS_ROOT = config[:rails_root] unless defined?(RAILS_ROOT)
0
   RAILS_ENV = config[:rails_env] unless defined?(RAILS_ENV)
0
+ RAILS_ROOT = config[:rails_root] if config[:rails_root] && !defined?(RAILS_ROOT)
0
   
0
   Merb.logger.info "loading rails plugins from '#{config[:plugins_root]}' ..."
0
   Dir[config[:plugins_root] / '*'].each do |dir|
0
@@ -24,7 +23,6 @@ if defined?(Merb::Plugins)
0
     if config[:only].blank? || config[:only].include?(plugin)
0
       Merb.logger.info "loading rails plugin '#{plugin}' ..."
0
       plugin_init, plugin_lib = dir / 'init.rb', dir / 'lib'
0
-
0
        if File.directory?(plugin_lib)
0
         if defined?(ActiveSupport)
0
         Dependencies.load_paths << plugin_lib

Comments

    No one has commented yet.