summaryrefslogtreecommitdiff
path: root/lib/gitlab/plugin.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/plugin.rb')
-rw-r--r--lib/gitlab/plugin.rb30
1 files changed, 14 insertions, 16 deletions
diff --git a/lib/gitlab/plugin.rb b/lib/gitlab/plugin.rb
index cbc57a5cce3..9604cac4b20 100644
--- a/lib/gitlab/plugin.rb
+++ b/lib/gitlab/plugin.rb
@@ -1,25 +1,23 @@
module Gitlab
module Plugin
- def self.all
- files.map do |file|
- file_name = File.basename(file, '.rb')
+ def self.files
+ Dir.glob(Rails.root.join('plugins', '*_plugin.rb'))
+ end
- # 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
+ def self.execute_all_async(data)
+ files.each do |file|
+ PluginWorker.perform_async(file, data)
end
end
- def self.files
- Dir.glob(Rails.root.join('plugins', '*_plugin.rb'))
+ def self.execute(file, data)
+ # TODO: Implement
+ #
+ # Reuse some code from gitlab-shell https://gitlab.com/gitlab-org/gitlab-shell/blob/master/lib/gitlab_custom_hook.rb#L40
+ # Pass data as STDIN (or JSON encode?)
+ #
+ # 1. Return true if 0 exit code
+ # 2. Return false if non-zero exit code
end
end
end