cijoe-febuiles 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.md +171 -0
- data/Rakefile +31 -0
- data/bin/cijoe +51 -0
- data/lib/cijoe.rb +233 -0
- data/lib/cijoe/build.rb +67 -0
- data/lib/cijoe/campfire.rb +74 -0
- data/lib/cijoe/commit.rb +27 -0
- data/lib/cijoe/config.rb +43 -0
- data/lib/cijoe/public/favicon.ico +0 -0
- data/lib/cijoe/public/octocat.png +0 -0
- data/lib/cijoe/public/screen.css +213 -0
- data/lib/cijoe/server.rb +108 -0
- data/lib/cijoe/version.rb +3 -0
- data/lib/cijoe/views/json.erb +8 -0
- data/lib/cijoe/views/template.erb +74 -0
- data/test/helper.rb +14 -0
- data/test/test_cijoe.rb +17 -0
- data/test/test_cijoe_server.rb +93 -0
- metadata +106 -0
@@ -0,0 +1,74 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
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
|
+
<title><%= h(joe.project) %>: CI Joe</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div class="site">
|
10
|
+
<div class="title">
|
11
|
+
<a href="<%= cijoe_root %>/">CI Joe</a>
|
12
|
+
<span class="extra">because knowing is half the battle</span>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div id="home">
|
16
|
+
<h1><a href="<%= joe.url %>"><%= joe.project %></a></h1>
|
17
|
+
<ul class="posts">
|
18
|
+
<% if joe.current_build %>
|
19
|
+
<li>
|
20
|
+
<span class="date"><%= pretty_time(joe.current_build.started_at) if joe.current_build %></span> »
|
21
|
+
<% if joe.current_build.sha %>
|
22
|
+
Building <a href="<%= joe.current_build.commit.url %>"><%= joe.current_build.short_sha %></a> <small>(pid: <%= joe.pid %>)</small>
|
23
|
+
<% else %>
|
24
|
+
Build starting...
|
25
|
+
<% end %>
|
26
|
+
</li>
|
27
|
+
<% else %>
|
28
|
+
<li><form method="POST"><input type="submit" value="Build"/></form></li>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<% if joe.last_build %>
|
32
|
+
<li>
|
33
|
+
<span class="date"><%= pretty_time(joe.last_build.finished_at) %></span> »
|
34
|
+
<% if joe.last_build.sha %>
|
35
|
+
Built <a href="<%= joe.last_build.commit.url %>"><%= joe.last_build.short_sha %></a>
|
36
|
+
<% end %>
|
37
|
+
<span class="<%= joe.last_build.status %>">(<%= joe.last_build.status %>)</span>
|
38
|
+
<% if joe.last_build.duration %>
|
39
|
+
in <span class="duration"><%= joe.last_build.duration %></span> seconds.
|
40
|
+
<% end %>
|
41
|
+
</li>
|
42
|
+
<% if joe.last_build.failed? %>
|
43
|
+
<li><pre class="terminal"><code><%=ansi_color_codes h(joe.last_build.output) %></code></pre></li>
|
44
|
+
<% end %>
|
45
|
+
<% end %>
|
46
|
+
</ul>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div class="footer">
|
50
|
+
<div class="contact">
|
51
|
+
<p>
|
52
|
+
<a href="http://github.com/defunkt/cijoe/tree/master#readme">Documentation</a><br/>
|
53
|
+
<a href="http://github.com/defunkt/cijoe">Source</a><br/>
|
54
|
+
<a href="http://github.com/defunkt/cijoe/issues">Issues</a><br/>
|
55
|
+
<a href="http://twitter.com/defunkt">Twitter</a>
|
56
|
+
</p>
|
57
|
+
</div>
|
58
|
+
<div class="contact">
|
59
|
+
<p>
|
60
|
+
Designed by <a href="http://tom.preston-werner.com/">Tom Preston-Werner</a><br/>
|
61
|
+
Influenced by <a href="http://integrityapp.com/">Integrity</a><br/>
|
62
|
+
Built with <a href="http://sinatrarb.com/">Sinatra</a><br/>
|
63
|
+
Keep it simple, Sam.
|
64
|
+
</p>
|
65
|
+
</div>
|
66
|
+
<div class="rss">
|
67
|
+
<a href="http://github.com/defunkt/cijoe">
|
68
|
+
<img src="<%= cijoe_root %>/octocat.png" alt="Octocat!" />
|
69
|
+
</a>
|
70
|
+
</div>
|
71
|
+
</div>
|
72
|
+
</div>
|
73
|
+
</body>
|
74
|
+
</html>
|
data/test/helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
ENV['RACK_ENV'] = 'test'
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
7
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
8
|
+
require 'cijoe'
|
9
|
+
|
10
|
+
CIJoe::Server.set :project_path, "."
|
11
|
+
CIJoe::Server.set :environment, "test"
|
12
|
+
|
13
|
+
class Test::Unit::TestCase
|
14
|
+
end
|
data/test/test_cijoe.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestCIJoe < Test::Unit::TestCase
|
4
|
+
def test_raise_error_on_invalid_command
|
5
|
+
assert_raise RuntimeError, LoadError do
|
6
|
+
CIJoe::Config.new('--invalid').to_s
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_return_value_of_config
|
11
|
+
assert_equal `git config blame`.chomp, CIJoe::Config.new('blame').to_s
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_return_empty_string_when_config_does_not_exist
|
15
|
+
assert_equal '', CIJoe::Config.new('invalid').to_s
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require "helper"
|
2
|
+
require "rack/test"
|
3
|
+
require "cijoe/server"
|
4
|
+
|
5
|
+
class TestCIJoeServer < Test::Unit::TestCase
|
6
|
+
include Rack::Test::Methods
|
7
|
+
|
8
|
+
class ::CIJoe
|
9
|
+
attr_writer :current_build, :last_build
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_accessor :app
|
13
|
+
|
14
|
+
def setup
|
15
|
+
@app = CIJoe::Server.new
|
16
|
+
# make Build#restore a no-op so we don't overwrite our current/last
|
17
|
+
# build attributes set from tests.
|
18
|
+
joe = @app.joe
|
19
|
+
def joe.restore
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_ping
|
24
|
+
app.joe.last_build = build :worked
|
25
|
+
assert !app.joe.building?, "have a last build, but not a current"
|
26
|
+
|
27
|
+
get "/ping"
|
28
|
+
assert_equal 200, last_response.status
|
29
|
+
assert_equal app.joe.last_build.sha, last_response.body
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_ping_building
|
33
|
+
app.joe.current_build = build :building
|
34
|
+
assert app.joe.building?, "buildin' a awsum project"
|
35
|
+
|
36
|
+
get "/ping"
|
37
|
+
assert_equal 412, last_response.status
|
38
|
+
assert_equal "building", last_response.body
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_ping_building_with_a_previous_build
|
42
|
+
app.joe.last_build = build :worked
|
43
|
+
app.joe.current_build = build :building
|
44
|
+
assert app.joe.building?, "buildin' a awsum project"
|
45
|
+
|
46
|
+
get "/ping"
|
47
|
+
assert_equal 412, last_response.status
|
48
|
+
assert_equal "building", last_response.body
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_ping_failed
|
52
|
+
app.joe.last_build = build :failed
|
53
|
+
|
54
|
+
get "/ping"
|
55
|
+
assert_equal 412, last_response.status
|
56
|
+
assert_equal app.joe.last_build.sha, last_response.body
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_ping_should_not_reset_current_build_in_tests
|
60
|
+
current_build = build :building
|
61
|
+
app.joe.current_build = current_build
|
62
|
+
assert app.joe.building?
|
63
|
+
get "/ping"
|
64
|
+
assert_equal current_build, app.joe.current_build
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_jsonp_should_return_plain_json_without_param
|
68
|
+
app.joe.last_build = build :failed
|
69
|
+
get "/api/json"
|
70
|
+
assert_equal 200, last_response.status
|
71
|
+
assert_equal 'application/json', last_response.content_type
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_jsonp_should_return_jsonp_with_param
|
75
|
+
app.joe.last_build = build :failed
|
76
|
+
get "/api/json?jsonp=fooberz"
|
77
|
+
puts last_response.inspect
|
78
|
+
assert_equal 200, last_response.status
|
79
|
+
assert_equal 'application/json', last_response.content_type
|
80
|
+
assert_match /^fooberz\(/, last_response.body
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_should_not_barf_when_no_build
|
85
|
+
end
|
86
|
+
|
87
|
+
# Create a new, fake build. All we care about is status.
|
88
|
+
|
89
|
+
def build status
|
90
|
+
CIJoe::Build.new "path", "user", "project", Time.now, Time.now,
|
91
|
+
"deadbeef", status, "output", nil
|
92
|
+
end
|
93
|
+
end
|
metadata
ADDED
@@ -0,0 +1,106 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cijoe-febuiles
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.8.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Chris Wanstrath
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-02-07 00:00:00 -05:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: choice
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sinatra
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0"
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rack-test
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
49
|
+
description: " cijoe is a sinatra-based continuous integration server. It's like an\n old rusty pickup truck: it might be smelly and gross, but it gets the\n job done.\n"
|
50
|
+
email: chris@ozmm.org
|
51
|
+
executables:
|
52
|
+
- cijoe
|
53
|
+
extensions: []
|
54
|
+
|
55
|
+
extra_rdoc_files: []
|
56
|
+
|
57
|
+
files:
|
58
|
+
- README.md
|
59
|
+
- Rakefile
|
60
|
+
- LICENSE
|
61
|
+
- lib/cijoe/build.rb
|
62
|
+
- lib/cijoe/campfire.rb
|
63
|
+
- lib/cijoe/commit.rb
|
64
|
+
- lib/cijoe/config.rb
|
65
|
+
- lib/cijoe/public/favicon.ico
|
66
|
+
- lib/cijoe/public/octocat.png
|
67
|
+
- lib/cijoe/public/screen.css
|
68
|
+
- lib/cijoe/server.rb
|
69
|
+
- lib/cijoe/version.rb
|
70
|
+
- lib/cijoe/views/json.erb
|
71
|
+
- lib/cijoe/views/template.erb
|
72
|
+
- lib/cijoe.rb
|
73
|
+
- bin/cijoe
|
74
|
+
- test/helper.rb
|
75
|
+
- test/test_cijoe.rb
|
76
|
+
- test/test_cijoe_server.rb
|
77
|
+
has_rdoc: true
|
78
|
+
homepage: http://github.com/febuiles/cijoe
|
79
|
+
licenses: []
|
80
|
+
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
|
84
|
+
require_paths:
|
85
|
+
- lib
|
86
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0"
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
none: false
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: "0"
|
98
|
+
requirements: []
|
99
|
+
|
100
|
+
rubyforge_project:
|
101
|
+
rubygems_version: 1.5.0
|
102
|
+
signing_key:
|
103
|
+
specification_version: 3
|
104
|
+
summary: cijoe builds your builds.
|
105
|
+
test_files: []
|
106
|
+
|