git_tag_push_service.rb 575 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class GitTagPushService
  attr_accessor :project, :user, :push_data
  def execute(project, user, ref)
    @project, @user = project, user
    @push_data = create_push_data(ref)
    project.execute_hooks(@push_data.dup, :tag_push_hooks)
  end

  private

  def create_push_data(ref)
    data = {
      ref: ref,
      user_id: user.id,
      user_name: user.name,
      project_id: project.id,
      repository: {
        name: project.name,
        url: project.url_to_repo,
        description: project.description,
        homepage: project.web_url
      }
    }
  end
end