gitlab-org--gitlab-foss/lib/gitlab/plugin.rb
Dmitriy Zaporozhets 5bb435d0e7 Remove plugin initializer and add plugins:validate rake task
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2018-02-26 16:06:49 +02:00

25 lines
715 B
Ruby

module Gitlab
module Plugin
def self.all
files.map do |file|
file_name = File.basename(file, '.rb')
# Just give sample data to method and expect it to not crash.
begin
klass = Object.const_get(file_name.classify)
klass.new.execute(Gitlab::DataBuilder::Push::SAMPLE_DATA)
rescue => e
Rails.logger.warn("GitLab -> Plugins -> #{file_name} raised an exception during boot check. #{e}")
next
else
Rails.logger.info "GitLab -> Plugins -> #{file_name} passed validation check"
klass
end
end
end
def self.files
Dir.glob(Rails.root.join('plugins', '*_plugin.rb'))
end
end
end