magnum-payload 0.4.1 → 0.5.0
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 +20 -12
- data/lib/magnum/payload/beanstalk.rb +3 -1
- data/lib/magnum/payload/version.rb +1 -1
- data/spec/fixtures/beanstalk/git_new.json +55 -0
- data/spec/payload/beanstalk_spec.rb +14 -0
- metadata +19 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 185e19da5e951d271a1474cfadcab726a57e0370
|
4
|
+
data.tar.gz: 1cced0a213ba0e6c07e878bcef747b9d0794e654
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f967feb19ea407b6f35e8fb4cf5c543532dfaed69f4dd909bdd1fdad1305f6750330d7041d3a8bbcc8b1356f88858787cbb6ce63a6cc2435561f79f94da2747
|
7
|
+
data.tar.gz: 6616c61e359656c503b2d94c01680968f4c9af4003b9a920f8db06fa4f40ab47699a737147fb240bb33f8f91173a98ea5fc833213a9aa467ea2fbc3197b52868
|
data/README.md
CHANGED
@@ -6,7 +6,8 @@ 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)
|
9
|
+
[](https://magnum-ci.com/public/0cb3a398347ebeeb90fb/builds)
|
10
|
+
[](https://codeclimate.com/github/magnumci/magnum-payload)
|
10
11
|
|
11
12
|
## Supported platforms
|
12
13
|
|
@@ -14,9 +15,10 @@ You can integrate with the following providers:
|
|
14
15
|
|
15
16
|
- [Github](https://github.com) - git
|
16
17
|
- [Bitbucket](https://bitbucket.org) - git, mercurial
|
17
|
-
- [Gitlab](
|
18
|
+
- [Gitlab](https://www.gitlab.com/) - git
|
18
19
|
- [Beanstalkapp](http://beanstalkapp.com/) - git, mercurial, subversion
|
19
|
-
-
|
20
|
+
- [CodebaseHQ](http://www.codebasehq.com/) - git
|
21
|
+
- Custom Implementation - git
|
20
22
|
|
21
23
|
## Installation
|
22
24
|
|
@@ -29,7 +31,7 @@ gem install magnum-payload
|
|
29
31
|
Or with bundler:
|
30
32
|
|
31
33
|
```
|
32
|
-
gem
|
34
|
+
gem "magnum-payload", require: "magnum/payload"
|
33
35
|
```
|
34
36
|
|
35
37
|
## Usage
|
@@ -37,17 +39,17 @@ gem 'magnum-payload', require: 'magnum/payload'
|
|
37
39
|
Example:
|
38
40
|
|
39
41
|
```ruby
|
40
|
-
require
|
42
|
+
require "magnum/payload"
|
41
43
|
|
42
44
|
# Shorthand method to parse payload
|
43
|
-
Magnum::Payload.parse(
|
44
|
-
Magnum::Payload.parse(
|
45
|
-
Magnum::Payload.parse(
|
45
|
+
Magnum::Payload.parse("github", "JSON") # => Magnum::Payload::Github
|
46
|
+
Magnum::Payload.parse("bitbucket", "JSON") # => Magnum::Payload::Bitbucket
|
47
|
+
Magnum::Payload.parse("gitlab", "JSON") # => Magnum::Payload::Gitlab
|
46
48
|
|
47
|
-
# Or
|
48
|
-
payload = Magnum::Payload::Github.new(
|
49
|
+
# Or initialize a payload class directly
|
50
|
+
payload = Magnum::Payload::Github.new("JSON data")
|
49
51
|
|
50
|
-
#
|
52
|
+
# Check if payload should be skipped
|
51
53
|
payload.skip?
|
52
54
|
payload.skip_message?
|
53
55
|
```
|
@@ -91,8 +93,14 @@ To execute test suite run:
|
|
91
93
|
rake test
|
92
94
|
```
|
93
95
|
|
96
|
+
## Contact
|
97
|
+
|
98
|
+
- Magnum CI
|
99
|
+
- [https://magnum-ci.com](https://magnum-ci.com)
|
100
|
+
- [support@magnum-ci.com](mailto:support@magnum-ci.com)
|
101
|
+
|
94
102
|
## License
|
95
103
|
|
96
104
|
The MIT License (MIT)
|
97
105
|
|
98
|
-
Copyright (c) 2013-2014 Magnum CI
|
106
|
+
Copyright (c) 2013-2014 Magnum CI
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Magnum
|
2
2
|
class Payload::Beanstalk < Payload::Base
|
3
3
|
def parse!
|
4
|
+
@data = data.payload if data && data.payload
|
5
|
+
|
4
6
|
data.revision ? parse_svn! : parse_git!
|
5
7
|
detect_fake_payload!
|
6
8
|
end
|
@@ -22,7 +24,7 @@ module Magnum
|
|
22
24
|
@message = last_commit.message
|
23
25
|
@author = last_commit.author.name
|
24
26
|
@author_email = last_commit.author.email
|
25
|
-
@commit_url = last_commit.url
|
27
|
+
@commit_url = last_commit.url || last_commit.changeset_url
|
26
28
|
end
|
27
29
|
|
28
30
|
def parse_svn!
|
@@ -0,0 +1,55 @@
|
|
1
|
+
{
|
2
|
+
"trigger": "push",
|
3
|
+
"payload": {
|
4
|
+
"before": "dee0d9408c68f9ad06e42da20f9028004b87268b",
|
5
|
+
"after": "01e1d7d7d6bf264448a38c6e73284d2f61b9d4fa",
|
6
|
+
"type": "GitPush",
|
7
|
+
"branch": "master",
|
8
|
+
"ref": "refs/heads/master",
|
9
|
+
"repository": {
|
10
|
+
"id": 629639,
|
11
|
+
"name": "test-repo",
|
12
|
+
"title": "test-repo",
|
13
|
+
"type": "GitRepository"
|
14
|
+
},
|
15
|
+
"beanstalk_user": {
|
16
|
+
"type": "Owner",
|
17
|
+
"id": 435943,
|
18
|
+
"login": "example",
|
19
|
+
"email": "email@example.com",
|
20
|
+
"name": "Magnum CI"
|
21
|
+
},
|
22
|
+
"commits": [
|
23
|
+
{
|
24
|
+
"type": "GitCommit",
|
25
|
+
"id": "01e1d7d7",
|
26
|
+
"message": "Test Message",
|
27
|
+
"branch": "master",
|
28
|
+
"author": {
|
29
|
+
"name": "Foobar",
|
30
|
+
"email": "email@example.com"
|
31
|
+
},
|
32
|
+
"beanstalk_user": null,
|
33
|
+
"changed_files": {
|
34
|
+
"added": [
|
35
|
+
|
36
|
+
],
|
37
|
+
"deleted": [
|
38
|
+
|
39
|
+
],
|
40
|
+
"modified": [
|
41
|
+
"index.txt"
|
42
|
+
],
|
43
|
+
"copied": [
|
44
|
+
|
45
|
+
]
|
46
|
+
},
|
47
|
+
"changeset_url": "https://test.beanstalkapp.com/test-repo/changesets/01e1d7d7",
|
48
|
+
"committed_at": "2015-05-13 17:42:32 UTC",
|
49
|
+
"parents": [
|
50
|
+
"dee0d9408c68f9ad06e42da20f9028004b87268b"
|
51
|
+
]
|
52
|
+
}
|
53
|
+
]
|
54
|
+
}
|
55
|
+
}
|
@@ -54,6 +54,20 @@ describe Magnum::Payload::Beanstalk do
|
|
54
54
|
expect(payload.skip).to be_true
|
55
55
|
end
|
56
56
|
end
|
57
|
+
|
58
|
+
context "when new structure" do
|
59
|
+
let(:data) { fixture "beanstalk/git_new.json" }
|
60
|
+
|
61
|
+
it "parses payload" do
|
62
|
+
expect(payload.commit).to eq "01e1d7d7"
|
63
|
+
expect(payload.branch).to eq "master"
|
64
|
+
expect(payload.message).to eq "Test Message"
|
65
|
+
expect(payload.author).to eq "Foobar"
|
66
|
+
expect(payload.author_email).to eq "email@example.com"
|
67
|
+
expect(payload.commit_url).to eq "https://test.beanstalkapp.com/test-repo/changesets/01e1d7d7"
|
68
|
+
expect(payload.compare_url).to be_nil
|
69
|
+
end
|
70
|
+
end
|
57
71
|
end
|
58
72
|
|
59
73
|
context "with svn payload" do
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magnum-payload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.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:
|
11
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '10'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.13'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.13'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0.8'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.8'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: json
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '1.8'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.8'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: hashr
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: Parse code pushes from multiple code hosting platforms
|
@@ -87,8 +87,8 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gitignore
|
91
|
-
- .rspec
|
90
|
+
- ".gitignore"
|
91
|
+
- ".rspec"
|
92
92
|
- Gemfile
|
93
93
|
- LICENSE
|
94
94
|
- README.md
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- magnum-payload.gemspec
|
108
108
|
- spec/fixtures/beanstalk/git.json
|
109
109
|
- spec/fixtures/beanstalk/git_branch_delete.json
|
110
|
+
- spec/fixtures/beanstalk/git_new.json
|
110
111
|
- spec/fixtures/beanstalk/hg.json
|
111
112
|
- spec/fixtures/beanstalk/svn.json
|
112
113
|
- spec/fixtures/bitbucket/git.json
|
@@ -141,23 +142,24 @@ require_paths:
|
|
141
142
|
- lib
|
142
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
143
144
|
requirements:
|
144
|
-
- -
|
145
|
+
- - ">="
|
145
146
|
- !ruby/object:Gem::Version
|
146
147
|
version: '0'
|
147
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
149
|
requirements:
|
149
|
-
- -
|
150
|
+
- - ">="
|
150
151
|
- !ruby/object:Gem::Version
|
151
152
|
version: '0'
|
152
153
|
requirements: []
|
153
154
|
rubyforge_project:
|
154
|
-
rubygems_version: 2.
|
155
|
+
rubygems_version: 2.4.3
|
155
156
|
signing_key:
|
156
157
|
specification_version: 4
|
157
158
|
summary: Code payload parser
|
158
159
|
test_files:
|
159
160
|
- spec/fixtures/beanstalk/git.json
|
160
161
|
- spec/fixtures/beanstalk/git_branch_delete.json
|
162
|
+
- spec/fixtures/beanstalk/git_new.json
|
161
163
|
- spec/fixtures/beanstalk/hg.json
|
162
164
|
- spec/fixtures/beanstalk/svn.json
|
163
165
|
- spec/fixtures/bitbucket/git.json
|