txgh-server 2.1.0 → 2.1.1
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 08999181efe8b160394afe81270055aea22ba8df
|
|
4
|
+
data.tar.gz: 80f4a180a3a7d20f97adb2c587bcf884f3ba85c1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 11edfef929681456b7e0977a34a67b99e658341e82e6f6a71f18034fada792614eaf4d3547f14ee9205c6d4fc0a14fe944676c6e0cf1c8e1ca8df1bf6b4716e4
|
|
7
|
+
data.tar.gz: ee273984933596d9363ecf632e2f85a895fc06559c6458f7244946459dac03f9b7350a603f6069fc5c825980bfb444720e08837886f4b607bc20c109945fe96c
|
data/lib/txgh-server/version.rb
CHANGED
|
@@ -45,7 +45,12 @@ module TxghServer
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def author(payload)
|
|
48
|
-
payload.fetch('head_commit')
|
|
48
|
+
if head_commit = payload.fetch('head_commit')
|
|
49
|
+
head_commit.fetch('committer').fetch('name')
|
|
50
|
+
else
|
|
51
|
+
# fall back to pusher if no head commit
|
|
52
|
+
payload.fetch('pusher').fetch('name')
|
|
53
|
+
end
|
|
49
54
|
end
|
|
50
55
|
|
|
51
56
|
def extract_files(payload, state)
|
|
@@ -22,7 +22,11 @@ class GithubPayload
|
|
|
22
22
|
@result.to_json
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
def merge!(hash)
|
|
26
|
+
@result.merge!(hash)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
26
30
|
|
|
27
31
|
def digits
|
|
28
32
|
@@digits ||= ('a'..'f').to_a + ('0'..'9').to_a
|
|
@@ -92,6 +96,7 @@ class GithubPushPayload < GithubPayload
|
|
|
92
96
|
deleted: false,
|
|
93
97
|
forced: true,
|
|
94
98
|
base_ref: nil,
|
|
99
|
+
head_commit: nil,
|
|
95
100
|
compare: "https://github.com/#{@repo}/commit/#{@after[0..12]}",
|
|
96
101
|
commits: [],
|
|
97
102
|
repository: {
|
|
@@ -11,44 +11,57 @@ describe PushAttributes do
|
|
|
11
11
|
let(:modified) { ['modified_file.txt'] }
|
|
12
12
|
|
|
13
13
|
let(:payload) do
|
|
14
|
-
GithubPayloadBuilder.push_payload(repo_name, ref)
|
|
15
|
-
payload.add_commit(added: added, modified: modified)
|
|
16
|
-
end
|
|
14
|
+
GithubPayloadBuilder.push_payload(repo_name, ref)
|
|
17
15
|
end
|
|
18
16
|
|
|
19
17
|
describe '#from_webhook_payload' do
|
|
20
18
|
let(:attributes) { PushAttributes.from_webhook_payload(payload.to_h) }
|
|
21
19
|
|
|
22
|
-
it
|
|
23
|
-
|
|
20
|
+
it "when no head commit, uses the pusher's name instead" do
|
|
21
|
+
payload.merge!(pusher: { name: 'Fu Barro', email: 'fu@barro.com' })
|
|
22
|
+
expect(attributes.author).to eq('Fu Barro')
|
|
24
23
|
end
|
|
24
|
+
end
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
context 'with a commit added to the payload' do
|
|
27
|
+
before(:each) do
|
|
28
|
+
payload.add_commit(added: added, modified: modified)
|
|
28
29
|
end
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
end
|
|
31
|
+
describe '#from_webhook_payload' do
|
|
32
|
+
let(:attributes) { PushAttributes.from_webhook_payload(payload.to_h) }
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
it 'pulls out repo name' do
|
|
35
|
+
expect(attributes.repo_name).to eq(repo_name)
|
|
36
|
+
end
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
it 'pulls out ref' do
|
|
39
|
+
expect(attributes.ref).to eq("refs/#{ref}")
|
|
40
|
+
end
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
it 'pulls out before sha' do
|
|
43
|
+
expect(attributes.before).to eq(payload.to_h['before'])
|
|
44
|
+
end
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
it 'pulls out after sha' do
|
|
47
|
+
expect(attributes.after).to eq(payload.to_h['after'])
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
it 'pulls out added files' do
|
|
51
|
+
expect(attributes.added_files.to_a).to eq(added)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
it 'pulls out modified files' do
|
|
55
|
+
expect(attributes.modified_files.to_a).to eq(modified)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'combines all files into one handy array' do
|
|
59
|
+
expect(attributes.files.sort).to eq((added + modified).sort)
|
|
60
|
+
end
|
|
49
61
|
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
it 'pulls out the author' do
|
|
63
|
+
expect(attributes.author).to eq('Test User')
|
|
64
|
+
end
|
|
52
65
|
end
|
|
53
66
|
end
|
|
54
67
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: txgh-server
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matthew Jackowski
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2016-10-
|
|
12
|
+
date: 2016-10-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: mime-types
|
|
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
166
166
|
version: '0'
|
|
167
167
|
requirements: []
|
|
168
168
|
rubyforge_project:
|
|
169
|
-
rubygems_version: 2.
|
|
169
|
+
rubygems_version: 2.5.1
|
|
170
170
|
signing_key:
|
|
171
171
|
specification_version: 4
|
|
172
172
|
summary: An HTTP server for interacting with txgh.
|