blob: ff28ade35d5b816c6920ecefab41ddf2a0bf4dca (
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
|
module Rails
class Railtie
include Initializable
def self.plugin_name(plugin_name = nil)
@plugin_name ||= name.demodulize.underscore
@plugin_name = plugin_name if plugin_name
@plugin_name
end
def self.inherited(klass)
@plugins ||= []
@plugins << klass unless klass == Plugin
end
def self.plugins
@plugins
end
def self.plugin_names
plugins.map { |p| p.plugin_name }
end
def self.config
Configuration.default
end
def self.rake_tasks(&blk)
@rake_tasks ||= []
@rake_tasks << blk if blk
@rake_tasks
end
def rake_tasks
self.class.rake_tasks
end
def load_tasks
return unless rake_tasks
rake_tasks.each { |blk| blk.call }
end
end
end
|