travis-surveillance 0.0.3 → 0.0.4
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/README.md +4 -7
- data/lib/travis/surveillance/build.rb +19 -7
- data/lib/travis/surveillance/cli.rb +56 -43
- data/lib/travis/surveillance/job.rb +10 -7
- data/lib/travis/surveillance/project.rb +44 -8
- data/lib/travis/surveillance/surveyor.rb +1 -2
- data/lib/travis/surveillance/version.rb +1 -1
- data/spec/support/builds/11.json +16 -0
- data/spec/support/builds/12.json +16 -0
- data/spec/support/builds/dylanegan-travis-surveillance-existing.json +39 -0
- data/spec/support/jobs/11.json +10 -0
- data/spec/support/jobs/12.json +10 -0
- data/spec/support/projects/dylanegan-travis-surveillance-existing.json +14 -0
- data/spec/support/pusher/dylanegan-travis-surveillance-build-started.json +1 -0
- data/spec/travis/surveillance/build_spec.rb +22 -6
- data/spec/travis/surveillance/job_spec.rb +6 -6
- data/spec/travis/surveillance/project_spec.rb +33 -23
- data/travis-surveillance-output.png +0 -0
- metadata +15 -2
data/README.md
CHANGED
@@ -4,19 +4,16 @@
|
|
4
4
|
|
5
5
|
[](http://travis-ci.org/dylanegan/travis-surveillance)
|
6
6
|
|
7
|
-
|
7
|
+
----------
|
8
8
|
|
9
9
|
```
|
10
10
|
$ gem install travis-surveillance
|
11
|
+
$ travis-surveillance --projects dylanegan/travis-surveillance
|
11
12
|
```
|
12
13
|
|
13
|
-
|
14
|
+

|
14
15
|
|
15
|
-
|
16
|
-
travis-surveillance --projects dylanegan/travis-surveillance
|
17
|
-
```
|
18
|
-
|
19
|
-
## License
|
16
|
+
----------
|
20
17
|
|
21
18
|
Copyright (c) 2012 Dylan Egan
|
22
19
|
|
@@ -20,9 +20,6 @@ module Travis
|
|
20
20
|
:result, :started_at]
|
21
21
|
attr_accessor *ATTRIBUTES
|
22
22
|
|
23
|
-
alias_method :status, :result
|
24
|
-
alias_method :status=, :result=
|
25
|
-
|
26
23
|
def initialize(attrs = {})
|
27
24
|
self.attributes = attrs
|
28
25
|
|
@@ -36,6 +33,7 @@ module Travis
|
|
36
33
|
|
37
34
|
job = Job.new(json.merge({'build' => self}))
|
38
35
|
jobs << job
|
36
|
+
jobs.sort_by! { |j| j.id }
|
39
37
|
job
|
40
38
|
end
|
41
39
|
|
@@ -44,6 +42,10 @@ module Travis
|
|
44
42
|
next if value.nil?
|
45
43
|
if key == 'config'
|
46
44
|
config.attributes = value
|
45
|
+
elsif key == 'matrix'
|
46
|
+
value.each do |job|
|
47
|
+
add_job(job)
|
48
|
+
end
|
47
49
|
else
|
48
50
|
send("#{key}=", (key[/_at$/] ? Time.parse(value) : value)) if ATTRIBUTES.include?(key.to_sym)
|
49
51
|
end
|
@@ -51,7 +53,7 @@ module Travis
|
|
51
53
|
end
|
52
54
|
|
53
55
|
def building?
|
54
|
-
|
56
|
+
result.nil?
|
55
57
|
end
|
56
58
|
|
57
59
|
def config
|
@@ -69,7 +71,7 @@ module Travis
|
|
69
71
|
end
|
70
72
|
|
71
73
|
def failed?
|
72
|
-
!
|
74
|
+
!result.nil? && !passed?
|
73
75
|
end
|
74
76
|
|
75
77
|
def job_for(id)
|
@@ -81,7 +83,7 @@ module Travis
|
|
81
83
|
end
|
82
84
|
|
83
85
|
def passed?
|
84
|
-
!
|
86
|
+
!result.nil? && result.zero?
|
85
87
|
end
|
86
88
|
|
87
89
|
def state
|
@@ -94,6 +96,10 @@ module Travis
|
|
94
96
|
end
|
95
97
|
end
|
96
98
|
|
99
|
+
def url
|
100
|
+
@url ||= project.url + "/builds/#{@id}"
|
101
|
+
end
|
102
|
+
|
97
103
|
private
|
98
104
|
|
99
105
|
def get_details
|
@@ -105,7 +111,13 @@ module Travis
|
|
105
111
|
end
|
106
112
|
|
107
113
|
def populate
|
108
|
-
self.attributes = get_details
|
114
|
+
self.attributes = get_details unless satisfied?
|
115
|
+
end
|
116
|
+
|
117
|
+
def satisfied?
|
118
|
+
ATTRIBUTES.each do |attr|
|
119
|
+
return false if ![:finished_at, :result].include?(attr) && send(attr).nil?
|
120
|
+
end
|
109
121
|
end
|
110
122
|
end
|
111
123
|
end
|
@@ -8,6 +8,59 @@ require "travis/surveillance"
|
|
8
8
|
module Travis
|
9
9
|
module Surveillance
|
10
10
|
module CLI
|
11
|
+
class Artist
|
12
|
+
attr_accessor :project
|
13
|
+
|
14
|
+
def initialize(project)
|
15
|
+
@project = project
|
16
|
+
end
|
17
|
+
|
18
|
+
def draw
|
19
|
+
if project.builds.any? && builds = project.builds.reverse
|
20
|
+
print "\x1b[2J\x1b[H"
|
21
|
+
|
22
|
+
latest = builds.first
|
23
|
+
|
24
|
+
table = Terminal::Table.new title: "#{project.owner}/#{project.name} (#{project.url})", style: { width: 120 } do |t|
|
25
|
+
t << ["Build", "#{latest.number} (#{latest.url})"]
|
26
|
+
t << ["Duration", latest.duration] unless latest.building?
|
27
|
+
t << ["Branch", latest.branch]
|
28
|
+
t << ["Commit", latest.commit]
|
29
|
+
t << ["Compare URL", latest.compare_url]
|
30
|
+
t << ["Author", latest.author_name]
|
31
|
+
t << ["Message", latest.message.length > 80 ? "#{latest.message[0..80]}..." : latest.message]
|
32
|
+
end
|
33
|
+
|
34
|
+
print table
|
35
|
+
print "\n\n"
|
36
|
+
|
37
|
+
table = Terminal::Table.new title: "Build Matrix", headings: ['Job', 'State', 'Duration', 'Runtime', 'ENV'], style: { width: 120 } do |t|
|
38
|
+
latest.jobs.each do |job|
|
39
|
+
t << [job.number, job.state, job.duration, job.runtime, job.config.env]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
print table
|
44
|
+
|
45
|
+
if builds.size > 1
|
46
|
+
print "\n\n"
|
47
|
+
|
48
|
+
table = Terminal::Table.new :title => "Build History", :headings => ['Build', 'State', 'Branch', 'Message', 'Duration'], style: { width: 120 } do |t|
|
49
|
+
builds.each do |build|
|
50
|
+
next if build == latest
|
51
|
+
t << [build.number, build.state, build.branch, (build.message.length > 30 ? "#{build.message[0..30]}..." : build.message), build.duration]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
print table
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
print "\x1b[H"
|
60
|
+
$stdout.flush
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
11
64
|
class Logger
|
12
65
|
def self.log(data, &block)
|
13
66
|
Scrolls.log(data, &block)
|
@@ -37,51 +90,11 @@ module Travis
|
|
37
90
|
end
|
38
91
|
|
39
92
|
surveyor = Travis::Surveillance::Surveyor.new(Travis::Surveillance::Project.new(project))
|
40
|
-
|
93
|
+
artist = Artist.new(surveyor.project)
|
94
|
+
artist.draw
|
41
95
|
|
42
96
|
surveyor.survey do
|
43
|
-
|
44
|
-
print "\x1b[2J\x1b[H"
|
45
|
-
|
46
|
-
latest = builds.first
|
47
|
-
|
48
|
-
table = Terminal::Table.new title: "#{project.owner}/#{project.name}", style: { width: 120 } do |t|
|
49
|
-
t << ["Build", latest.number]
|
50
|
-
t << ["Duration", latest.duration] unless latest.building?
|
51
|
-
t << ["Branch", latest.branch]
|
52
|
-
t << ["Commit", latest.commit]
|
53
|
-
t << ["Compare URL", latest.compare_url]
|
54
|
-
t << ["Author", latest.author_name]
|
55
|
-
t << ["Message", latest.message.length > 80 ? "#{latest.message[0..80]} ..." : latest.message]
|
56
|
-
end
|
57
|
-
|
58
|
-
print table
|
59
|
-
print "\n\n"
|
60
|
-
|
61
|
-
table = Terminal::Table.new title: "Build Matrix", headings: ['Job', 'State', 'Duration', 'Runtime', 'ENV'], style: { width: 120 } do |t|
|
62
|
-
latest.jobs.sort_by { |j| j.id }.each do |job|
|
63
|
-
t << [job.number, job.state, job.duration, job.runtime, job.config.env]
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
print table
|
68
|
-
|
69
|
-
if builds.size > 1
|
70
|
-
print "\n\n"
|
71
|
-
|
72
|
-
table = Terminal::Table.new :title => "Build History", :headings => ['Build', 'State', 'Branch', 'Message', 'Duration'], style: { width: 120 } do |t|
|
73
|
-
builds.each do |build|
|
74
|
-
next if build == latest
|
75
|
-
t << [build.number, build.state, build.branch, (build.message.length > 30 ? "#{build.message[0..30]} ..." : build.message), build.duration]
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
print table
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
print "\x1b[H"
|
84
|
-
$stdout.flush
|
97
|
+
artist.draw
|
85
98
|
end
|
86
99
|
end
|
87
100
|
end
|
@@ -19,9 +19,6 @@ module Travis
|
|
19
19
|
ATTRIBUTES = [:build, :finished_at, :id, :number, :result, :started_at]
|
20
20
|
attr_accessor *ATTRIBUTES
|
21
21
|
|
22
|
-
alias_method :status, :result
|
23
|
-
alias_method :status=, :result=
|
24
|
-
|
25
22
|
def initialize(attrs = {})
|
26
23
|
self.attributes = attrs
|
27
24
|
|
@@ -54,15 +51,15 @@ module Travis
|
|
54
51
|
end
|
55
52
|
|
56
53
|
def failed?
|
57
|
-
!
|
54
|
+
!result.nil? && !passed?
|
58
55
|
end
|
59
56
|
|
60
57
|
def passed?
|
61
|
-
!
|
58
|
+
!result.nil? && result.zero?
|
62
59
|
end
|
63
60
|
|
64
61
|
def running?
|
65
|
-
|
62
|
+
result.nil?
|
66
63
|
end
|
67
64
|
|
68
65
|
def runtime
|
@@ -96,7 +93,13 @@ module Travis
|
|
96
93
|
end
|
97
94
|
|
98
95
|
def populate
|
99
|
-
self.attributes = get_details
|
96
|
+
self.attributes = get_details unless satisfied?
|
97
|
+
end
|
98
|
+
|
99
|
+
def satisfied?
|
100
|
+
ATTRIBUTES.each do |attr|
|
101
|
+
return false if ![:finished_at, :result].include?(attr) && send(attr).nil?
|
102
|
+
end
|
100
103
|
end
|
101
104
|
end
|
102
105
|
end
|
@@ -1,14 +1,20 @@
|
|
1
1
|
module Travis
|
2
2
|
module Surveillance
|
3
3
|
class Project
|
4
|
-
|
4
|
+
ATTRIBUTES = [:description, :id, :slug]
|
5
|
+
attr_accessor *ATTRIBUTES
|
5
6
|
|
6
|
-
def initialize(
|
7
|
-
|
8
|
-
@slug = name
|
7
|
+
def initialize(slug)
|
8
|
+
self.attributes = { 'slug' => slug }
|
9
9
|
populate
|
10
10
|
end
|
11
11
|
|
12
|
+
def attributes=(attrs = {})
|
13
|
+
attrs.each do |key, value|
|
14
|
+
send("#{key}=", value) if ATTRIBUTES.include?(key.to_sym)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
12
18
|
def add_build(json)
|
13
19
|
if build = build_for(json['id'])
|
14
20
|
return build
|
@@ -16,6 +22,7 @@ module Travis
|
|
16
22
|
|
17
23
|
build = Build.new(json.merge({'project' => self}))
|
18
24
|
builds << build
|
25
|
+
builds.sort_by! { |b| b.id }
|
19
26
|
build
|
20
27
|
end
|
21
28
|
|
@@ -39,6 +46,22 @@ module Travis
|
|
39
46
|
!status.nil? && status.zero?
|
40
47
|
end
|
41
48
|
|
49
|
+
def name
|
50
|
+
@name ||= @slug.split('/')[1]
|
51
|
+
end
|
52
|
+
|
53
|
+
def owner
|
54
|
+
@owner ||= @slug.split('/')[0]
|
55
|
+
end
|
56
|
+
|
57
|
+
def status
|
58
|
+
builds.last.result if builds.any?
|
59
|
+
end
|
60
|
+
|
61
|
+
def url
|
62
|
+
@url ||= "http://travis-ci.org/#{@slug}"
|
63
|
+
end
|
64
|
+
|
42
65
|
private
|
43
66
|
|
44
67
|
def get_details
|
@@ -49,11 +72,24 @@ module Travis
|
|
49
72
|
end
|
50
73
|
end
|
51
74
|
|
75
|
+
def get_builds
|
76
|
+
if Travis::Surveillance.mocking?
|
77
|
+
if File.exists?(File.dirname(__FILE__) + "/../../../spec/support/builds/#{slug.gsub('/', '-')}.json")
|
78
|
+
JSON.parse(IO.read(File.dirname(__FILE__) + "/../../../spec/support/builds/#{slug.gsub('/', '-')}.json"))
|
79
|
+
else
|
80
|
+
[]
|
81
|
+
end
|
82
|
+
else
|
83
|
+
JSON.parse(open("http://travis-ci.org/#{slug}/builds.json").read)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
52
87
|
def populate
|
53
|
-
details = get_details
|
54
|
-
|
55
|
-
|
56
|
-
|
88
|
+
self.attributes = details = get_details
|
89
|
+
|
90
|
+
get_builds.reverse.each do |build_json|
|
91
|
+
add_build(build_json)
|
92
|
+
end if details['last_build_id']
|
57
93
|
end
|
58
94
|
end
|
59
95
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "json"
|
2
2
|
require "open-uri"
|
3
3
|
|
4
|
-
gem "pusher-client-merman"
|
4
|
+
gem "pusher-client-merman" # https://github.com/pusher/pusher-ruby-client/issues/4
|
5
5
|
require "pusher-client"
|
6
6
|
PusherClient.logger.level = Logger::INFO
|
7
7
|
|
@@ -78,7 +78,6 @@ module Travis
|
|
78
78
|
|
79
79
|
Travis::Surveillance.log({ surveyor: true, build: true, finished: true, id: build.id, number: build.number })
|
80
80
|
build.attributes = json['build']
|
81
|
-
@project.status = build.status
|
82
81
|
end
|
83
82
|
|
84
83
|
def payload_to_job_started(payload)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"id":11,
|
3
|
+
"number":"1",
|
4
|
+
"config":{
|
5
|
+
"language":"ruby"
|
6
|
+
},
|
7
|
+
"started_at":"2012-08-04T13:28:29Z",
|
8
|
+
"commit":"af0d1c46e019ff61f1faaba7003ebf912ab245d6",
|
9
|
+
"branch":"master",
|
10
|
+
"message":"Test",
|
11
|
+
"compare_url":"https://github.com/dylanegan/travis-surveillance/compare/74791a0faacf...af0d1c46e019",
|
12
|
+
"committed_at":"2012-08-04T13:28:22Z",
|
13
|
+
"author_name":"Dylan Egan",
|
14
|
+
"committer_name":"Dylan Egan",
|
15
|
+
"result":0
|
16
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"id":12,
|
3
|
+
"number":"2",
|
4
|
+
"config":{
|
5
|
+
"language":"ruby"
|
6
|
+
},
|
7
|
+
"started_at":"2012-08-04T13:38:29Z",
|
8
|
+
"commit":"asklj23289dd0983212019dhkjsdlkj290820329",
|
9
|
+
"branch":"master",
|
10
|
+
"message":"Second Build",
|
11
|
+
"compare_url":"https://github.com/dylanegan/travis-surveillance/compare/af0d1c46e019...asklj23289dd",
|
12
|
+
"committed_at":"2012-08-04T13:38:22Z",
|
13
|
+
"author_name":"Dylan Egan",
|
14
|
+
"committer_name":"Dylan Egan",
|
15
|
+
"result":0
|
16
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
[{
|
2
|
+
"id":11,
|
3
|
+
"number":"1",
|
4
|
+
"config":{
|
5
|
+
"language":"ruby"
|
6
|
+
},
|
7
|
+
"started_at":"2012-08-04T13:28:29Z",
|
8
|
+
"commit":"af0d1c46e019ff61f1faaba7003ebf912ab245d6",
|
9
|
+
"branch":"master",
|
10
|
+
"message":"Test",
|
11
|
+
"compare_url":"https://github.com/dylanegan/travis-surveillance/compare/74791a0faacf...af0d1c46e019",
|
12
|
+
"committed_at":"2012-08-04T13:28:22Z",
|
13
|
+
"author_name":"Dylan Egan",
|
14
|
+
"committer_name":"Dylan Egan",
|
15
|
+
"result":0,
|
16
|
+
"matrix": [{
|
17
|
+
"id":11,
|
18
|
+
"number":"11.1"
|
19
|
+
}]
|
20
|
+
}, {
|
21
|
+
"id":12,
|
22
|
+
"number":"2",
|
23
|
+
"config":{
|
24
|
+
"language":"ruby"
|
25
|
+
},
|
26
|
+
"started_at":"2012-08-04T13:38:29Z",
|
27
|
+
"commit":"asklj23289dd0983212019dhkjsdlkj290820329",
|
28
|
+
"branch":"master",
|
29
|
+
"message":"Second Build",
|
30
|
+
"compare_url":"https://github.com/dylanegan/travis-surveillance/compare/af0d1c46e019...asklj23289dd",
|
31
|
+
"committed_at":"2012-08-04T13:38:22Z",
|
32
|
+
"author_name":"Dylan Egan",
|
33
|
+
"committer_name":"Dylan Egan",
|
34
|
+
"result":0,
|
35
|
+
"matrix": [{
|
36
|
+
"id":12,
|
37
|
+
"number":"12.1"
|
38
|
+
}]
|
39
|
+
}]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"id":11,
|
3
|
+
"slug":"dylanegan/travis-surveillance-existing",
|
4
|
+
"description":"",
|
5
|
+
"public_key":"-----BEGIN RSA PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCPeL3PD+uSXgaF4bvK4BMfCB3g\nple4P8PD+klPMQi3FTjXgyzPqsbiTaeKka0WNtmd+BXKIdczxrbjqNIAPurE3NeT\nM8aPbnkW0HNZ+oL1AsZveUyxjwMqN6iwrPbuLEKnueSpTcBOPBk3TY7Lec/HmlPV\n2PZM4LHOgmFA1P29pwIDAQAB\n-----END RSA PUBLIC KEY-----\n",
|
6
|
+
"last_build_id":11,
|
7
|
+
"last_build_number":"1",
|
8
|
+
"last_build_status":0,
|
9
|
+
"last_build_result":0,
|
10
|
+
"last_build_duration":113,
|
11
|
+
"last_build_language":null,
|
12
|
+
"last_build_started_at":"2012-08-03T09:13:51Z",
|
13
|
+
"last_build_finished_at":"2012-08-03T09:14:31Z"
|
14
|
+
}
|
@@ -54,6 +54,22 @@ describe Travis::Surveillance::Build do
|
|
54
54
|
it "should have a started_at" do
|
55
55
|
@build.started_at.must_equal Time.parse("2012-08-04T13:28:29Z")
|
56
56
|
end
|
57
|
+
|
58
|
+
it "should have a url" do
|
59
|
+
@build.url.must_equal "http://travis-ci.org/dylanegan/travis-surveillance/builds/1"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "with history" do
|
64
|
+
before do
|
65
|
+
@history = Travis::Surveillance::Project.new("dylanegan/travis-surveillance-existing")
|
66
|
+
@build = @history.add_build({'id' => 11})
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should have jobs" do
|
70
|
+
@build.jobs.wont_be_empty
|
71
|
+
@build.jobs.first.id.must_equal 11
|
72
|
+
end
|
57
73
|
end
|
58
74
|
|
59
75
|
describe "a finished build" do
|
@@ -71,15 +87,15 @@ describe Travis::Surveillance::Build do
|
|
71
87
|
@build.finished_at.must_equal Time.parse("2012-08-04T13:28:59Z")
|
72
88
|
end
|
73
89
|
|
74
|
-
it "should have a
|
75
|
-
@build.
|
90
|
+
it "should have a result" do
|
91
|
+
@build.result.must_equal 1
|
76
92
|
end
|
77
93
|
end
|
78
94
|
|
79
|
-
describe "
|
95
|
+
describe "result" do
|
80
96
|
describe "when nil" do
|
81
97
|
before do
|
82
|
-
@build.
|
98
|
+
@build.result = nil
|
83
99
|
end
|
84
100
|
|
85
101
|
it "should be building" do
|
@@ -91,7 +107,7 @@ describe Travis::Surveillance::Build do
|
|
91
107
|
|
92
108
|
describe "when zero" do
|
93
109
|
before do
|
94
|
-
@build.
|
110
|
+
@build.result = 0
|
95
111
|
end
|
96
112
|
|
97
113
|
it "should have passed" do
|
@@ -103,7 +119,7 @@ describe Travis::Surveillance::Build do
|
|
103
119
|
|
104
120
|
describe "when one" do
|
105
121
|
before do
|
106
|
-
@build.
|
122
|
+
@build.result = 1
|
107
123
|
end
|
108
124
|
|
109
125
|
it "should have failed" do
|
@@ -48,15 +48,15 @@ describe Travis::Surveillance::Job do
|
|
48
48
|
@job.finished_at.must_equal Time.parse("2012-08-04T13:28:59Z")
|
49
49
|
end
|
50
50
|
|
51
|
-
it "should have a
|
52
|
-
@job.
|
51
|
+
it "should have a result" do
|
52
|
+
@job.result.must_equal 1
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
describe "
|
56
|
+
describe "result" do
|
57
57
|
describe "when nil" do
|
58
58
|
before do
|
59
|
-
@job.
|
59
|
+
@job.result = nil
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should be running" do
|
@@ -68,7 +68,7 @@ describe Travis::Surveillance::Job do
|
|
68
68
|
|
69
69
|
describe "when zero" do
|
70
70
|
before do
|
71
|
-
@job.
|
71
|
+
@job.result = 0
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should have passed" do
|
@@ -80,7 +80,7 @@ describe Travis::Surveillance::Job do
|
|
80
80
|
|
81
81
|
describe "when one" do
|
82
82
|
before do
|
83
|
-
@job.
|
83
|
+
@job.result = 1
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should have failed" do
|
@@ -21,44 +21,54 @@ describe Travis::Surveillance::Project do
|
|
21
21
|
@project.description.must_equal ""
|
22
22
|
end
|
23
23
|
|
24
|
-
it "should have a
|
25
|
-
@project.
|
24
|
+
it "should have a url" do
|
25
|
+
@project.url.must_equal "http://travis-ci.org/dylanegan/travis-surveillance"
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "with history" do
|
29
|
+
before do
|
30
|
+
@history = Travis::Surveillance::Project.new("dylanegan/travis-surveillance-existing")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should have builds" do
|
34
|
+
@history.builds.wont_be_empty
|
35
|
+
@history.builds.first.id.must_equal 11
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should have a status" do
|
39
|
+
@history.status.must_equal 0
|
40
|
+
@history.passed?.must_equal true
|
41
|
+
end
|
26
42
|
end
|
27
43
|
|
28
44
|
describe "status" do
|
29
45
|
describe "when nil" do
|
30
|
-
before do
|
31
|
-
@project.status = nil
|
32
|
-
end
|
33
|
-
|
34
46
|
it "should be building" do
|
35
|
-
@project.
|
36
|
-
|
37
|
-
|
47
|
+
@project.stub :status, nil do
|
48
|
+
@project.building?.must_equal true
|
49
|
+
@project.failed?.must_equal false
|
50
|
+
@project.passed?.must_equal false
|
51
|
+
end
|
38
52
|
end
|
39
53
|
end
|
40
54
|
|
41
55
|
describe "when zero" do
|
42
|
-
before do
|
43
|
-
@project.status = 0
|
44
|
-
end
|
45
|
-
|
46
56
|
it "should have passed" do
|
47
|
-
@project.
|
48
|
-
|
49
|
-
|
57
|
+
@project.stub :status, 0 do
|
58
|
+
@project.building?.must_equal false
|
59
|
+
@project.failed?.must_equal false
|
60
|
+
@project.passed?.must_equal true
|
61
|
+
end
|
50
62
|
end
|
51
63
|
end
|
52
64
|
|
53
65
|
describe "when one" do
|
54
|
-
before do
|
55
|
-
@project.status = 1
|
56
|
-
end
|
57
|
-
|
58
66
|
it "should have failed" do
|
59
|
-
@project.
|
60
|
-
|
61
|
-
|
67
|
+
@project.stub :status, 1 do
|
68
|
+
@project.building?.must_equal false
|
69
|
+
@project.failed?.must_equal true
|
70
|
+
@project.passed?.must_equal false
|
71
|
+
end
|
62
72
|
end
|
63
73
|
end
|
64
74
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: travis-surveillance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: clamp
|
@@ -132,8 +132,14 @@ files:
|
|
132
132
|
- logs/.gitignore
|
133
133
|
- spec/helper.rb
|
134
134
|
- spec/support/builds/1.json
|
135
|
+
- spec/support/builds/11.json
|
136
|
+
- spec/support/builds/12.json
|
137
|
+
- spec/support/builds/dylanegan-travis-surveillance-existing.json
|
135
138
|
- spec/support/jobs/1.json
|
139
|
+
- spec/support/jobs/11.json
|
140
|
+
- spec/support/jobs/12.json
|
136
141
|
- spec/support/jobs/2.json
|
142
|
+
- spec/support/projects/dylanegan-travis-surveillance-existing.json
|
137
143
|
- spec/support/projects/dylanegan-travis-surveillance.json
|
138
144
|
- spec/support/pusher/dylanegan-travis-surveillance-build-finished.json
|
139
145
|
- spec/support/pusher/dylanegan-travis-surveillance-build-started.json
|
@@ -145,6 +151,7 @@ files:
|
|
145
151
|
- spec/travis/surveillance/project_spec.rb
|
146
152
|
- spec/travis/surveillance/surveyor_spec.rb
|
147
153
|
- spec/travis/surveillance_spec.rb
|
154
|
+
- travis-surveillance-output.png
|
148
155
|
- travis-surveillance.gemspec
|
149
156
|
- travis-surveillance.jpg
|
150
157
|
homepage: https://github.com/dylanegan/travis-surveillance
|
@@ -174,8 +181,14 @@ summary: Veille sur un projet.
|
|
174
181
|
test_files:
|
175
182
|
- spec/helper.rb
|
176
183
|
- spec/support/builds/1.json
|
184
|
+
- spec/support/builds/11.json
|
185
|
+
- spec/support/builds/12.json
|
186
|
+
- spec/support/builds/dylanegan-travis-surveillance-existing.json
|
177
187
|
- spec/support/jobs/1.json
|
188
|
+
- spec/support/jobs/11.json
|
189
|
+
- spec/support/jobs/12.json
|
178
190
|
- spec/support/jobs/2.json
|
191
|
+
- spec/support/projects/dylanegan-travis-surveillance-existing.json
|
179
192
|
- spec/support/projects/dylanegan-travis-surveillance.json
|
180
193
|
- spec/support/pusher/dylanegan-travis-surveillance-build-finished.json
|
181
194
|
- spec/support/pusher/dylanegan-travis-surveillance-build-started.json
|