general-hawk 0.1.0

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.
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .DS_Store
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in general-hawk.gemspec
4
+ gemspec
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "general-hawk/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "general-hawk"
7
+ s.version = General::Hawk::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Josh Owens"]
10
+ s.email = ["joshua.owens@gmail.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{A Sinatra app to monitor multiple CIJoe Projects}
13
+ s.description = %q{A Sinatra app to monitor multiple CIJoe Projects}
14
+
15
+ s.rubyforge_project = "general-hawk"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ end
@@ -0,0 +1,39 @@
1
+ require 'sinatra/base'
2
+ require 'erb'
3
+
4
+ module General
5
+ module Hawk
6
+ class Server < Sinatra::Base
7
+
8
+ dir = File.dirname(File.expand_path(__FILE__))
9
+
10
+ set :views, "#{dir}/general-hawk/views"
11
+ set :public, "#{dir}/general-hawk/public"
12
+
13
+ get "/" do
14
+ erb(:projects, {}, :projects => options.projects)
15
+ end
16
+
17
+ helpers do
18
+ include Rack::Utils
19
+ alias_method :h, :escape_html
20
+
21
+ def pretty_time(time)
22
+ time.strftime("%Y-%m-%d %H:%M")
23
+ end
24
+
25
+ def hawk_root
26
+ root = request.path
27
+ root = "" if root == "/"
28
+ root
29
+ end
30
+ end
31
+
32
+ def self.rack_start(projects)
33
+ set :projects, projects
34
+ self.new
35
+ end
36
+
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,263 @@
1
+ /*****************************************************************************/
2
+ /*
3
+ /* Common
4
+ /*
5
+ /*****************************************************************************/
6
+
7
+ /* Global Reset */
8
+
9
+ * {
10
+ margin: 0;
11
+ padding: 0;
12
+ }
13
+
14
+ html, body {
15
+ height: 100%;
16
+ }
17
+
18
+ body {
19
+ background-color: white;
20
+ font: 13.34px helvetica, arial, clean, sans-serif;
21
+ *font-size: small;
22
+ text-align: center;
23
+ }
24
+
25
+ h1, h2, h3, h4, h5, h6 {
26
+ font-size: 100%;
27
+ }
28
+
29
+ h1 {
30
+ margin-bottom: 1em;
31
+ }
32
+
33
+ h1 a {
34
+ text-decoration: none;
35
+ color: #000;
36
+ }
37
+
38
+ .failed, .color31 {
39
+ color: red !important;
40
+ }
41
+
42
+ .worked, .color32 {
43
+ color: green !important;
44
+ }
45
+
46
+ .errored, .color33 {
47
+ color: yellow !important;
48
+ }
49
+
50
+ p {
51
+ margin: 1em 0;
52
+ }
53
+
54
+ a {
55
+ color: #00a;
56
+ }
57
+
58
+ a:hover {
59
+ color: black;
60
+ }
61
+
62
+ a:visited {
63
+ color: #a0a;
64
+ }
65
+
66
+ table {
67
+ font-size: inherit;
68
+ font: 100%;
69
+ }
70
+
71
+ /*****************************************************************************/
72
+ /*
73
+ /* Home
74
+ /*
75
+ /*****************************************************************************/
76
+
77
+ ul.posts {
78
+ list-style-type: none;
79
+ margin-bottom: 2em;
80
+ }
81
+
82
+ ul.posts li {
83
+ line-height: 1.75em;
84
+ }
85
+
86
+ ul.posts .date,
87
+ ul.posts .duration {
88
+ color: #aaa;
89
+ font-family: Monaco, "Courier New", monospace;
90
+ font-size: 80%;
91
+ }
92
+
93
+ /*****************************************************************************/
94
+ /*
95
+ /* Site
96
+ /*
97
+ /*****************************************************************************/
98
+
99
+ .site {
100
+ font-size: 110%;
101
+ text-align: justify;
102
+ width: 80%;
103
+ margin: 3em auto 2em auto;
104
+ line-height: 1.5em;
105
+ }
106
+
107
+ .title {
108
+ color: #a00;
109
+ font-weight: bold;
110
+ margin-bottom: 2em;
111
+ }
112
+
113
+ .site .title a {
114
+ color: #a00;
115
+ text-decoration: none;
116
+ }
117
+
118
+ .site .title a:hover {
119
+ color: black;
120
+ }
121
+
122
+ .site .title .extra {
123
+ color: #aaa;
124
+ text-decoration: none;
125
+ margin-left: 1em;
126
+ font-size: 0.9em;
127
+ }
128
+
129
+ .site .title a.extra:hover {
130
+ color: black;
131
+ }
132
+
133
+ .site .meta {
134
+ color: #aaa;
135
+ }
136
+
137
+ .site .footer {
138
+ font-size: 80%;
139
+ color: #666;
140
+ border-top: 4px solid #eee;
141
+ margin-top: 2em;
142
+ overflow: hidden;
143
+ }
144
+
145
+ .site .footer .contact {
146
+ float: left;
147
+ margin-right: 3em;
148
+ }
149
+
150
+ .site .footer .contact a {
151
+ color: #8085C1;
152
+ }
153
+
154
+ .site .footer .rss {
155
+ margin-top: 1.1em;
156
+ margin-right: -.2em;
157
+ float: right;
158
+ }
159
+
160
+ .site .footer .rss img {
161
+ border: 0;
162
+ }
163
+
164
+ /*****************************************************************************/
165
+ /*
166
+ /* Projects
167
+ /*
168
+ /*****************************************************************************/
169
+
170
+ #projects {
171
+ clear:both;
172
+ }
173
+
174
+ .project {
175
+ float: left;
176
+ width: 380px;
177
+ color: white;
178
+ border: #ccc 1px solid;
179
+ background: url(/grey_gradient.png) repeat-x 0% 100%;
180
+ margin: 35px 45px 0 0;
181
+ font-size: 12px;
182
+ }
183
+
184
+ body div.failed {
185
+ border: #a60000 1px solid;
186
+ background: url(/red_gradient.png) repeat-x 0% 100%;
187
+ color: white;
188
+ }
189
+
190
+ body div.worked {
191
+ border: green 1px solid;
192
+ background: url(/green_gradient.png) repeat-x 0% 100%;
193
+ color: white;
194
+ }
195
+
196
+ .project {
197
+ padding: 15px 10px;
198
+ }
199
+
200
+ .project .project_info {
201
+ float: left;
202
+ width: 225px;
203
+ padding-left: 10px;
204
+ }
205
+
206
+ .project h1 {
207
+ margin: 0;
208
+ padding-bottom: 0;
209
+ letter-spacing:2px;
210
+ }
211
+
212
+ .project h1 a {
213
+ color: black;
214
+ text-transform: uppercase;
215
+ }
216
+
217
+ .project .status {
218
+ padding-right: 40px;
219
+ float: right;
220
+ color: black;
221
+ text-transform: capitalize;
222
+ }
223
+
224
+ .status img {
225
+ height: 32px;
226
+ }
227
+
228
+ .project ul li {
229
+ margin-right: 10px;
230
+ color: #333;
231
+ font-size: 11px;
232
+ list-style-type: none;
233
+ float: left;
234
+ }
235
+
236
+ .project li a, .project li a:visited {
237
+ color: black;
238
+ }
239
+
240
+ /* terminal */
241
+
242
+ pre.terminal {
243
+ border: 1px solid black;
244
+ background-color: #333;
245
+ color: white;
246
+ padding: 5px;
247
+ overflow: auto;
248
+ word-wrap: break-word;
249
+ }
250
+
251
+ pre.terminal code {
252
+ font-family: 'Bitstream Vera Sans Mono', 'Courier', monospace;
253
+ background-color: #333;
254
+ }
255
+
256
+ .clear {
257
+ clear: both;
258
+ }
259
+
260
+ .clear_left {
261
+ clear: left;
262
+ }
263
+
@@ -0,0 +1,16 @@
1
+ $(document).ready(function() {
2
+ $(".project h1 a").each(function(index, link) {
3
+ $.getJSON($(link).attr("href") + "/api/json", function(data){
4
+ $(link).parent().parent().parent().addClass(data.jobs[0].status);
5
+ $(link).parent().parent().siblings(".status").text(data.jobs[0].status);
6
+ github_link = "<a href=\'" + data.jobs[0].commit_url + "\'>" + data.jobs[0].short_sha + "</a>"
7
+ $(link).parent().parent().find(".github_link").html(github_link);
8
+ $(link).parent().parent().find(".duration").text(data.jobs[0].duration + " seconds");
9
+ if (data.jobs[0].status == "worked") {
10
+ $(link).parent().parent().siblings(".status").replaceWith("<span class='status'><img src='/Checked.png' /></span>")
11
+ } else {
12
+ $(link).parent().parent().siblings(".status").replaceWith("<span class='status'><img src='/Stop.png' /></span>")
13
+ }
14
+ });
15
+ });
16
+ });
@@ -0,0 +1,5 @@
1
+ module General
2
+ module Hawk
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,59 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <link href="<%= hawk_root %>/screen.css" media="screen" rel="stylesheet" type="text/css" />
5
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js" type="text/javascript"></script>
6
+ <script src="<%= hawk_root %>/site.js" type="text/javascript"></script>
7
+ <link rel="shortcut icon" href="<%= hawk_root %>/favicon.ico" type="image/x-icon" />
8
+ <title>CI Joe Projects</title>
9
+ </head>
10
+ <body>
11
+ <div class="site">
12
+ <div class="title">
13
+ <a href="/">CI Joe</a>
14
+ <span class="extra">because knowing is half the battle</span>
15
+ </div>
16
+
17
+ <div id="projects">
18
+ <% projects.each do |project| %>
19
+ <% project.gsub!(/\//, "") %>
20
+ <div class="project">
21
+ <div class="project_info">
22
+ <h1><a href="<%= "/#{project}" %>"><%= project %></a></h1>
23
+ <ul class="clear_left">
24
+ <li class="github_link">Build Link</li>
25
+ <li class="duration">Duration</li>
26
+ </ul>
27
+ </div>
28
+ <span class="status">Status: Unknown</span>
29
+ </div>
30
+ <% end %>
31
+ </div>
32
+
33
+ <div class="clear"></div>
34
+ <div class="footer">
35
+ <div class="contact">
36
+ <p>
37
+ <a href="https://github.com/defunkt/cijoe#readme">Documentation</a><br/>
38
+ <a href="https://github.com/defunkt/cijoe">Source</a><br/>
39
+ <a href="https://github.com/defunkt/cijoe/issues">Issues</a><br/>
40
+ <a href="https://github.com/defunkt/cijoe/tree/v<%= CIJoe::VERSION %>">v<%= CIJoe::VERSION %></a>
41
+ </p>
42
+ </div>
43
+ <div class="contact">
44
+ <p>
45
+ Designed by <a href="http://tom.preston-werner.com/">Tom Preston-Werner</a><br/>
46
+ Influenced by <a href="http://integrityapp.com/">Integrity</a><br/>
47
+ Built with <a href="http://sinatrarb.com/">Sinatra</a><br/>
48
+ Keep it simple, Sam.
49
+ </p>
50
+ </div>
51
+ <div class="rss">
52
+ <a href="http://github.com/defunkt/cijoe">
53
+ <img src="<%= hawk_root %>/octocat.png" alt="Octocat!" />
54
+ </a>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </body>
59
+ </html>
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: general-hawk
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Josh Owens
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-02-11 00:00:00 -05:00
19
+ default_executable:
20
+ dependencies: []
21
+
22
+ description: A Sinatra app to monitor multiple CIJoe Projects
23
+ email:
24
+ - joshua.owens@gmail.com
25
+ executables: []
26
+
27
+ extensions: []
28
+
29
+ extra_rdoc_files: []
30
+
31
+ files:
32
+ - .gitignore
33
+ - Gemfile
34
+ - Rakefile
35
+ - general-hawk.gemspec
36
+ - lib/general-hawk.rb
37
+ - lib/general-hawk/public/Checked.png
38
+ - lib/general-hawk/public/Stop.png
39
+ - lib/general-hawk/public/green_gradient.png
40
+ - lib/general-hawk/public/grey_gradient.png
41
+ - lib/general-hawk/public/red_gradient.png
42
+ - lib/general-hawk/public/screen.css
43
+ - lib/general-hawk/public/site.js
44
+ - lib/general-hawk/version.rb
45
+ - lib/general-hawk/views/projects.erb
46
+ has_rdoc: true
47
+ homepage: ""
48
+ licenses: []
49
+
50
+ post_install_message:
51
+ rdoc_options: []
52
+
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 3
70
+ segments:
71
+ - 0
72
+ version: "0"
73
+ requirements: []
74
+
75
+ rubyforge_project: general-hawk
76
+ rubygems_version: 1.4.2
77
+ signing_key:
78
+ specification_version: 3
79
+ summary: A Sinatra app to monitor multiple CIJoe Projects
80
+ test_files: []
81
+