blob: f2c58ef4e0eaaf407b90b69ffc72034de5db28e0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
require 'rails/initializable'
require 'rails/configuration'
require 'active_support/inflector'
module Rails
class Railtie
autoload :Configurable, "rails/railtie/configurable"
autoload :Configuration, "rails/railtie/configuration"
include Initializable
ABSTRACT_RAILTIES = %w(Rails::Railtie Rails::Plugin Rails::Engine Rails::Application)
class << self
def subclasses
@subclasses ||= []
end
def inherited(base)
unless base.abstract_railtie?
base.send(:include, self::Configurable)
subclasses << base
end
end
def railtie_name(*)
ActiveSupport::Deprecation.warn "railtie_name is deprecated and has no effect", caller
end
def log_subscriber(name, log_subscriber)
Rails::LogSubscriber.add(name, log_subscriber)
end
def rake_tasks(&blk)
@rake_tasks ||= []
@rake_tasks << blk if blk
@rake_tasks
end
def generators(&blk)
@generators ||= []
@generators << blk if blk
@generators
end
def abstract_railtie?
ABSTRACT_RAILTIES.include?(name)
end
end
def rake_tasks
self.class.rake_tasks
end
def generators
self.class.generators
end
def load_tasks
rake_tasks.each { |blk| blk.call }
end
def load_generators
generators.each { |blk| blk.call }
end
end
end
|