magnum-payload 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +3 -2
- data/README.md +0 -2
- data/lib/magnum/payload.rb +1 -2
- data/lib/magnum/payload/version.rb +1 -1
- data/spec/payload/beanstalk_spec.rb +66 -57
- data/spec/payload/gitlab_spec.rb +3 -3
- data/spec/payload_spec.rb +19 -27
- metadata +2 -7
- data/lib/magnum/payload/gitslice.rb +0 -21
- data/spec/fixtures/gitslice.json +0 -9
- data/spec/payload/gitslice_spec.rb +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21782a6d2a38628f608ef49f52e416e50b4c1473
|
4
|
+
data.tar.gz: 0442f0409b8795ad1e41296b77d1b6689f2d94b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 986c4c308614292ea17242ba2287be2228600811879473116d11f6a0ebd27055fbeb2cfac12763ceea96729836000abccaba0d5de07ae00330282ffed1084b78
|
7
|
+
data.tar.gz: 6a25dae5724ab131d193046cf275e2f571a01c01567e915cb7ceafc75f490c91deec60235a53615b459b74e5453300198460d5b1e939b96299653f62871f8ac6
|
data/LICENSE
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013-2014 Dan Sosedoff, dan.sosedoff@gmail.com
|
3
4
|
|
4
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
5
6
|
this software and associated documentation files (the "Software"), to deal in
|
data/README.md
CHANGED
data/lib/magnum/payload.rb
CHANGED
@@ -3,13 +3,12 @@ require "magnum/payload/errors"
|
|
3
3
|
|
4
4
|
module Magnum
|
5
5
|
module Payload
|
6
|
-
SOURCES = %w(custom github gitlab
|
6
|
+
SOURCES = %w(custom github gitlab bitbucket beanstalk)
|
7
7
|
|
8
8
|
autoload :Base, "magnum/payload/base"
|
9
9
|
autoload :Custom, "magnum/payload/custom"
|
10
10
|
autoload :Github, "magnum/payload/github"
|
11
11
|
autoload :Gitlab, "magnum/payload/gitlab"
|
12
|
-
autoload :Gitslice, "magnum/payload/gitslice"
|
13
12
|
autoload :Bitbucket, "magnum/payload/bitbucket"
|
14
13
|
autoload :Beanstalk, "magnum/payload/beanstalk"
|
15
14
|
autoload :MessageParser, "magnum/payload/message_parser"
|
@@ -1,112 +1,121 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Magnum::Payload::Beanstalk do
|
4
4
|
let(:payload) { Magnum::Payload::Beanstalk.new(data) }
|
5
5
|
|
6
|
-
describe
|
7
|
-
context
|
8
|
-
let(:data) { fixture
|
6
|
+
describe "#parse!" do
|
7
|
+
context "with git payload" do
|
8
|
+
let(:data) { fixture "beanstalk/git.json" }
|
9
9
|
|
10
|
-
it
|
11
|
-
payload.commit.
|
10
|
+
it "sets commit SHA" do
|
11
|
+
expect(payload.commit).to eq "1111111111111111111111111111111111111111"
|
12
12
|
end
|
13
13
|
|
14
|
-
it
|
15
|
-
payload.branch.
|
14
|
+
it "sets commit branch" do
|
15
|
+
expect(payload.branch).to eq "master"
|
16
16
|
end
|
17
17
|
|
18
|
-
it
|
19
|
-
payload.message.
|
18
|
+
it "sets commit message" do
|
19
|
+
expect(payload.message).to eq "Fake commit message"
|
20
20
|
end
|
21
21
|
|
22
|
-
it
|
23
|
-
payload.author.
|
24
|
-
payload.author_email.should eq 'john.jones@gmail.com'
|
22
|
+
it "sets author name" do
|
23
|
+
expect(payload.author).to eq "Mr Jones"
|
25
24
|
end
|
26
25
|
|
27
|
-
it
|
28
|
-
payload.
|
26
|
+
it "sets auther email" do
|
27
|
+
expect(payload.author_email).to eq "john.jones@gmail.com"
|
29
28
|
end
|
30
29
|
|
31
|
-
it
|
32
|
-
payload.
|
30
|
+
it "sets commit view url" do
|
31
|
+
expect(payload.commit_url).to eq "http://sosedoff.beanstalkapp.com/xml-sitemap/changesets/1111111111111111111111111111111111111111"
|
33
32
|
end
|
34
33
|
|
35
|
-
|
36
|
-
|
34
|
+
it "sets compare url" do
|
35
|
+
expect(payload.compare_url).to be_nil
|
36
|
+
end
|
37
|
+
|
38
|
+
context "when fake" do
|
39
|
+
let(:data) { fixture "beanstalk/git.json" }
|
37
40
|
|
38
|
-
it
|
39
|
-
payload.skip.
|
41
|
+
it "sets skip to true" do
|
42
|
+
expect(payload.skip).to be_true
|
40
43
|
end
|
41
44
|
|
42
|
-
it
|
43
|
-
payload.test.
|
45
|
+
it "sets test to true" do
|
46
|
+
expect(payload.test).to be_true
|
44
47
|
end
|
45
48
|
end
|
46
49
|
end
|
47
50
|
|
48
|
-
context
|
49
|
-
let(:data) { fixture
|
51
|
+
context "with svn payload" do
|
52
|
+
let(:data) { fixture "beanstalk/svn.json" }
|
53
|
+
|
54
|
+
it "sets commit number" do
|
55
|
+
expect(payload.commit).to eq 1
|
56
|
+
end
|
50
57
|
|
51
|
-
it
|
52
|
-
payload.
|
58
|
+
it "sets commit message" do
|
59
|
+
expect(payload.message).to eq "Creating initial repository structure"
|
53
60
|
end
|
54
61
|
|
55
|
-
it
|
56
|
-
payload.
|
62
|
+
it "sets branch to master" do
|
63
|
+
expect(payload.branch).to eq "master"
|
57
64
|
end
|
58
65
|
|
59
|
-
it
|
60
|
-
payload.
|
66
|
+
it "sets author" do
|
67
|
+
expect(payload.author).to eq "admin"
|
61
68
|
end
|
62
69
|
|
63
|
-
it
|
64
|
-
payload.
|
65
|
-
payload.committer.should eq 'admin'
|
70
|
+
it "sets committer" do
|
71
|
+
expect(payload.committer).to eq "admin"
|
66
72
|
end
|
67
73
|
|
68
|
-
it
|
69
|
-
payload.commit_url.
|
74
|
+
it "sets commit view url" do
|
75
|
+
expect(payload.commit_url).not_to be_nil
|
70
76
|
end
|
71
77
|
end
|
72
78
|
|
73
|
-
context
|
74
|
-
let(:data) { fixture
|
79
|
+
context "with mercurial payload" do
|
80
|
+
let(:data) { fixture "beanstalk/hg.json" }
|
81
|
+
|
82
|
+
it "sets commit SHA" do
|
83
|
+
expect(payload.commit).to eq "1111111111111111111111111111111111111111"
|
84
|
+
end
|
75
85
|
|
76
|
-
it
|
77
|
-
payload.
|
86
|
+
it "sets commit branch" do
|
87
|
+
expect(payload.branch).to eq "default"
|
78
88
|
end
|
79
89
|
|
80
|
-
it
|
81
|
-
payload.
|
90
|
+
it "sets commit message" do
|
91
|
+
expect(payload.message).to eq "Fake commit message"
|
82
92
|
end
|
83
93
|
|
84
|
-
it
|
85
|
-
payload.
|
94
|
+
it "sets author and committer" do
|
95
|
+
expect(payload.author).to eq "Mr Jones"
|
86
96
|
end
|
87
97
|
|
88
|
-
it
|
89
|
-
payload.
|
90
|
-
payload.author_email.should eq 'john.jones@gmail.com'
|
98
|
+
it "sets author email" do
|
99
|
+
expect(payload.author_email).to eq "john.jones@gmail.com"
|
91
100
|
end
|
92
101
|
|
93
|
-
it
|
94
|
-
payload.commit_url.
|
102
|
+
it "sets commit view url" do
|
103
|
+
expect(payload.commit_url).to eq "http://sosedoff.beanstalkapp.com/beanstalk-hg1/changesets/1111111111111111111111111111111111111111"
|
95
104
|
end
|
96
105
|
|
97
|
-
it
|
98
|
-
payload.compare_url.
|
106
|
+
it "sets compare url" do
|
107
|
+
expect(payload.compare_url).to be_nil
|
99
108
|
end
|
100
109
|
|
101
|
-
context
|
102
|
-
let(:data) { fixture
|
110
|
+
context "when fake" do
|
111
|
+
let(:data) { fixture "beanstalk/hg.json" }
|
103
112
|
|
104
|
-
it
|
105
|
-
payload.skip.
|
113
|
+
it "sets skip to true" do
|
114
|
+
expect(payload.skip).to be_true
|
106
115
|
end
|
107
116
|
|
108
|
-
it
|
109
|
-
payload.test.
|
117
|
+
it "sets test to true" do
|
118
|
+
expect(payload.test).to be_true
|
110
119
|
end
|
111
120
|
end
|
112
121
|
end
|
data/spec/payload/gitlab_spec.rb
CHANGED
@@ -35,7 +35,7 @@ describe Magnum::Payload::Gitlab do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
context "on new branch" do
|
38
|
-
let(:data) { fixture
|
38
|
+
let(:data) { fixture "gitlab/create_branch.json" }
|
39
39
|
|
40
40
|
it "sets commit SHA" do
|
41
41
|
expect(payload.commit).to eq "0188ef243dd8083a4d4761766342b523d521247d"
|
@@ -47,7 +47,7 @@ describe Magnum::Payload::Gitlab do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
context "on deleted branch" do
|
50
|
-
let(:data) { fixture
|
50
|
+
let(:data) { fixture "gitlab/delete_branch.json" }
|
51
51
|
|
52
52
|
it "sets skip to true " do
|
53
53
|
expect(payload.skip).to eq true
|
@@ -55,7 +55,7 @@ describe Magnum::Payload::Gitlab do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
context "on head with slash" do
|
58
|
-
let(:data) { fixture
|
58
|
+
let(:data) { fixture "gitlab/branch_with_slash.json" }
|
59
59
|
|
60
60
|
it "returns correct branch name" do
|
61
61
|
expect(payload.branch).to eq "issue/broken-feature"
|
data/spec/payload_spec.rb
CHANGED
@@ -1,50 +1,42 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Magnum::Payload do
|
4
4
|
describe ".valid_source?" do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
expect(Magnum::Payload.valid_source?("bitbucket")).to eq true
|
10
|
-
expect(Magnum::Payload.valid_source?("beanstalk")).to eq true
|
11
|
-
expect(Magnum::Payload.valid_source?("custom")).to eq true
|
5
|
+
%w(github gitlab bitbucket beanstalk custom).each do |source|
|
6
|
+
it "returns true for #{source}" do
|
7
|
+
expect(described_class.valid_source?(source)).to be_true
|
8
|
+
end
|
12
9
|
end
|
13
|
-
|
10
|
+
|
14
11
|
it "returns false if not valid" do
|
15
|
-
expect(
|
12
|
+
expect(described_class.valid_source?("foobar")).to eq false
|
16
13
|
end
|
17
14
|
end
|
18
15
|
|
19
|
-
describe
|
20
|
-
it
|
21
|
-
payload =
|
16
|
+
describe ".parse" do
|
17
|
+
it "returns payload instance for github" do
|
18
|
+
payload = described_class.parse("github", fixture("github.json"))
|
22
19
|
expect(payload).to be_a Magnum::Payload::Github
|
23
20
|
end
|
24
21
|
|
25
|
-
it
|
26
|
-
payload =
|
27
|
-
expect(payload).to be_a Magnum::Payload::Gitslice
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'returns payload instance for gitlab' do
|
31
|
-
payload = Magnum::Payload.parse('gitlab', fixture('gitlab/commits.json'))
|
22
|
+
it "returns payload instance for gitlab" do
|
23
|
+
payload = described_class.parse("gitlab", fixture("gitlab/commits.json"))
|
32
24
|
expect(payload).to be_a Magnum::Payload::Gitlab
|
33
25
|
end
|
34
26
|
|
35
|
-
it
|
36
|
-
payload =
|
27
|
+
it "returns payload instance for bitbucket" do
|
28
|
+
payload = described_class.parse("bitbucket", fixture("bitbucket/git.json"))
|
37
29
|
expect(payload).to be_a Magnum::Payload::Bitbucket
|
38
30
|
end
|
39
31
|
|
40
|
-
it
|
41
|
-
payload =
|
32
|
+
it "returns payload instance for beanstalk" do
|
33
|
+
payload = described_class.parse("beanstalk", fixture("beanstalk/git.json"))
|
42
34
|
expect(payload).to be_a Magnum::Payload::Beanstalk
|
43
35
|
end
|
44
36
|
|
45
|
-
it
|
46
|
-
expect {
|
47
|
-
to raise_error Magnum::Payload::PayloadError,
|
37
|
+
it "raises error if source is invalid" do
|
38
|
+
expect { described_class.parse("foobar", "bar") }.
|
39
|
+
to raise_error Magnum::Payload::PayloadError, "Invalid payload type: foobar"
|
48
40
|
end
|
49
41
|
end
|
50
42
|
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.
|
4
|
+
version: 0.4.0
|
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-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -102,7 +102,6 @@ files:
|
|
102
102
|
- lib/magnum/payload/errors.rb
|
103
103
|
- lib/magnum/payload/github.rb
|
104
104
|
- lib/magnum/payload/gitlab.rb
|
105
|
-
- lib/magnum/payload/gitslice.rb
|
106
105
|
- lib/magnum/payload/message_parser.rb
|
107
106
|
- lib/magnum/payload/version.rb
|
108
107
|
- magnum-payload.gemspec
|
@@ -122,13 +121,11 @@ files:
|
|
122
121
|
- spec/fixtures/gitlab/commits.json
|
123
122
|
- spec/fixtures/gitlab/create_branch.json
|
124
123
|
- spec/fixtures/gitlab/delete_branch.json
|
125
|
-
- spec/fixtures/gitslice.json
|
126
124
|
- spec/payload/base_spec.rb
|
127
125
|
- spec/payload/beanstalk_spec.rb
|
128
126
|
- spec/payload/bitbucket_spec.rb
|
129
127
|
- spec/payload/github_spec.rb
|
130
128
|
- spec/payload/gitlab_spec.rb
|
131
|
-
- spec/payload/gitslice_spec.rb
|
132
129
|
- spec/payload/message_parser_spec.rb
|
133
130
|
- spec/payload_spec.rb
|
134
131
|
- spec/spec_helper.rb
|
@@ -174,13 +171,11 @@ test_files:
|
|
174
171
|
- spec/fixtures/gitlab/commits.json
|
175
172
|
- spec/fixtures/gitlab/create_branch.json
|
176
173
|
- spec/fixtures/gitlab/delete_branch.json
|
177
|
-
- spec/fixtures/gitslice.json
|
178
174
|
- spec/payload/base_spec.rb
|
179
175
|
- spec/payload/beanstalk_spec.rb
|
180
176
|
- spec/payload/bitbucket_spec.rb
|
181
177
|
- spec/payload/github_spec.rb
|
182
178
|
- spec/payload/gitlab_spec.rb
|
183
|
-
- spec/payload/gitslice_spec.rb
|
184
179
|
- spec/payload/message_parser_spec.rb
|
185
180
|
- spec/payload_spec.rb
|
186
181
|
- spec/spec_helper.rb
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Magnum
|
2
|
-
class Payload::Gitslice < Payload::Base
|
3
|
-
def parse!
|
4
|
-
assign_payload
|
5
|
-
end
|
6
|
-
|
7
|
-
private
|
8
|
-
|
9
|
-
def assign_payload
|
10
|
-
@commit = data.commit
|
11
|
-
@author = data.author
|
12
|
-
@author_email = data.author_email
|
13
|
-
@committer = data.committer
|
14
|
-
@committer_email = data.committer_email
|
15
|
-
@message = data.message
|
16
|
-
@branch = data.branch
|
17
|
-
@commit_url = data.commit_url
|
18
|
-
@compare_url = data.compare_url
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/spec/fixtures/gitslice.json
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"commit": "177d757ad97214f4546fb999e0be0783360e614e",
|
3
|
-
"message": "Add initial 404 page",
|
4
|
-
"author": "Dan Sosedoff",
|
5
|
-
"committer": "Dan Sosedoff",
|
6
|
-
"branch": "source-type",
|
7
|
-
"commit_url": "http://gitslice.com/magnum-ci/commit/177d757ad97214f4546fb999e0be0783360e614e",
|
8
|
-
"compare_url": "http://gitslice.com/magnum-ci/compare/b0445d963b7e3efaf47610ef710acc0ba3067a39...177d757ad97214f4546fb999e0be0783360e614e"
|
9
|
-
}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Magnum::Payload::Gitslice do
|
4
|
-
let(:data) { fixture('gitslice.json') }
|
5
|
-
let(:payload) { Magnum::Payload::Gitslice.new(data) }
|
6
|
-
|
7
|
-
describe '#parse!' do
|
8
|
-
it 'sets commit SHA' do
|
9
|
-
payload.commit.should eq('177d757ad97214f4546fb999e0be0783360e614e')
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'sets commit branch' do
|
13
|
-
payload.branch.should eq('source-type')
|
14
|
-
end
|
15
|
-
|
16
|
-
it 'sets commit message' do
|
17
|
-
payload.message.should eq('Add initial 404 page')
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'sets author and committer' do
|
21
|
-
payload.committer.should eq('Dan Sosedoff')
|
22
|
-
payload.author.should eq('Dan Sosedoff')
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'sets commit view url' do
|
26
|
-
payload.commit_url.should eq('http://gitslice.com/magnum-ci/commit/177d757ad97214f4546fb999e0be0783360e614e')
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'sets compare url' do
|
30
|
-
payload.compare_url.should eq('http://gitslice.com/magnum-ci/compare/b0445d963b7e3efaf47610ef710acc0ba3067a39...177d757ad97214f4546fb999e0be0783360e614e')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|