summaryrefslogtreecommitdiff
path: root/lib/gitlab/plugin.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-02-19 19:55:54 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2018-02-26 16:06:49 +0200
commiteff5746b5e7cf4075edd6d1c76fdcd24c1603bb4 (patch)
tree368bb9935f8cf3f6cbcf20c48c9f48e3456a96a2 /lib/gitlab/plugin.rb
parent5bb435d0e75ad84e2fc379208cc36a25a4574453 (diff)
downloadgitlab-ce-eff5746b5e7cf4075edd6d1c76fdcd24c1603bb4.tar.gz
Redesign plugins system
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
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