Class: Milkshake::Extender
- Inherits:
-
Object
- Object
- Milkshake::Extender
- Defined in:
- lib/milkshake/extender.rb
Instance Method Summary collapse
-
#extend_boot! ⇒ Object
for others.
- #extend_frameworks! ⇒ Object
-
#extend_rails! ⇒ Object
for passenger.
- #extend_railties! ⇒ Object
- #extend_rubygems! ⇒ Object
- #inject_milkshake! ⇒ Object
Instance Method Details
#extend_boot! ⇒ Object
for others
33 34 35 36 |
# File 'lib/milkshake/extender.rb', line 33 def extend_boot! include_module Rails::VendorBoot, Milkshake::RailsExtentions::VendorBoot include_module Rails::GemBoot, Milkshake::RailsExtentions::GemBoot end |
#extend_frameworks! ⇒ Object
43 44 45 |
# File 'lib/milkshake/extender.rb', line 43 def extend_frameworks! include_module ActiveRecord::Migrator, Milkshake::RailsExtentions::Migrator end |
#extend_rails! ⇒ Object
for passenger
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/milkshake/extender.rb', line 15 def extend_rails! Object.const_set('Rails', Module.new) rails_mod = Object.const_get('Rails') def rails_mod.singleton_method_added(meth) if (meth.to_s == 'boot!') and !@injected_milkshake @injected_milkshake = true klass = (class << self ; self ; end) klass.send :alias_method, "milkshakeless_#{meth}", meth klass.send :define_method, meth do milkshakeless_boot! Milkshake.load! Milkshake.extender.extend_railties! end end end end |
#extend_railties! ⇒ Object
38 39 40 41 |
# File 'lib/milkshake/extender.rb', line 38 def extend_railties! include_module Rails::Configuration, Milkshake::RailsExtentions::Configuration include_module Rails::Initializer, Milkshake::RailsExtentions::Initializer end |
#extend_rubygems! ⇒ Object
47 48 49 |
# File 'lib/milkshake/extender.rb', line 47 def extend_rubygems! include_module Gem::Specification, Milkshake::RubygemsExtentions::Specification end |
#inject_milkshake! ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/milkshake/extender.rb', line 5 def inject_milkshake! if defined?(::PhusionPassenger) extend_rails! else extend_boot! end extend_rubygems! end |