ci_in_a_can 0.0.20 → 0.0.21

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.
data/ci_in_a_can.gemspec CHANGED
@@ -32,4 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.add_runtime_dependency "octokit"
33
33
  spec.add_runtime_dependency "daemons"
34
34
  spec.add_runtime_dependency "subtle"
35
+ spec.add_runtime_dependency "systemu"
35
36
  end
@@ -27,6 +27,22 @@ module CiInACan
27
27
  #{test_result.id}
28
28
  </td>
29
29
  </tr>
30
+ <tr>
31
+ <td>
32
+ Repo
33
+ </td>
34
+ <td>
35
+ #{test_result.repo}
36
+ </td>
37
+ </tr>
38
+ <tr>
39
+ <td>
40
+ Branch
41
+ </td>
42
+ <td>
43
+ #{test_result.branch}
44
+ </td>
45
+ </tr>
30
46
  <tr>
31
47
  <td>
32
48
  Created At
@@ -67,6 +83,9 @@ EOF
67
83
  <td>
68
84
  #{run.repo}
69
85
  </td>
86
+ <td>
87
+ #{run.branch}
88
+ </td>
70
89
  <td>
71
90
  #{run.passed ? 'Yes' : 'No'}
72
91
  </td>
@@ -7,7 +7,7 @@ module CiInACan
7
7
  end
8
8
 
9
9
  attr_accessor :id, :git_ssh, :sha,
10
- :local_location, :repo,
10
+ :local_location, :repo, :branch,
11
11
  :created_at
12
12
 
13
13
  def self.parse content
@@ -8,7 +8,9 @@ module CiInACan
8
8
 
9
9
  CiInACan::Build.new(git_ssh: "git@github.com:#{project}.git",
10
10
  repo: project,
11
+ branch: extract_branch_from(payload),
11
12
  sha: extract_sha_from(payload))
13
+
12
14
  end
13
15
 
14
16
  private
@@ -32,5 +34,9 @@ module CiInACan
32
34
  payload['head_commit']['id']
33
35
  end
34
36
 
37
+ def extract_branch_from payload
38
+ payload['ref'].sub('refs/heads/', '')
39
+ end
40
+
35
41
  end
36
42
  end
@@ -18,7 +18,8 @@ module CiInACan
18
18
  passed: test_result.passed,
19
19
  build_id: build.id,
20
20
  sha: build.sha,
21
- repo: build.repo
21
+ repo: build.repo,
22
+ branch: build.branch
22
23
  }
23
24
  CiInACan::Persistence.save("test_run_list", test_result.created_at, data)
24
25
  end
@@ -12,6 +12,9 @@ module CiInACan
12
12
  attr_accessor :id
13
13
  attr_accessor :passed, :output
14
14
  attr_accessor :created_at
15
+ attr_accessor :build_id
16
+ attr_accessor :branch
17
+ attr_accessor :repo
15
18
 
16
19
  def self.create values
17
20
  test_result = create_the_test_result_from values
@@ -4,14 +4,16 @@ module CiInACan
4
4
 
5
5
  def self.run_tests_for build
6
6
  bash_result = run get_commands_for(build)
7
- build_test_result_from bash_result
7
+ build_test_result_from bash_result, build
8
8
  end
9
9
 
10
10
  private
11
11
 
12
- def self.build_test_result_from bash_result
12
+ def self.build_test_result_from bash_result, build
13
13
  CiInACan::TestResult.create( { passed: bash_result.successful,
14
- output: bash_result.output } )
14
+ output: bash_result.output,
15
+ build_id: build.id,
16
+ branch: build.branch } )
15
17
  end
16
18
 
17
19
  def self.run commands
@@ -1,3 +1,3 @@
1
1
  module CiInACan
2
- VERSION = "0.0.20"
2
+ VERSION = "0.0.21"
3
3
  end
@@ -2,18 +2,24 @@ require_relative '../spec_helper'
2
2
 
3
3
  describe CiInACan::GithubBuildParser do
4
4
 
