gitall 1.1.24 → 1.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/gitall/parsers/gitlab.rb +33 -23
- data/lib/gitall/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d2225c61cc4a524e15452245f2932d545332f491c76108601889f180f3815173
|
4
|
+
data.tar.gz: c9c84a2f7a840febfe06484b60852865ff1ad89e2394a654e57db1533e392d06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f82076383a5822fb35a8204f65871b11e5ef3d6c8e3c2624445cb6dc43ada3ac7a046976c42c42b2d1ba1221864227b80463d465cc8ac57acd5ff01b0fc61b37
|
7
|
+
data.tar.gz: 99b15316c34e9e4a643a8f5df0386d60094363a3dbfcd7ed7f942107b0c61c045737461a02f445b318c1ab17245b28675480243230188ff92d609a00d8672977
|
@@ -7,12 +7,12 @@
|
|
7
7
|
# GitLab Event Parsing
|
8
8
|
class GitLabParser
|
9
9
|
def GitLabParser.parse(json)
|
10
|
-
j
|
10
|
+
j = RecursiveOpenStruct.new(json)
|
11
11
|
response = []
|
12
|
-
kind
|
12
|
+
kind = j.object_kind
|
13
13
|
case kind
|
14
14
|
when 'note'
|
15
|
-
repo
|
15
|
+
repo = j.project.path_with_namespace
|
16
16
|
ntype = j.object_attributes.noteable_type
|
17
17
|
case ntype
|
18
18
|
when 'MergeRequest'
|
@@ -24,10 +24,10 @@ class GitLabParser
|
|
24
24
|
response << "[#{repo}] #{mr_user} commented on Merge Request ##{mr_id} \u2014 #{mr_note}"
|
25
25
|
response << "'#{mr_title}' => #{mr_url}"
|
26
26
|
when 'Commit'
|
27
|
-
c_note
|
28
|
-
c_sha
|
29
|
-
c_url
|
30
|
-
c_user
|
27
|
+
c_note = j.object_attributes.note
|
28
|
+
c_sha = j.commit.id[0...7]
|
29
|
+
c_url = j.object_attributes.url
|
30
|
+
c_user = j.user.name
|
31
31
|
response << "[#{repo}] #{c_user} commented on commit (#{c_sha}) \u2014 #{c_note} <#{c_url}>"
|
32
32
|
when 'Issue'
|
33
33
|
i_id = j.issue.iid
|
@@ -36,8 +36,8 @@ class GitLabParser
|
|
36
36
|
i_title = j.issue.title
|
37
37
|
i_user = j.user.name
|
38
38
|
response << "[#{repo}] #{i_user} commented on Issue ##{i_id} (#{i_title}) \u2014 #{i_msg} <#{i_url}>"
|
39
|
-
|
40
|
-
|
39
|
+
else
|
40
|
+
# type code here
|
41
41
|
end
|
42
42
|
when 'issue'
|
43
43
|
i_repo = j.project.path_with_namespace
|
@@ -62,41 +62,51 @@ class GitLabParser
|
|
62
62
|
response << "[#{mr_lcsha}] \u2014 #{mr_lcmessage} <#{mr_url}>"
|
63
63
|
when 'push' # comes to
|
64
64
|
# shove
|
65
|
-
branch
|
66
|
-
commits
|
67
|
-
added
|
68
|
-
removed
|
65
|
+
branch = j.ref.split('/')[-1]
|
66
|
+
commits = j.commits
|
67
|
+
added = 0
|
68
|
+
removed = 0
|
69
69
|
modified = 0
|
70
70
|
commits.each do |h|
|
71
71
|
added += h['added'].length
|
72
72
|
removed += h['removed'].length
|
73
73
|
modified += h['modified'].length
|
74
74
|
end
|
75
|
-
owner
|
76
|
-
project
|
77
|
-
pusher
|
75
|
+
owner = j.project.namespace
|
76
|
+
project = j.project.name
|
77
|
+
pusher = j.user_name
|
78
78
|
commit_count = j.total_commits_count
|
79
|
-
repo_url
|
79
|
+
repo_url = j.project.web_url
|
80
80
|
response << "[#{owner}/#{project}] #{pusher} pushed #{commit_count} commit(s) [+#{added}/-#{removed}/±#{modified}] to [#{branch}] at <#{repo_url}>"
|
81
81
|
if commits.length > 3
|
82
82
|
coms = commits[0..2]
|
83
83
|
coms.each do |n|
|
84
|
-
id
|
85
|
-
msg
|
84
|
+
id = n['id']
|
85
|
+
msg = n['message'].lines[0]
|
86
86
|
author = n['author']['name']
|
87
87
|
response << "#{author} — #{msg.chomp} [#{id[0...7]}]"
|
88
88
|
end
|
89
89
|
response << "and #{commits.from(3).length} commits..."
|
90
90
|
else
|
91
91
|
commits.each do |n|
|
92
|
-
id
|
93
|
-
msg
|
92
|
+
id = n['id'][0...7]
|
93
|
+
msg = n['message'].lines[0]
|
94
94
|
author = n['author']['name']
|
95
95
|
response << "#{author} — #{msg.chomp} [#{id}]"
|
96
96
|
end
|
97
97
|
end
|
98
|
-
|
99
|
-
|
98
|
+
when 'tag_push'
|
99
|
+
owner = j.project.namespace
|
100
|
+
project = j.project.name
|
101
|
+
pusher = j.user_name
|
102
|
+
commit_count = j.total_commits_count
|
103
|
+
repo_url = j.project.web_url
|
104
|
+
tag = j.ref.split('/')[-1]
|
105
|
+
response << "[#{owner}/#{project}] #{pusher} added/modified/removed tag #{tag}"
|
106
|
+
response << "[#{owner}/#{project}] Release: <https://gitlab.com/#{owner}/#{project}/releases/tag/#{tag}>"
|
107
|
+
|
108
|
+
else
|
109
|
+
# type code here
|
100
110
|
end
|
101
111
|
return response
|
102
112
|
end
|
data/lib/gitall/version.rb
CHANGED