summaryrefslogtreecommitdiff
path: root/lib/flowdock/git.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-12-20 14:22:11 +0000
commit0c872e02b2c822e3397515ec324051ff540f0cd5 (patch)
treece2fb6ce7030e4dad0f4118d21ab6453e5938cdd /lib/flowdock/git.rb
parentf7e05a6853b12f02911494c4b3fe53d9540d74fc (diff)
downloadgitlab-ce-15.7.0-rc42.tar.gz
Add latest changes from gitlab-org/gitlab@15-7-stable-eev15.7.0-rc42
Diffstat (limited to 'lib/flowdock/git.rb')
-rw-r--r--lib/flowdock/git.rb67
1 files changed, 0 insertions, 67 deletions
diff --git a/lib/flowdock/git.rb b/lib/flowdock/git.rb
deleted file mode 100644
index 897ee647d87..00000000000
--- a/lib/flowdock/git.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-# frozen_string_literal: true
-require 'flowdock'
-require 'flowdock/git/builder'
-
-module Flowdock
- class Git
- TokenError = Class.new(StandardError)
-
- DEFAULT_PERMANENT_REFS = [
- Regexp.new('refs/heads/master')
- ].freeze
-
- class << self
- def post(ref, from, to, options = {})
- Git.new(ref, from, to, options).post
- end
- end
-
- def initialize(ref, from, to, options = {})
- raise TokenError, "Flowdock API token not found" unless options[:token]
-
- @ref = ref
- @from = from
- @to = to
- @options = options
- @token = options[:token]
- @commit_url = options[:commit_url]
- @diff_url = options[:diff_url]
- @repo_url = options[:repo_url]
- @repo_name = options[:repo_name]
- @permanent_refs = options.fetch(:permanent_refs, DEFAULT_PERMANENT_REFS)
- end
-
- # Send git push notification to Flowdock
- def post
- messages.each do |message|
- ::Flowdock::Client.new(flow_token: @token).post_to_thread(message)
- end
- end
-
- def repo
- @options[:repo]
- end
-
- private
-
- def messages
- Git::Builder.new(repo: repo,
- ref: @ref,
- before: @from,
- after: @to,
- commit_url: @commit_url,
- branch_url: @branch_url,
- diff_url: @diff_url,
- repo_url: @repo_url,
- repo_name: @repo_name,
- permanent_refs: @permanent_refs,
- tags: tags
- ).to_hashes
- end
-
- # Flowdock tags attached to the push notification
- def tags
- Array(@options[:tags]).map { |tag| CGI.escape(tag) }
- end
- end
-end