5
- [:compare, :sha, :git_ssh, :repo].to_objects {[
6
- ["https://github.com/darrencauthon/ci_in_a_can/commit/b1c5f9c9588f", "qwe", "git@github.com:darrencauthon/ci_in_a_can.git", "darrencauthon/ci_in_a_can"],
7
- ["https://github.com/abc/123/commit/b1c5f9c9588f", "uio", "git@github.com:abc/123.git", "abc/123"]
5
+ [:branch, :compare, :sha, :git_ssh, :repo].to_objects {[
6
+ ["blah", "https://github.com/darrencauthon/ci_in_a_can/commit/b1c5f9c9588f", "qwe", "git@github.com:darrencauthon/ci_in_a_can.git", "darrencauthon/ci_in_a_can"],
7
+ ["bloo", "https://github.com/abc/123/commit/b1c5f9c9588f", "uio", "git@github.com:abc/123.git", "abc/123"],
8
+ ["issues/5/blop", "https://github.com/abc/123/commit/b1c5f9c9588f", "uio", "git@github.com:abc/123.git", "abc/123"]
8
9
  ]}.each do |test|
9
10
 
10
11
  describe "parse" do
11
12
 
13
+ let(:ref) { "refs/heads/#{test.branch}" }
14
+
15
+ # content is a representation of the web request
16
+ # that github will send on every push
12
17
  let(:content) do
13
18
  {
14
19
  payload: {
15
20
  compare: test.compare,
16
- head_commit: { id: test.sha }
21
+ head_commit: { id: test.sha },
22
+ ref: ref
17
23
  }.to_json
18
24
  }.to_json
19
25
  end
@@ -33,6 +39,11 @@ describe CiInACan::GithubBuildParser do
33
39
  build.sha.must_equal test.sha
34
40
  end
35
41
 
42
+ it "should stamp the branch" do
43
+ build = CiInACan::GithubBuildParser.new.parse content
44
+ build.branch.must_equal test.branch
45
+ end
46
+
36
47
  end
37
48
 
38
49
  end
@@ -17,8 +17,7 @@ describe CiInACan::LastRunList do
17
17
  results = CiInACan::LastRunList.all
18
18
  results.count.must_equal 1
19
19
 
20
- expected = { created_at: test_result.created_at }
21
- results.first.contrast_with! expected
20
+ results.first.created_at.must_equal test_result.created_at
22
21
  end
23
22
 
24
23
  it "should track the test_result_id" do
@@ -29,32 +28,38 @@ describe CiInACan::LastRunList do
29
28
 
30
29
  results = CiInACan::LastRunList.all
31
30
 
32
- results.first[:test_result_id].must_equal test_result.id
31
+ results.first.test_result_id.must_equal test_result.id
33
32
 
34
33
  end
35
34
 
36
35
  it "should track the build id" do
37
36
  build.id = UUID.new.generate
38
37
  CiInACan::LastRunList.add build, test_result
39
- CiInACan::LastRunList.all.first[:build_id].must_equal build.id
38
+ CiInACan::LastRunList.all.first.build_id.must_equal build.id
40
39
  end
41
40
 
42
41
  it "should track the build id" do
43
42
  build.id = UUID.new.generate
44
43
  CiInACan::LastRunList.add build, test_result
45
- CiInACan::LastRunList.all.first[:build_id].must_equal build.id
44
+ CiInACan::LastRunList.all.first.build_id.must_equal build.id
46
45
  end
47
46
 
48
47
  it "should track the build sha" do
49
48
  build.sha = UUID.new.generate
50
49
  CiInACan::LastRunList.add build, test_result
51
- CiInACan::LastRunList.all.first[:sha].must_equal build.sha
50
+ CiInACan::LastRunList.all.first.sha.must_equal build.sha
52
51
  end
53
52
 
54
53
  it "should track the build repo" do
55
54
  build.repo = UUID.new.generate
56
55
  CiInACan::LastRunList.add build, test_result
57
- CiInACan::LastRunList.all.first[:repo].must_equal build.repo
56
+ CiInACan::LastRunList.all.first.repo.must_equal build.repo
57
+ end
58
+
59
+ it "should track the branch" do
60
+ build.branch = UUID.new.generate
61
+ CiInACan::LastRunList.add build, test_result
62
+ CiInACan::LastRunList.all.first.branch.must_equal build.branch
58
63
  end
59
64
 
60
65
  [true, false].each do |passed|
@@ -70,7 +75,7 @@ describe CiInACan::LastRunList do
70
75
 
71
76
  results = CiInACan::LastRunList.all
72
77
 
73
- results.first[:passed].must_equal passed
78
+ results.first.passed.must_equal passed
74
79
  end
75
80
 
76
81
  end
@@ -92,9 +97,9 @@ describe CiInACan::LastRunList do
92
97
  test_results.each { |t| CiInACan::LastRunList.add build, t }
93
98
 
94
99
  results = CiInACan::LastRunList.all
95
- results[0][:test_result_id].must_equal 'c'
96
- results[1][:test_result_id].must_equal 'b'
97
- results[2][:test_result_id].must_equal 'a'
100
+ results[0].test_result_id.must_equal 'c'
101
+ results[1].test_result_id.must_equal 'b'
102
+ results[2].test_result_id.must_equal 'a'
98
103
  end
99
104
 
100
105
  end
@@ -50,6 +50,24 @@ describe CiInACan::TestRunner do
50
50
  result.output.must_be_same_as output
51
51
  end
52
52
 
53
+ it "should pass the id from the build" do
54
+ build.id = Object.new
55
+ result = CiInACan::TestRunner.run_tests_for build
56
+ result.build_id.must_be_same_as build.id
57
+ end
58
+
59
+ it "should pass the branch from the build" do
60
+ build.branch = Object.new
61
+ result = CiInACan::TestRunner.run_tests_for build
62
+ result.branch.must_be_same_as build.branch
63
+ end
64
+
65
+ it "should pass the repo from the build" do
66
+ build.repo = Object.new
67
+ result = CiInACan::TestRunner.run_tests_for build
68
+ result.repo.must_be_same_as build.repo
69
+ end
70
+
53
71
  it "should return a passed test result if the command returns true" do
54
72
  bash_result.stubs(:successful).returns true
55
73
  result = CiInACan::TestRunner.run_tests_for build
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ci_in_a_can
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Darren Cauthon
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-02-15 00:00:00.000000000 Z
12
+ date: 2014-02-16 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bundler
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :development
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ~>
25
28
  - !ruby/object:Gem::Version
@@ -27,169 +30,209 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: mocha
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - '>='
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - '>='
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: subtle
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: contrast
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: timecop
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - '>='
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - '>='
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: rake
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - '>='
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0'
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - '>='
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0'
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: sinatra
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
- - - '>='
115
+ - - ! '>='
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
- - - '>='
123
+ - - ! '>='
109
124
  - !ruby/object:Gem::Version
110
125
  version: '0'
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: json
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
- - - '>='
131
+ - - ! '>='
116
132
  - !ruby/object:Gem::Version
117
133
  version: '0'
118
134
  type: :runtime
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
- - - '>='
139
+ - - ! '>='
123
140
  - !ruby/object:Gem::Version
124
141
  version: '0'
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: uuid
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
- - - '>='
147
+ - - ! '>='
130
148
  - !ruby/object:Gem::Version
131
149
  version: '0'
132
150
  type: :runtime
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
- - - '>='
155
+ - - ! '>='
137
156
  - !ruby/object:Gem::Version
138
157
  version: '0'
139
158
  - !ruby/object:Gem::Dependency
140
159
  name: listen
141
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
142
162
  requirements:
143
- - - '>='
163
+ - - ! '>='
144
164
  - !ruby/object:Gem::Version
145
165
  version: '0'
146
166
  type: :runtime
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
149
170
  requirements:
150
- - - '>='
171
+ - - ! '>='
151
172
  - !ruby/object:Gem::Version
152
173
  version: '0'
153
174
  - !ruby/object:Gem::Dependency
154
175
  name: octokit
155
176
  requirement: !ruby/object:Gem::Requirement
177
+ none: false
156
178
  requirements:
157
- - - '>='
179
+ - - ! '>='
158
180
  - !ruby/object:Gem::Version
159
181
  version: '0'
160
182
  type: :runtime
161
183
  prerelease: false
162
184
  version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
163
186
  requirements:
164
- - - '>='
187
+ - - ! '>='
165
188
  - !ruby/object:Gem::Version
166
189
  version: '0'
167
190
  - !ruby/object:Gem::Dependency
168
191
  name: daemons
169
192
  requirement: !ruby/object:Gem::Requirement
193
+ none: false
170
194
  requirements:
171
- - - '>='
195
+ - - ! '>='
172
196
  - !ruby/object:Gem::Version
173
197
  version: '0'
174
198
  type: :runtime
175
199
  prerelease: false
176
200
  version_requirements: !ruby/object:Gem::Requirement
201
+ none: false
177
202
  requirements:
178
- - - '>='
203
+ - - ! '>='
179
204
  - !ruby/object:Gem::Version
180
205
  version: '0'
181
206
  - !ruby/object:Gem::Dependency
182
207
  name: subtle
183
208
  requirement: !ruby/object:Gem::Requirement
209
+ none: false
184
210
  requirements:
185
- - - '>='
211
+ - - ! '>='
186
212
  - !ruby/object:Gem::Version
187
213
  version: '0'
188
214
  type: :runtime
189
215
  prerelease: false
190
216
  version_requirements: !ruby/object:Gem::Requirement
217
+ none: false
191
218
  requirements:
192
- - - '>='
219
+ - - ! '>='
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ - !ruby/object:Gem::Dependency
223
+ name: systemu
224
+ requirement: !ruby/object:Gem::Requirement
225
+ none: false
226
+ requirements:
227
+ - - ! '>='
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :runtime
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ none: false
234
+ requirements:
235
+ - - ! '>='
193
236
  - !ruby/object:Gem::Version
194
237
  version: '0'
195
238
  description: Fast CI. Still a WIP.
@@ -243,26 +286,33 @@ files:
243
286
  homepage: ''
244
287
  licenses:
245
288
  - MIT
246
- metadata: {}
247
289
  post_install_message:
248
290
  rdoc_options: []
249
291
  require_paths:
250
292
  - lib
251
293
  required_ruby_version: !ruby/object:Gem::Requirement
294
+ none: false
252
295
  requirements:
253
- - - '>='
296
+ - - ! '>='
254
297
  - !ruby/object:Gem::Version
255
298
  version: '0'
299
+ segments:
300
+ - 0
301
+ hash: 2963165488835053675
256
302
  required_rubygems_version: !ruby/object:Gem::Requirement
303
+ none: false
257
304
  requirements:
258
- - - '>='
305
+ - - ! '>='
259
306
  - !ruby/object:Gem::Version
260
307
  version: '0'
308
+ segments:
309
+ - 0
310
+ hash: 2963165488835053675
261
311
  requirements: []
262
312
  rubyforge_project:
263
- rubygems_version: 2.1.11
313
+ rubygems_version: 1.8.24
264
314
  signing_key:
265
- specification_version: 4
315
+ specification_version: 3
266
316
  summary: Fast CI. Still a WIP.
267
317
  test_files:
268
318
  - spec/ci_in_a_can/bash_result_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 64e2e19dd3ef7054409c88c4ce760c3a3b27ed00
4
- data.tar.gz: 81fefe7f8183713589a0b4790516cbcf1c83de03
5
- SHA512:
6
- metadata.gz: 89ac33194ab44d9ebd23c6fbb8a9c2d51ef99cae39263f2024281fb3ad1e93ef76f66114fde990c2746f0426a1993e56dee514d395c0a2ad5d7f70b2f4ab2b5f
7
- data.tar.gz: 1e2da649f0f2872d30fae3809a28ffc5661870c26832627855d0a389ec81eb93c7247cdbd94c8292960867f37cbaa972d86ce5b89e1681682ca2061121c59cf4