summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathon Reinhart <Jonathon.Reinhart@gmail.com>2018-12-13 00:01:02 -0500
committerJonathon Reinhart <Jonathon.Reinhart@gmail.com>2018-12-13 22:34:15 -0500
commitaf705c3f8c21ab34ba7cde8777b1e29e35b26a4c (patch)
treec2543b8e11a481ab2d64fda3e9e098db21de222d
parent30a06eca35d38ac91c1f2beadb2443f37d28476b (diff)
downloadgitlab-shell-af705c3f8c21ab34ba7cde8777b1e29e35b26a4c.tar.gz
Use 'push_options' everywhere instead of 'push_opts'
-rwxr-xr-xhooks/post-receive4
-rw-r--r--lib/gitlab_net.rb4
-rw-r--r--lib/gitlab_post_receive.rb6
-rw-r--r--spec/gitlab_net_spec.rb6
-rw-r--r--spec/gitlab_post_receive_spec.rb4
5 files changed, 12 insertions, 12 deletions
diff --git a/hooks/post-receive b/hooks/post-receive
index 5098158..2b6538f 100755
--- a/hooks/post-receive
+++ b/hooks/post-receive
@@ -12,9 +12,9 @@ require_relative '../lib/gitlab_custom_hook'
require_relative '../lib/hooks_utils'
require_relative '../lib/gitlab_post_receive'
-push_opts = HooksUtils.get_push_options
+push_options = HooksUtils.get_push_options
-if GitlabPostReceive.new(gl_repository, repo_path, key_id, refs, push_opts).exec &&
+if GitlabPostReceive.new(gl_repository, repo_path, key_id, refs, push_options).exec &&
GitlabCustomHook.new(repo_path, key_id).post_receive(refs)
exit 0
else
diff --git a/lib/gitlab_net.rb b/lib/gitlab_net.rb
index a0e1f12..de262d8 100644
--- a/lib/gitlab_net.rb
+++ b/lib/gitlab_net.rb
@@ -119,12 +119,12 @@ class GitlabNet # rubocop:disable Metrics/ClassLength
false
end
- def post_receive(gl_repository, identifier, changes, push_opts)
+ def post_receive(gl_repository, identifier, changes, push_options)
params = {
gl_repository: gl_repository,
identifier: identifier,
changes: changes,
- :"push_opts[]" => push_opts, # ruby <2.2 syntax
+ :"push_options[]" => push_options, # ruby <2.2 syntax
}
resp = post("#{internal_api_endpoint}/post_receive", params)
diff --git a/lib/gitlab_post_receive.rb b/lib/gitlab_post_receive.rb
index 5dd9955..2d412b9 100644
--- a/lib/gitlab_post_receive.rb
+++ b/lib/gitlab_post_receive.rb
@@ -8,19 +8,19 @@ require 'securerandom'
class GitlabPostReceive
attr_reader :config, :gl_repository, :repo_path, :changes, :jid
- def initialize(gl_repository, repo_path, actor, changes, push_opts)
+ def initialize(gl_repository, repo_path, actor, changes, push_options)
@config = GitlabConfig.new
@gl_repository = gl_repository
@repo_path = repo_path.strip
@actor = actor
@changes = changes
- @push_opts = push_opts
+ @push_options = push_options
@jid = SecureRandom.hex(12)
end
def exec
response = GitlabMetrics.measure("post-receive") do
- api.post_receive(gl_repository, @actor, changes, @push_opts)
+ api.post_receive(gl_repository, @actor, changes, @push_options)
end
return false unless response
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb
index 8409b14..1ca4096 100644
--- a/spec/gitlab_net_spec.rb
+++ b/spec/gitlab_net_spec.rb
@@ -174,9 +174,9 @@ describe GitlabNet, vcr: true do
describe '#post_receive' do
let(:gl_repository) { "project-1" }
let(:changes) { "123456 789012 refs/heads/test\n654321 210987 refs/tags/tag" }
- let(:push_opts) { ["ci-skip", "something unexpected"] }
+ let(:push_options) { ["ci-skip", "something unexpected"] }
let(:params) do
- { gl_repository: gl_repository, identifier: key, changes: changes, :"push_opts[]" => push_opts }
+ { gl_repository: gl_repository, identifier: key, changes: changes, :"push_options[]" => push_options }
end
let(:merge_request_urls) do
[{
@@ -186,7 +186,7 @@ describe GitlabNet, vcr: true do
}]
end
- subject { gitlab_net.post_receive(gl_repository, key, changes, push_opts) }
+ subject { gitlab_net.post_receive(gl_repository, key, changes, push_options) }
it 'sends the correct parameters' do
expect_any_instance_of(Net::HTTP::Post).to receive(:set_form_data).with(hash_including(params))
diff --git a/spec/gitlab_post_receive_spec.rb b/spec/gitlab_post_receive_spec.rb
index ac1cea2..3cae631 100644
--- a/spec/gitlab_post_receive_spec.rb
+++ b/spec/gitlab_post_receive_spec.rb
@@ -11,8 +11,8 @@ describe GitlabPostReceive do
let(:base64_changes) { Base64.encode64(wrongly_encoded_changes) }
let(:repo_path) { File.join(repository_path, repo_name) + ".git" }
let(:gl_repository) { "project-1" }
- let(:push_opts) { [] }
- let(:gitlab_post_receive) { GitlabPostReceive.new(gl_repository, repo_path, actor, wrongly_encoded_changes, push_opts) }
+ let(:push_options) { [] }
+ let(:gitlab_post_receive) { GitlabPostReceive.new(gl_repository, repo_path, actor, wrongly_encoded_changes, push_options) }
let(:broadcast_message) { "test " * 10 + "message " * 10 }
let(:enqueued_at) { Time.new(2016, 6, 23, 6, 59) }
let(:new_merge_request_urls) do