magnum-payload 0.3.4 → 0.3.5
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/README.md +2 -2
- data/lib/magnum/payload/github.rb +3 -2
- data/lib/magnum/payload/version.rb +1 -1
- data/spec/fixtures/github/test.json +4 -0
- data/spec/payload/github_spec.rb +45 -37
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 558f53b2e50b86aef9690d16883a12a1f1c8f5e8
|
4
|
+
data.tar.gz: a6197cb92a200599ee7a666324fae0e50fa8c8a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac086b98433c9514ca56c2bdcd48a8d7dc9b297e7b4d87540bb281a818d4e2cf082986b5616aa084d2285d44fbb4dd72c9671929050676cc49b77875721c7472
|
7
|
+
data.tar.gz: 90b05ffc95d67e791df3530468ad3f009e60a5e1ae1fba1f6206de932b3f67d82a5a291789f4a78fa280fcdaa0320812b68616fb0100785da59416aaaeb52475
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ It accepts any commits payloads and transforms them into identical data structur
|
|
6
6
|
If you need to integrate web-hooks from Github, Bitbucket or Gitlab this is definitely
|
7
7
|
worth checking out. Check examples for details.
|
8
8
|
|
9
|
-
[](https://magnum-ci.com/public/0cb3a398347ebeeb90fb/builds) [](https://codeclimate.com/github/magnumci/magnum-payload)
|
10
10
|
|
11
11
|
## Supported platforms
|
12
12
|
|
@@ -106,4 +106,4 @@ The MIT License (MIT)
|
|
106
106
|
|
107
107
|
Copyright (c) 2013-2014 Dan Sosedoff, <dan.sosedoff@gmail.com>
|
108
108
|
|
109
|
-
Copyright (c) 2013-2014 Magnum CI, <support@magnum-ci.com>
|
109
|
+
Copyright (c) 2013-2014 Magnum CI, <support@magnum-ci.com>
|
@@ -19,8 +19,9 @@ module Magnum
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def skip_payload?
|
22
|
-
@skip = true if
|
23
|
-
@skip = true
|
22
|
+
return @skip = true if data.zen
|
23
|
+
@skip = true if head_deleted? || last_commit.nil?
|
24
|
+
@skip = true if data.ref =~ /tags/
|
24
25
|
|
25
26
|
@skip
|
26
27
|
end
|
data/spec/payload/github_spec.rb
CHANGED
@@ -1,73 +1,81 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Magnum::Payload::Github do
|
4
|
-
describe
|
5
|
-
let(:data) { fixture(
|
4
|
+
describe "#parse!" do
|
5
|
+
let(:data) { fixture("github.json") }
|
6
6
|
let(:payload) { Magnum::Payload::Github.new(data) }
|
7
7
|
|
8
|
-
it
|
9
|
-
payload.commit.
|
8
|
+
it "sets commit sha" do
|
9
|
+
expect(payload.commit).to eq "9d227f327e725164c3266be74cf5c00678edad13"
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
13
|
-
payload.branch.
|
12
|
+
it "sets commit branch" do
|
13
|
+
expect(payload.branch).to eq "master"
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
17
|
-
payload.message.
|
16
|
+
it "sets commit message" do
|
17
|
+
expect(payload.message).to eq "Remove jruby from test matrix"
|
18
18
|
end
|
19
19
|
|
20
|
-
it
|
21
|
-
payload.committer.
|
22
|
-
payload.committer_email.
|
20
|
+
it "sets author" do
|
21
|
+
expect(payload.committer).to eq "Dan Sosedoff"
|
22
|
+
expect(payload.committer_email).to eq "dan.sosedoff@gmail.com"
|
23
23
|
end
|
24
24
|
|
25
|
-
it
|
26
|
-
payload.author.
|
27
|
-
payload.author_email.
|
25
|
+
it "sets committer" do
|
26
|
+
expect(payload.author).to eq "Dan Sosedoff"
|
27
|
+
expect(payload.author_email).to eq "dan.sosedoff@gmail.com"
|
28
28
|
end
|
29
29
|
|
30
|
-
it
|
31
|
-
payload.commit_url.
|
30
|
+
it "sets commit view url" do
|
31
|
+
expect(payload.commit_url).to eq "https://github.com/sosedoff/lxc-ruby/commit/9d227f327e725164c3266be74cf5c00678edad13"
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
35
|
-
payload.compare_url.
|
34
|
+
it "sets commit compare url" do
|
35
|
+
expect(payload.compare_url).to eq "https://github.com/sosedoff/lxc-ruby/compare/0e46f019e391...9d227f327e72"
|
36
36
|
end
|
37
37
|
|
38
|
-
context
|
39
|
-
let(:data) { fixture
|
38
|
+
context "when push is forced" do
|
39
|
+
let(:data) { fixture "github/forced.json" }
|
40
40
|
|
41
|
-
it
|
42
|
-
payload.commit.
|
41
|
+
it "parses head commit" do
|
42
|
+
expect(payload.commit).to eq "e7508c4c70d2c5afc1e6c2f3a42ecc098f435103"
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
context
|
47
|
-
let(:data) { fixture
|
46
|
+
context "for deleted branch" do
|
47
|
+
let(:data) { fixture "github/deleted.json" }
|
48
48
|
|
49
|
-
it
|
50
|
-
payload.skip.
|
49
|
+
it "marks payload as skipped" do
|
50
|
+
expect(payload.skip).to be_true
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
context
|
55
|
-
let(:data) { fixture
|
54
|
+
context "for new branch" do
|
55
|
+
let(:data) { fixture "github/new_branch.json" }
|
56
56
|
|
57
|
-
it
|
58
|
-
payload.commit.
|
57
|
+
it "sets commit sha" do
|
58
|
+
expect(payload.commit).to eq "d9cc46f9e7e6aa65df696d8d1efe86de755b46ae"
|
59
59
|
end
|
60
60
|
|
61
|
-
it
|
62
|
-
payload.branch.
|
61
|
+
it "sets branch" do
|
62
|
+
expect(payload.branch).to eq "hello"
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
context
|
67
|
-
let(:data) { fixture
|
66
|
+
context "for new tag" do
|
67
|
+
let(:data) { fixture "github/new_tag.json" }
|
68
68
|
|
69
|
-
it
|
70
|
-
payload.skip.
|
69
|
+
it "marks payload as skipped" do
|
70
|
+
expect(payload.skip).to be_true
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context "for ping payload" do
|
75
|
+
let(:data) { fixture "github/test.json" }
|
76
|
+
|
77
|
+
it "marks payload as skipped" do
|
78
|
+
expect(payload.skip).to be_true
|
71
79
|
end
|
72
80
|
end
|
73
81
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magnum-payload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Sosedoff
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- spec/fixtures/github/forced.json
|
118
118
|
- spec/fixtures/github/new_branch.json
|
119
119
|
- spec/fixtures/github/new_tag.json
|
120
|
+
- spec/fixtures/github/test.json
|
120
121
|
- spec/fixtures/gitlab/branch_with_slash.json
|
121
122
|
- spec/fixtures/gitlab/commits.json
|
122
123
|
- spec/fixtures/gitlab/create_branch.json
|
@@ -168,6 +169,7 @@ test_files:
|
|
168
169
|
- spec/fixtures/github/forced.json
|
169
170
|
- spec/fixtures/github/new_branch.json
|
170
171
|
- spec/fixtures/github/new_tag.json
|
172
|
+
- spec/fixtures/github/test.json
|
171
173
|
- spec/fixtures/gitlab/branch_with_slash.json
|
172
174
|
- spec/fixtures/gitlab/commits.json
|
173
175
|
- spec/fixtures/gitlab/create_branch.json
|