kid80-cijoe 0.2.0 → 0.2.1

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.markdown CHANGED
@@ -83,6 +83,18 @@ Or do it the old fashion way:
83
83
  etc.
84
84
 
85
85
 
86
+ Checkin' Status
87
+ ---------------
88
+
89
+ Want to see how your build's doing without any of this fancy UI crap?
90
+ Ping Joe for the lowdown:
91
+
92
+ curl http://localhost:4567/ping
93
+
94
+ Joe will return `200 OK` if all is quiet on the Western Front. If
95
+ Joe's busy building or your last build failed, you'll get `412
96
+ PRECONDITION FAILED`.
97
+
86
98
  Multiple Projects
87
99
  -----------------
88
100
 
data/Rakefile CHANGED
@@ -16,6 +16,7 @@ begin
16
16
  gemspec.authors = ["Chris Wanstrath"]
17
17
  gemspec.add_dependency 'choice'
18
18
  gemspec.add_dependency 'sinatra'
19
+ gemspec.add_development_dependency 'rack-test'
19
20
  gemspec.version = CIJoe::Version.to_s
20
21
  end
21
22
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
@@ -11,6 +11,10 @@
11
11
  padding: 0;
12
12
  }
13
13
 
14
+ html, body {
15
+ height: 100%;
16
+ }
17
+
14
18
  body {
15
19
  background-color: white;
16
20
  font: 13.34px helvetica, arial, clean, sans-serif;
@@ -23,7 +27,7 @@ h1, h2, h3, h4, h5, h6 {
23
27
  }
24
28
 
25
29
  h1 {
26
- margin-bottom: 1em;
30
+ margin-bottom: 4px;
27
31
  }
28
32
 
29
33
  h1 a {
@@ -40,7 +44,7 @@ h1 a {
40
44
  }
41
45
 
42
46
  .errored, .color33 {
43
- color: yellow !important;
47
+ color: #c4b430 !important;
44
48
  }
45
49
 
46
50
  p {
@@ -56,7 +60,7 @@ a:hover {
56
60
  }
57
61
 
58
62
  a:visited {
59
- color: #a0a;
63
+ color: #00a;
60
64
  }
61
65
 
62
66
  table {
@@ -94,8 +98,7 @@ ul.posts {
94
98
  .site {
95
99
  font-size: 110%;
96
100
  text-align: justify;
97
- width: 40em;
98
- margin: 3em auto 2em auto;
101
+ width: 100%;
99
102
  line-height: 1.5em;
100
103
  }
101
104
 
@@ -156,6 +159,10 @@ ul.posts {
156
159
  border: 0;
157
160
  }
158
161
 
162
+ input {
163
+ float: right;
164
+ margin-right:5px;
165
+ }
159
166
  /*****************************************************************************/
160
167
  /*
161
168
  /* Posts
@@ -169,8 +176,8 @@ ul.posts {
169
176
  /* standard */
170
177
 
171
178
  #post pre {
172
- border: 1px solid #ddd;
173
- background-color: #eef;
179
+ border: 2px solid #ddd;
180
+ background-color: #333;
174
181
  padding: 0 .4em;
175
182
  }
176
183
 
@@ -193,11 +200,11 @@ ul.posts {
193
200
  /* terminal */
194
201
 
195
202
  pre.terminal {
196
- border: 1px solid black;
203
+ border: 2px solid #999;
197
204
  background-color: #fff;
198
205
  color: #333;
199
- padding: 5px;
200
- overflow: auto;
206
+ padding: 15px;
207
+ /* overflow: auto; */
201
208
  word-wrap: break-word;
202
209
  }
203
210
 
@@ -206,3 +213,9 @@ pre.terminal code {
206
213
  background-color: #fff;
207
214
  }
208
215
 
216
+ pre {
217
+ white-space: pre-wrap; /* CSS2.1 compliant */
218
+ white-space: -moz-pre-wrap; /* Mozilla-based browsers */
219
+ white-space: o-pre-wrap; /* Opera 7+ */
220
+ }
221
+
data/lib/cijoe/server.rb CHANGED
@@ -3,6 +3,8 @@ require 'erb'
3
3
 
4
4
  class CIJoe
5
5
  class Server < Sinatra::Base
6
+ attr_reader :joe
7
+
6
8
  dir = File.dirname(File.expand_path(__FILE__))
7
9
 
8
10
  set :views, "#{dir}/views"
@@ -10,16 +12,24 @@ class CIJoe
10
12
  set :static, true
11
13
  set :lock, true
12
14
 
13
- before { @joe.restore }
15
+ before { joe.restore }
16
+
17
+ get '/ping' do
18
+ if joe.building? || !joe.last_build || !joe.last_build.worked?
19
+ halt 412, joe.last_build ? joe.last_build.sha : "building"
20
+ end
21
+
22
+ joe.last_build.sha
23
+ end
14
24
 
15
25
  get '/?' do
16
- erb(:template, {}, :joe => @joe)
26
+ erb(:template, {}, :joe => joe)
17
27
  end
18
28
 
19
29
  post '/?' do
20
30
  payload = params[:payload].to_s
21
- if payload.empty? || payload.include?(@joe.git_branch)
22
- @joe.build
31
+ if payload.empty? || payload.include?(joe.git_branch)
32
+ joe.build
23
33
  end
24
34
  redirect request.path
25
35
  end
data/lib/cijoe/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class CIJoe
2
- Version = "0.2.0"
2
+ Version = "0.2.1"
3
3
  end
@@ -2,7 +2,6 @@
2
2
  <html>
3
3
  <head>
4
4
  <link href="<%= cijoe_root %>/screen.css" media="screen" rel="stylesheet" type="text/css" />
5
- <link rel="shortcut icon" href="<%= cijoe_root %>/favicon.ico" type="image/x-icon" />
6
5
  <title><%= h(joe.project) %>: CI Joe</title>
7
6
  </head>
8
7
  <body>
@@ -30,7 +29,4 @@
30
29
  <% end %>
31
30
  </ul>
32
31
  </div>
33
-
34
- </div>
35
- </body>
36
32
  </html>
data/lib/cijoe.rb CHANGED
@@ -89,7 +89,7 @@ class CIJoe
89
89
 
90
90
  pid = fork do
91
91
  read.close
92
- STDOUT.reopen write
92
+ $stdout.reopen write
93
93
  exec cmd
94
94
  end
95
95
 
@@ -114,6 +114,7 @@ class CIJoe
114
114
  output = pipe.read
115
115
  end
116
116
 
117
+ Process.waitpid(build.pid)
117
118
  status = $?.exitstatus.to_i
118
119
  puts "#{Time.now.to_i}: Built #{build.short_sha}: status=#{status}"
119
120
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kid80-cijoe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath