greenscreen 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,3 @@
1
+ /Gemfile.lock
2
+ /config.yml
3
+ /pkg
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
4
+
5
+ gem "rake"
@@ -0,0 +1,30 @@
1
+ GreenScreen
2
+ ===========
3
+
4
+ GreenScreen is a build monitoring tool that is designed to be used as a dynamic Big Visible Chart (BVC) in your work area. It lets you add links to your build servers and displays the largest possible information on a monitor so that the team can see the build status from anywhere in the room.
5
+
6
+ Getting Started
7
+ ---------------
8
+
9
+ GreenScreen can be used to monitor jobs on any build server that publishes a information in "CruiseControl Multiple Project Summary Reporting Standard" format:
10
+
11
+ http://confluence.public.thoughtworks.org/display/CI/Multiple+Project+Summary+Reporting+Standard
12
+
13
+ This includes Jenkins/Hudson, as well as all variants of CruiseControl.
14
+
15
+ Create a "greenscreen.yml" file, to tell GreenScreen which servers you want to monitor:
16
+
17
+ # all jobs from the local Jenkins server
18
+ sources:
19
+ -
20
+ url: http://localhost:8080/cc.xml
21
+
22
+ Now, start GreenScreen with
23
+
24
+ greenscreen -c greenscreen.yml
25
+
26
+ This start a web-server listening on (by default) port 3000. Point your browser at http://localhost:3000 to see thestatus of all of your builds. The screen will refresh every 15 seconds to keep itself up to date.
27
+
28
+ NOTE: GreenScreen is set up so that the name of the project will flash when it is building, but neither Safari nor IE support blinking text. You probably want to use Firefox to get the most value out of it.
29
+
30
+ If running on Windows, I'd suggest running Firefox in full screen mode. If on a Mac, either expand the window size to take up as much space as possible, or try finding a plugin that lets you go full screen.
@@ -0,0 +1,4 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ Bundler.setup
@@ -0,0 +1,32 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'clamp'
4
+ require 'hashie'
5
+ require 'greenscreen/app'
6
+
7
+ class GreenScreenCommand < Clamp::Command
8
+
9
+ option ["-c", "--config"], "FILE", "config file", :attribute_name => :config_file, :default => "~/.greenscreen.yml"
10
+
11
+ option ["-p", "--port"], "PORT", "server port", :default => 3000 do |v|
12
+ Integer(v)
13
+ end
14
+
15
+ def default_config_file
16
+ ENV["HOME"] + "/.greenscreen.yml"
17
+ end
18
+
19
+ def load_config
20
+ @config ||= begin
21
+ signal_usage_error("no such file: #{config_file.inspect}") unless File.exist?(config_file)
22
+ Hashie::Mash.new(YAML.load_file(config_file))
23
+ end
24
+ end
25
+
26
+ def execute
27
+ GreenScreen::App.run!(:port => port, :config => load_config)
28
+ end
29
+
30
+ end
31
+
32
+ GreenScreenCommand.run
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ require "greenscreen/version"
5
+
6
+ Gem::Specification.new do |s|
7
+
8
+ s.name = "greenscreen"
9
+ s.version = GreenScreen::VERSION
10
+ s.platform = Gem::Platform::RUBY
11
+ s.authors = ["Marty Andrews", "Mike Williams"]
12
+ s.email = ["marty@cogentconsulting.com.au", "mike@cogentconsulting.com.au"]
13
+ s.homepage = ""
14
+ s.summary = "Makes the status of your builds highly visible"
15
+ s.description = <<EOT
16
+ GreenScreen is a build monitoring tool that is designed to be used as a dynamic Big Visible Chart (BVC) in your work area. It displays the status of builds from one or more build servers on a monitor, so that the team can see the status from anywhere in the room.
17
+ EOT
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
+ s.require_paths = ["lib"]
22
+
23
+ s.add_runtime_dependency "sinatra", "~> 1.2.0"
24
+ s.add_runtime_dependency "thin"
25
+ s.add_runtime_dependency "clamp", "~> 0.2.3"
26
+ s.add_runtime_dependency "hashie", ">= 1.2.0"
27
+
28
+ end
@@ -0,0 +1,60 @@
1
+ require 'erb'
2
+ require 'hashie'
3
+ require 'open-uri'
4
+ require 'rexml/document'
5
+ require 'sinatra/base'
6
+ require 'yaml'
7
+
8
+ module GreenScreen
9
+
10
+ Job = Struct.new(:name, :url, :activity, :last_run)
11
+ Run = Struct.new(:label, :time, :status)
12
+
13
+ class App < Sinatra::Base
14
+
15
+ set :app_file, __FILE__
16
+ set :server, "thin"
17
+
18
+ get '/' do
19
+
20
+ @auto_refresh_period = 15
21
+
22
+ @jobs = settings.config.sources.map do |source|
23
+ load_source(source)
24
+ end.flatten
25
+
26
+ erb :index
27
+
28
+ end
29
+
30
+ private
31
+
32
+ def load_source(source)
33
+ jobs = load_cc_xml(source.url)
34
+ if included_jobs = source.jobs
35
+ jobs = jobs.select { |j| included_jobs.member?(j.name) }
36
+ end
37
+ jobs
38
+ rescue => e
39
+ $stderr.puts "ERROR loading #{source.url.inspect}: #{e}"
40
+ end
41
+
42
+ def load_cc_xml(url)
43
+ xml = REXML::Document.new(open(url))
44
+ xml.elements["//Projects"].map do |project_element|
45
+ data = project_element.attributes
46
+ Job.new.tap do |job|
47
+ job.name = data["name"]
48
+ job.url = data["webUrl"]
49
+ job.activity = data["activity"]
50
+ job.last_run = Run.new.tap do |run|
51
+ run.label = data["lastBuildLabel"]
52
+ run.time = Time.parse(data["lastBuildTime"]).localtime
53
+ run.status = data["lastBuildStatus"]
54
+ end
55
+ end
56
+ end
57
+ end
58
+
59
+ end
60
+ end
@@ -0,0 +1,65 @@
1
+ body {
2
+ text-align: center;
3
+ margin: 0;
4
+ font-family: "Times New Roman", "Serif";
5
+ }
6
+
7
+ div {
8
+ margin: 0;
9
+ padding: 0;
10
+ }
11
+
12
+ h1 {
13
+ font-size: 96px;
14
+ font-family: "Helvetica Neue", Helvetica, Arial, "Sans Serif";
15
+ margin: 0;
16
+ }
17
+
18
+ p {
19
+ font-size: 120%;
20
+ }
21
+
22
+ a {
23
+ text-decoration: none;
24
+ color: inherit;
25
+ }
26
+
27
+ .clear {
28
+ border: none;
29
+ clear: both;
30
+ }
31
+
32
+ .build {
33
+ overflow: hidden;
34
+ }
35
+
36
+ .build .border {
37
+ height: 100%;
38
+ border: black 1px solid;
39
+ display: table;
40
+ width: 100%;
41
+ }
42
+
43
+ .build .content {
44
+ display: table-cell;
45
+ vertical-align: middle;
46
+ }
47
+
48
+ .success {
49
+ background-color: #669933;
50
+ color: #F2F2F2;
51
+ }
52
+
53
+ .failure {
54
+ background-color: #E83454;
55
+ color: #F2F2F2;
56
+ }
57
+
58
+ .unknown {
59
+ background-color: #999999;
60
+ }
61
+
62
+ .building h1 {
63
+ text-decoration: blink;
64
+ font-style: italic;
65
+ }
@@ -0,0 +1,3 @@
1
+ module GreenScreen
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,31 @@
1
+ <html>
2
+ <head>
3
+ <title>Green Screen - Monitor Your Builds</title>
4
+ <% if @auto_refresh_period %>
5
+ <meta http-equiv="refresh" content="<%= @auto_refresh_period %>" />
6
+ <% end %>
7
+ <link rel='stylesheet' href='/styles.css' type='text/css' media="screen">
8
+ <% unless @jobs.empty? %>
9
+ <style type="text/css">
10
+ .build {
11
+ height: <%= 100.0 / @jobs.size %>%;
12
+ }
13
+ </style>
14
+ <% end %>
15
+ </head>
16
+ <body>
17
+ <% @jobs.each do |job| %>
18
+ <div class="build <%= job.last_run.status %> <%= job.activity %>">
19
+ <div class="border">
20
+ <div class="content">
21
+ <h1><a href="<%= job.url %>"><%= job.name %></a></h1>
22
+ <p>
23
+ Build <strong><%= job.last_run.label %></strong>
24
+ <%= job.last_run.time.strftime("@ %R on %a, %e %b") %>
25
+ </p>
26
+ </div>
27
+ </div>
28
+ </div>
29
+ <% end %>
30
+ </body>
31
+ </html>
@@ -0,0 +1,3 @@
1
+ sources:
2
+ -
3
+ url: sample/test-cc.xml
@@ -0,0 +1,13 @@
1
+ # build-servers to monitor
2
+ sources:
3
+
4
+ # all jobs from the local Jenkins server
5
+ -
6
+ url: http://localhost:8080/cc.xml
7
+
8
+ # specific jobs from another server
9
+ -
10
+ url: http://another.build.server:8080/cc.xml
11
+ jobs:
12
+ - roodi
13
+ - runway
@@ -0,0 +1 @@
1
+ <Projects><Project webUrl="http://jenkins.example.com/job/one/" name="one" lastBuildLabel="108" lastBuildTime="2011-09-28T07:15:16Z" lastBuildStatus="Success" activity="Sleeping"/><Project webUrl="http://jenkins.example.com/job/two/" name="two" lastBuildLabel="666" lastBuildTime="2011-02-15T09:00:13Z" lastBuildStatus="Failure" activity="Sleeping"/><Project webUrl="http://jenkins.example.com/job/three/" name="three" lastBuildLabel="666" lastBuildTime="2011-02-15T09:00:13Z" lastBuildStatus="Failure" activity="Building"/></Projects>
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: greenscreen
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Marty Andrews
9
+ - Mike Williams
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2011-10-28 00:00:00.000000000Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ requirement: &70167918720160 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 1.2.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *70167918720160
26
+ - !ruby/object:Gem::Dependency
27
+ name: thin
28
+ requirement: &70167918719180 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *70167918719180
37
+ - !ruby/object:Gem::Dependency
38
+ name: clamp
39
+ requirement: &70167918718040 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 0.2.3
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *70167918718040
48
+ - !ruby/object:Gem::Dependency
49
+ name: hashie
50
+ requirement: &70167918716440 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: 1.2.0
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: *70167918716440
59
+ description: ! 'GreenScreen is a build monitoring tool that is designed to be used
60
+ as a dynamic Big Visible Chart (BVC) in your work area. It displays the status
61
+ of builds from one or more build servers on a monitor, so that the team can see
62
+ the status from anywhere in the room.
63
+
64
+ '
65
+ email:
66
+ - marty@cogentconsulting.com.au
67
+ - mike@cogentconsulting.com.au
68
+ executables:
69
+ - greenscreen
70
+ extensions: []
71
+ extra_rdoc_files: []
72
+ files:
73
+ - .gitignore
74
+ - Gemfile
75
+ - README.md
76
+ - Rakefile
77
+ - bin/greenscreen
78
+ - greenscreen.gemspec
79
+ - lib/greenscreen/app.rb
80
+ - lib/greenscreen/public/styles.css
81
+ - lib/greenscreen/version.rb
82
+ - lib/greenscreen/views/index.erb
83
+ - sample/greenscreen-test.yml
84
+ - sample/greenscreen.yml
85
+ - sample/test-cc.xml
86
+ homepage: ''
87
+ licenses: []
88
+ post_install_message:
89
+ rdoc_options: []
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ none: false
94
+ requirements:
95
+ - - ! '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ segments:
99
+ - 0
100
+ hash: 2565789720247557591
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ segments:
108
+ - 0
109
+ hash: 2565789720247557591
110
+ requirements: []
111
+ rubyforge_project:
112
+ rubygems_version: 1.8.10
113
+ signing_key:
114
+ specification_version: 3
115
+ summary: Makes the status of your builds highly visible
116
+ test_files: []