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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 558f53b2e50b86aef9690d16883a12a1f1c8f5e8
4
- data.tar.gz: a6197cb92a200599ee7a666324fae0e50fa8c8a4
3
+ metadata.gz: 21782a6d2a38628f608ef49f52e416e50b4c1473
4
+ data.tar.gz: 0442f0409b8795ad1e41296b77d1b6689f2d94b0
5
5
  SHA512:
6
- metadata.gz: ac086b98433c9514ca56c2bdcd48a8d7dc9b297e7b4d87540bb281a818d4e2cf082986b5616aa084d2285d44fbb4dd72c9671929050676cc49b77875721c7472
7
- data.tar.gz: 90b05ffc95d67e791df3530468ad3f009e60a5e1ae1fba1f6206de932b3f67d82a5a291789f4a78fa280fcdaa0320812b68616fb0100785da59416aaaeb52475
6
+ metadata.gz: 986c4c308614292ea17242ba2287be2228600811879473116d11f6a0ebd27055fbeb2cfac12763ceea96729836000abccaba0d5de07ae00330282ffed1084b78
7
+ data.tar.gz: 6a25dae5724ab131d193046cf275e2f571a01c01567e915cb7ceafc75f490c91deec60235a53615b459b74e5453300198460d5b1e939b96299653f62871f8ac6
data/LICENSE CHANGED
@@ -1,5 +1,6 @@
1
- Copyright (c) 2013-2014 Dan Sosedoff, <dan.sosedoff@gmail.com>
2
- Copyright (c) 2013-2014 Magnum CI, <support@magnum-ci.com>
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
@@ -105,5 +105,3 @@ Magnum CI
105
105
  The MIT License (MIT)
106
106
 
107
107
  Copyright (c) 2013-2014 Dan Sosedoff, <dan.sosedoff@gmail.com>
108
-
109
- Copyright (c) 2013-2014 Magnum CI, <support@magnum-ci.com>
@@ -3,13 +3,12 @@ require "magnum/payload/errors"
3
3
 
4
4
  module Magnum
5
5
  module Payload
6
- SOURCES = %w(custom github gitlab gitslice bitbucket beanstalk)
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,5 +1,5 @@
1
1
  module Magnum
2
2
  module Payload
3
- VERSION = "0.3.5"
3
+ VERSION = "0.4.0"
4
4
  end
5
5
  end
@@ -1,112 +1,121 @@
1
- require 'spec_helper'
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 '#parse!' do
7
- context 'with git payload' do
8
- let(:data) { fixture('beanstalk/git.json') }
6
+ describe "#parse!" do
7
+ context "with git payload" do
8
+ let(:data) { fixture "beanstalk/git.json" }
9
9
 
10
- it 'sets commit SHA' do
11
- payload.commit.should eq '1111111111111111111111111111111111111111'
10
+ it "sets commit SHA" do
11
+ expect(payload.commit).to eq "1111111111111111111111111111111111111111"
12
12
  end
13
13
 
14
- it 'sets commit branch' do
15
- payload.branch.should eq 'master'
14
+ it "sets commit branch" do
15
+ expect(payload.branch).to eq "master"
16
16
  end
17
17
 
18
- it 'sets commit message' do
19
- payload.message.should eq 'Fake commit message'
18
+ it "sets commit message" do
19
+ expect(payload.message).to eq "Fake commit message"
20
20
  end
21
21
 
22
- it 'sets author and committer' do
23
- payload.author.should eq 'Mr Jones'
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 'sets commit view url' do
28
- payload.commit_url.should eq 'http://sosedoff.beanstalkapp.com/xml-sitemap/changesets/1111111111111111111111111111111111111111'
26
+ it "sets auther email" do
27
+ expect(payload.author_email).to eq "john.jones@gmail.com"
29
28
  end
30
29
 
31
- it 'sets compare url' do
32
- payload.compare_url.should eq nil
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
- context 'when fake' do
36
- let(:data) { fixture('beanstalk/git.json') }
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 'sets skip to true' do
39
- payload.skip.should eq true
41
+ it "sets skip to true" do
42
+ expect(payload.skip).to be_true
40
43
  end
41
44
 
