evrone-ci-message 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8775722eb4227ba63c0c2f29a17dada6e4754bdb
4
+ data.tar.gz: dc6e880d1838811e53669f8cd32f0b9d48d7ca9a
5
+ SHA512:
6
+ metadata.gz: ba9b50dca0214aeba4a7455f1034eb4884f3e8a45e4ece61bc6d2c5b96fe12cdc31abe3e5c44c7549226d26bb7c864b5edd785f7a7fce214f02657ae9d9a54c7
7
+ data.tar.gz: d4c4f21e139d2be4dcf54fa539638ea28b993adfcaa9ef872452bcc75b40b49d4522489b0980ca87f417b1bab77d6921039b85a46cadcf75f9a7e302e22c9ce2
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ -fd
3
+ --order=rand
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in evrone-ci-common.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Dmitry Galinsky
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Evrone::Ci::Common
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'evrone-ci-common'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install evrone-ci-common
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'evrone/ci/message/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "evrone-ci-message"
8
+ spec.version = Evrone::CI::Message::VERSION
9
+ spec.authors = ["Dmitry Galinsky"]
10
+ spec.email = ["dima@evrone.ru"]
11
+ spec.description = %q{ Evrone CI messages }
12
+ spec.summary = %q{ Evrone CI message }
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency 'ruby-protocol-buffers', '~> 1.4'
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ end
@@ -0,0 +1,27 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIIEpAIBAAKCAQEAveiqzr0nxJA48fk/T7qFrODmdT94lvt7ontGLhqNT7Z+GbqL
3
+ t45F4/5BxNgyMbSQfaJw1sGMunQfjKRdWfuKUQp0y6bNhAjtnCnoVel3SMBaXE2r
4
+ 896GkhNXc1/lz1v/1T8blc/chVeKZvQT+hDvC/KECF/+vd7yL6NRloayZdv0ks7z
5
+ CwoIeeTfEu2hd3rXDELgoiM+AAEciYe08VuytFjbONy28Ey3SGHURN418FJrJHDs
6
+ 7B5x3P89glkSta1TY4JOQtoWuxza7ylS8G1k+ss+TDB+ET3sqjDe1mxosRAfqSA7
7
+ apEZK3ALbZru3nYd26x+CE84dvH7GiKoBl0TSQIDAQABAoIBAEEAgnaBCDufod4x
8
+ EhqYHWkvEbLQJtaG/ap/x2XAcN33+PGViH0rlYCUZq6Z0ZRx2YMnNrhLR4AKf0IE
9
+ gG9sScuzaIbMcUvgQnRRY9UENHASZttxOooegLE/LY+wI1j2hHrZPvfoTfLWI+lZ
10
+ Yf0WDrxoJgk30lnrFbp4jFSZhjaWmsm1XQ4htt9bfGOBle/gJ6UTr32wF0EyOpv4
11
+ erci1RSUzyDWz0q7Tjaq6SHlwQ2JwcLG0vnrZq+YnMJUwjLhC4JAMZEKF/61KnsM
12
+ zwR9nuOE2ZDI1xH5xAA+0pNkwzxWcqryoKBrOMatDa+7ZOJEobOiq+glqmoprov4
13
+ gXXR2IECgYEA+wP1SZM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,118 @@
1
+ require File.expand_path("../message/version", __FILE__)
2
+ require 'protocol_buffers'
3
+ require 'stringio'
4
+
5
+ module Evrone
6
+ module CI
7
+ module Message
8
+
9
+ module Serializable
10
+ def to_serialized_string
11
+ StringIO.open do |io|
12
+ serialize(io)
13
+ io.rewind
14
+ io.read
15
+ end
16
+ end
17
+ end
18
+
19
+ class PerformBuild < ProtocolBuffers::Message
20
+
21
+ include Serializable
22
+
23
+ required :uint64, :id, 1
24
+ required :string, :name, 2
25
+ required :string, :src, 3
26
+ required :string, :sha, 4
27
+ optional :uint64, :pull_request_id, 5
28
+ optional :string, :deploy_key, 6
29
+
30
+ end
31
+
32
+ class PerformJob < ProtocolBuffers::Message
33
+
34
+ include Serializable
35
+
36
+ required :uint64, :id, 1
37
+ required :string, :name, 2
38
+ required :string, :src, 3
39
+ required :string, :sha, 4
40
+ optional :uint64, :pull_request_id, 5
41
+ optional :string, :deploy_key, 6
42
+
43
+ required :uint64, :job_id, 7
44
+ required :string, :travis, 8
45
+ end
46
+
47
+ class BuildLog < ProtocolBuffers::Message
48
+
49
+ include Serializable
50
+
51
+ required :uint64, :build_id, 1
52
+ required :string, :log, 2
53
+ required :uint64, :tm, 3
54
+ required :uint32, :tm_usec, 4
55
+
56
+ end
57
+
58
+ class JobLog < ProtocolBuffers::Message
59
+
60
+ include Serializable
61
+
62
+ required :uint64, :build_id, 1
63
+ required :string, :log, 2
64
+ required :uint64, :tm, 3
65
+ required :uint32, :tm_usec, 4
66
+ required :uint64, :job_id, 5
67
+
68
+ end
69
+
70
+ module Status
71
+
72
+ include ProtocolBuffers::Enum
73
+
74
+ Pending = 0
75
+ Prepared = 1
76
+ Started = 2
77
+ Finished = 3
78
+ Broken = 4
79
+ Failed = 5
80
+
81
+ end
82
+
83
+ class BuildStatus < ProtocolBuffers::Message
84
+
85
+ include Serializable
86
+
87
+ required :uint64, :build_id, 1
88
+ required Status, :status, 2
89
+ required :uint64, :tm, 3
90
+ required :uint32, :tm_usec, 4
91
+
92
+ required :uint32, :jobs_count, 5
93
+ repeated :string, :matrix, 6
94
+
95
+ optional :string, :commit_author, 7
96
+ optional :string, :commit_author_email, 8
97
+ optional :string, :commit_sha, 9
98
+ optional :string, :commit_message, 10
99
+
100
+ end
101
+
102
+ class JobStatus < BuildStatus
103
+
104
+ include Serializable
105
+
106
+ required :uint64, :build_id, 1
107
+ required :uint64, :job_id, 2
108
+ required Status, :status, 3
109
+ required :uint64, :tm, 4
110
+ required :uint32, :tm_usec, 5
111
+
112
+ repeated :string, :matrix, 6
113
+
114
+ end
115
+
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,171 @@
1
+ # coding: utf-8
2
+ require File.expand_path("../../message", __FILE__)
3
+
4
+ module Evrone
5
+ module CI
6
+ module Message
7
+
8
+ class BuildInfo
9
+ class << self
10
+
11
+ def test_attributes(options = {})
12
+ {
13
+ build_id: 1,
14
+ commit_author: 'Автор по русски',
15
+ commit_message: 'Сообщение по русски',
16
+ }.merge(options)
17
+ end
18
+
19
+ def test_message(options = {})
20
+ new test_attributes(options)
21
+ end
22
+
23
+ end
24
+ end
25
+
26
+ class JobStatus
27
+ class << self
28
+
29
+ def test_attributes(options = {})
30
+ {
31
+ build_id: 1,
32
+ job_id: 2,
33
+ status: 0,
34
+ tm: 1376137604,
35
+ tm_usec: 1234,
36
+ matrix: ["env:FOO = 1", "rvm:1.9.3"]
37
+ }.merge(options)
38
+ end
39
+
40
+ def test_message(options = {})
41
+ new test_attributes(options)
42
+ end
43
+
44
+ end
45
+ end
46
+
47
+ class BuildStatus
48
+ class << self
49
+
50
+ def test_attributes(options = {})
51
+ {
52
+ build_id: 1,
53
+ status: 0,
54
+ tm: 1376137604,
55
+ tm_usec: 1234,
56
+ jobs_count: 1,
57
+ matrix: %w{ env rvm },
58
+
59
+ commit_author: "Commit Author",
60
+ commit_author_email: "example@example.com",
61
+ commit_sha: "d3c7576e3b84bd578ce562c6d504cc7a1233adc1",
62
+ commit_message: "Commit Message"
63
+ }.merge(options)
64
+ end
65
+
66
+ def test_message(options = {})
67
+ new test_attributes(options)
68
+ end
69
+
70
+ end
71
+ end
72
+
73
+ class JobLog
74
+ class << self
75
+
76
+ def test_attributes(options = {})
77
+ {
78
+ build_id: 1,
79
+ job_id: 2,
80
+ log: 'log',
81
+ tm: 1376137604,
82
+ tm_usec: 1234,
83
+ }.merge(options)
84
+ end
85
+
86
+ def test_message(options = {})
87
+ new test_attributes(options)
88
+ end
89
+
90
+ end
91
+ end
92
+
93
+ class BuildLog
94
+ class << self
95
+
96
+ def test_attributes(options = {})
97
+ {
98
+ build_id: 1,
99
+ log: 'log',
100
+ tm: 1376137604,
101
+ tm_usec: 1234,
102
+ }.merge(options)
103
+ end
104
+
105
+ def test_message(options = {})
106
+ new test_attributes(options)
107
+ end
108
+
109
+ end
110
+ end
111
+
112
+ class PerformJob
113
+ class << self
114
+
115
+ def test_attributes(options = {})
116
+ travis = File.read File.expand_path("../../../../../fixtures/travis.yml", __FILE__)
117
+ PerformBuild.test_attributes({job_id: 2, travis: travis}.merge(options))
118
+ end
119
+
120
+ def test_pull_request_attributes(options = {})
121
+ travis = File.read File.expand_path("../../../../../fixtures/travis.yml", __FILE__)
122
+ PerformBuild.test_pull_request_attributes({job_id: 2, travis: travis}.merge(options))
123
+ end
124
+
125
+ def test_message(options = {})
126
+ new test_attributes(options)
127
+ end
128
+
129
+ def test_pull_request_message(options = {})
130
+ new test_pull_request_attributes(options)
131
+ end
132
+
133
+ end
134
+ end
135
+
136
+ class PerformBuild
137
+ class << self
138
+
139
+ def test_attributes(options = {})
140
+ key = File.read File.expand_path("../../../../../fixtures/insecure_private_key", __FILE__)
141
+ options.merge({
142
+ id: options[:id] || 1,
143
+ name: options[:name] || 'evrone/test-repo',
144
+ src: options[:src] || "git@github.com:evrone/ci-worker-test-repo.git",
145
+ sha: options[:sha] || "b665f90239563c030f1b280a434b3d84daeda1bd",
146
+ deploy_key: options[:deploy_key] || key
147
+ })
148
+ end
149
+
150
+ def test_pull_request_attributes(options = {})
151
+ options = {
152
+ sha: "84158c732ff1af3db9775a37a74ddc39f5c4078f",
153
+ pull_request_id: 4
154
+ }.merge(options)
155
+ test_attributes(options)
156
+ end
157
+
158
+ def test_message(options = {})
159
+ new test_attributes(options)
160
+ end
161
+
162
+ def test_pull_request_message(options = {})
163
+ new test_pull_request_attributes(options)
164
+ end
165
+
166
+ end
167
+ end
168
+
169
+ end
170
+ end
171
+ end
@@ -0,0 +1,7 @@
1
+ module Evrone
2
+ module CI
3
+ module Message
4
+ VERSION = "0.0.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+ require 'stringio'
3
+
4
+ describe Evrone::CI::Message do
5
+
6
+ %w{ PerformBuild PerformJob BuildLog JobLog BuildStatus JobStatus BuildInfo }.each do |klass|
7
+
8
+ context "#{klass}" do
9
+
10
+ let(:inst) { described_class.const_get klass }
11
+ subject { inst.test_message }
12
+
13
+ it "should be valid" do
14
+ expect(subject.validate!).to be_true
15
+ end
16
+
17
+ it "should be successfuly serialized/deserialized" do
18
+ io = StringIO.new
19
+ subject.serialize(io)
20
+ io.rewind
21
+ obj = described_class.const_get(klass).parse(io)
22
+ expect(obj.validate!).to be_true
23
+ end
24
+
25
+ it "should serialize via to_serialized_string" do
26
+ io = StringIO.new
27
+ subject.serialize(io)
28
+ io.rewind
29
+
30
+ expect(subject.to_serialized_string).to eq io.read
31
+ end
32
+
33
+ if %w{ PerformBuild PerformJob }.include?(klass)
34
+ context "with pull reqest" do
35
+ subject { inst.test_pull_request_message }
36
+
37
+ it "should be valid" do
38
+ expect(subject.validate!).to be_true
39
+ end
40
+
41
+ it "should have pull_request_id" do
42
+ expect(subject.pull_request_id).to be
43
+ end
44
+ end
45
+ end
46
+
47
+ if klass == 'JobStatus'
48
+ it "should have matrix" do
49
+ expect(subject.matrix).to eq ["env:FOO = 1", "rvm:1.9.3"]
50
+ end
51
+ end
52
+
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,5 @@
1
+ require 'rspec/autorun'
2
+ require File.expand_path('../../lib/evrone/ci/message/testing', __FILE__)
3
+
4
+ RSpec.configure do |c|
5
+ end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: evrone-ci-message
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dmitry Galinsky
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-08-24 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruby-protocol-buffers
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '1.3'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '1.3'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: ' Evrone CI messages '
70
+ email:
71
+ - dima@evrone.ru
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - .rspec
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - evrone-ci-message.gemspec
83
+ - fixtures/insecure_private_key
84
+ - fixtures/travis.yml
85
+ - lib/evrone/ci/message.rb
86
+ - lib/evrone/ci/message/testing.rb
87
+ - lib/evrone/ci/message/version.rb
88
+ - spec/lib/message_spec.rb
89
+ - spec/spec_helper.rb
90
+ homepage: ''
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.0.2
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Evrone CI message
114
+ test_files:
115
+ - spec/lib/message_spec.rb
116
+ - spec/spec_helper.rb