Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/ci/build/hook.rb')
-rw-r--r--lib/gitlab/ci/build/hook.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/gitlab/ci/build/hook.rb b/lib/gitlab/ci/build/hook.rb
new file mode 100644
index 00000000000..b731228678c
--- /dev/null
+++ b/lib/gitlab/ci/build/hook.rb
@@ -0,0 +1,24 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Ci
+ module Build
+ class Hook
+ attr_reader :name, :script
+
+ class << self
+ def from_hooks(job)
+ job.options[:hooks].to_a.map do |name, script|
+ new(name.to_s, script)
+ end
+ end
+ end
+
+ def initialize(name, script)
+ @name = name
+ @script = script
+ end
+ end
+ end
+ end
+end