42
- it 'sets test to true' do
43
- payload.test.should eq true
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 'with svn payload' do
49
- let(:data) { fixture('beanstalk/svn.json') }
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 'sets commit number' do
52
- payload.commit.should eq 1
58
+ it "sets commit message" do
59
+ expect(payload.message).to eq "Creating initial repository structure"
53
60
  end
54
61
 
55
- it 'sets commit message' do
56
- payload.message.should eq 'Creating initial repository structure'
62
+ it "sets branch to master" do
63
+ expect(payload.branch).to eq "master"
57
64
  end
58
65
 
59
- it 'sets branch to master' do
60
- payload.branch.should eq 'master'
66
+ it "sets author" do
67
+ expect(payload.author).to eq "admin"
61
68
  end
62
69
 
63
- it 'sets author and committer' do
64
- payload.author.should eq 'admin'
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 'sets commit view url' do
69
- payload.commit_url.should_not eq nil
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 'with mercurial payload' do
74
- let(:data) { fixture('beanstalk/hg.json') }
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 'sets commit SHA' do
77
- payload.commit.should eq '1111111111111111111111111111111111111111'
86
+ it "sets commit branch" do
87
+ expect(payload.branch).to eq "default"
78
88
  end
79
89
 
80
- it 'sets commit branch' do
81
- payload.branch.should eq 'default'
90
+ it "sets commit message" do
91
+ expect(payload.message).to eq "Fake commit message"
82
92
  end
83
93
 
84
- it 'sets commit message' do
85
- payload.message.should eq 'Fake commit message'
94
+ it "sets author and committer" do
95
+ expect(payload.author).to eq "Mr Jones"
86
96
  end
87
97
 
88
- it 'sets author and committer' do
89
- payload.author.should eq 'Mr Jones'
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 'sets commit view url' do
94
- payload.commit_url.should eq 'http://sosedoff.beanstalkapp.com/beanstalk-hg1/changesets/1111111111111111111111111111111111111111'
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 'sets compare url' do
98
- payload.compare_url.should eq nil
106
+ it "sets compare url" do
107
+ expect(payload.compare_url).to be_nil
99
108
  end
100
109
 
101
- context 'when fake' do
102
- let(:data) { fixture('beanstalk/hg.json') }
110
+ context "when fake" do
111
+ let(:data) { fixture "beanstalk/hg.json" }
103
112
 
104
- it 'sets skip to true' do
105
- payload.skip.should eq true
113
+ it "sets skip to true" do
114
+ expect(payload.skip).to be_true
106
115
  end
107
116
 
108
- it 'sets test to true' do
109
- payload.test.should eq true
117
+ it "sets test to true" do
118
+ expect(payload.test).to be_true
110
119
  end
111
120
  end
112
121
  end
@@ -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("gitlab/create_branch.json") }
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("gitlab/delete_branch.json") }
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("gitlab/branch_with_slash.json") }
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 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Magnum::Payload do
4
4
  describe ".valid_source?" do
5
- it "returns true if valid" do
6
- expect(Magnum::Payload.valid_source?("github")).to eq true
7
- expect(Magnum::Payload.valid_source?("gitlab")).to eq true
8
- expect(Magnum::Payload.valid_source?("gitslice")).to eq true
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(Magnum::Payload.valid_source?("foobar")).to eq false
12
+ expect(described_class.valid_source?("foobar")).to eq false
16
13
  end
17
14
  end
18
15
 
19
- describe '.parse' do
20
- it 'returns payload instance for github' do
21
- payload = Magnum::Payload.parse('github', fixture('github.json'))
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 'returns payload instance for gitslice' do
26
- payload = Magnum::Payload.parse('gitslice', fixture('gitslice.json'))
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 'returns payload instance for bitbucket' do
36
- payload = Magnum::Payload.parse('bitbucket', fixture('bitbucket/git.json'))
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 'returns payload instance for beanstalk' do
41
- payload = Magnum::Payload.parse('beanstalk', fixture('beanstalk/git.json'))
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 'raises error if source is invalid' do
46
- expect { Magnum::Payload.parse('foobar', 'bar') }.
47
- to raise_error Magnum::Payload::PayloadError, 'Invalid payload type: foobar'
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.3.5
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-02-15 00:00:00.000000000 Z
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
@@ -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