Sha256: 7537c5cea90070545306696476f0d911909f30011184d5d6ca154610322b64ea
Contents?: true
Size: 1.48 KB
Versions: 8
Compression:
Stored size: 1.48 KB
Contents
module Milkshake class Extender def inject_milkshake! if defined?(::PhusionPassenger) extend_rails! else extend_boot! end extend_rubygems! end # for passenger def extend_rails! Object.const_set('Rails', Module.new) r = Object.const_get('Rails') def r.singleton_method_added(m) if (m.to_s == 'boot!') and !@injected_milkshake @injected_milkshake = true k = (class << self ; self ; end) k.send :alias_method, "milkshakeless_#{m}", m k.send :define_method, m do milkshakeless_boot! Milkshake.load! Milkshake.extender.extend_railties! end end end end # for others def extend_boot! include_module Rails::VendorBoot, Milkshake::RailsExtentions::VendorBoot include_module Rails::GemBoot, Milkshake::RailsExtentions::GemBoot end def extend_railties! include_module Rails::Configuration, Milkshake::RailsExtentions::Configuration include_module Rails::Initializer, Milkshake::RailsExtentions::Initializer end def extend_frameworks! include_module ActiveRecord::Migrator, Milkshake::RailsExtentions::Migrator end def extend_rubygems! include_module Gem::Specification, Milkshake::RubygemsExtentions::Specification end private def include_module(base, mod) base.send :include, mod end end end
Version data entries
8 entries across 8 versions & 1 rubygems