summaryrefslogtreecommitdiff
path: root/lib/gitlab_post_receive.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab_post_receive.rb')
-rw-r--r--lib/gitlab_post_receive.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/gitlab_post_receive.rb b/lib/gitlab_post_receive.rb
index 9248582..cb9931d 100644
--- a/lib/gitlab_post_receive.rb
+++ b/lib/gitlab_post_receive.rb
@@ -8,18 +8,20 @@ require 'securerandom'
class GitlabPostReceive
include NamesHelper
- def initialize(gl_repository, repo_path, gl_id, changes)
+ attr_reader :config, :gl_repository, :repo_path, :changes, :jid
+
+ def initialize(gl_repository, repo_path, actor, changes)
@config = GitlabConfig.new
@gl_repository = gl_repository
@repo_path = repo_path.strip
- @gl_id = gl_id
+ @actor = actor
@changes = changes
@jid = SecureRandom.hex(12)
end
def exec
response = GitlabMetrics.measure("post-receive") do
- api.post_receive(gl_repository, actor, changes)
+ api.post_receive(gl_repository, @actor, changes)
end
return false unless response
@@ -33,18 +35,12 @@ class GitlabPostReceive
false
end
- private
-
- attr_reader :config, :gl_repository, :repo_path, :gl_id, :changes, :jid
+ protected
def api
@api ||= GitlabNet.new
end
- def actor
- @actor ||= Actor.new_from(gl_id, audit_usernames: config.audit_usernames)
- end
-
def print_merge_request_links(merge_request_urls)
return if merge_request_urls.empty?
puts
@@ -104,6 +100,8 @@ class GitlabPostReceive
puts "=" * total_width
end
+ private
+
def parse_broadcast_msg(msg, text_length)
msg ||= ""
# just return msg if shorter than or equal to text length