Sha256: 5d48806344d826353c0f72002488593639a0cad72d45c7e42713b7b35d9feede
Contents?: true
Size: 1.34 KB
Versions: 4
Compression:
Stored size: 1.34 KB
Contents
require 'annotatable' require 'simpleton' require 'radiant/admin_ui' module Radiant class Extension include Simpleton include Annotatable annotate :version, :description, :url, :root, :extension_name attr_writer :active def active? @active end def migrations_path File.join(self.root, 'db', 'migrate') end def migrator unless @migrator extension = self @migrator = Class.new(ExtensionMigrator){ self.extension = extension } end @migrator end def admin AdminUI.instance end class << self def activate_extension return if instance.active? instance.activate if instance.respond_to? :activate ActionController::Routing::Routes.reload instance.active = true end alias :activate :activate_extension def deactivate_extension return unless instance.active? instance.active = false instance.deactivate if instance.respond_to? :deactivate end alias :deactivate :deactivate_extension def define_routes(&block) route_definitions << block end def inherited(subclass) subclass.extension_name = subclass.name.to_name('Extension') end def route_definitions @route_definitions ||= [] end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
radiant-0.7.2 | lib/radiant/extension.rb |
radiant-0.7.0 | lib/radiant/extension.rb |
radiant-0.8.0 | lib/radiant/extension.rb |
radiant-0.7.1 | lib/radiant/extension.rb |