fluke/devops-service/core/devops-loader.rb

35 lines
669 B
Ruby
Raw Normal View History

2014-12-22 14:22:04 +03:00
module Devops
module Loader
2015-01-27 13:18:26 +03:00
class << self
2015-06-30 14:27:42 +03:00
def prepare_plugins
2018-04-04 22:44:39 +03:00
plugins.each do |plugin|
2015-06-30 14:27:42 +03:00
plugin.prepare
end
end
def init_plugins
2018-04-04 22:44:39 +03:00
plugins.each do |plugin|
2015-02-06 17:21:13 +03:00
plugin.init
end
end
2015-01-27 13:18:26 +03:00
2015-02-06 17:21:13 +03:00
def routes
2018-04-04 22:44:39 +03:00
plugins.each do |plugin|
2015-02-06 17:21:13 +03:00
plugin.routes
end
end
def plugins &block
2018-04-04 22:44:39 +03:00
return @plugins if @plugins
2015-01-27 13:18:26 +03:00
if defined?(Devops::Plugin)
2018-04-04 22:44:39 +03:00
@plugins = Devops::Plugin.constants.collect{|s| Devops::Plugin.const_get(s)}.select {|const| const.class == Module}
puts @plugins.inspect
@plugins
2014-12-22 14:22:04 +03:00
end
end
2015-02-06 17:21:13 +03:00
2014-12-22 14:22:04 +03:00
end
end
end