mheffner-cijoe 0.2.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,3 @@
1
+ class CIJoe
2
+ Version = "0.2.0"
3
+ end
@@ -0,0 +1,70 @@
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> &raquo;
21
+ <% if joe.current_build.sha %>
22
+ Building <a href="<%= joe.url %>/commits/<%= joe.current_build.sha %>"><%= 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> &raquo; Built <a href="<%= joe.url %>/commits/<%= joe.last_build.sha %>"><%= joe.last_build.short_sha %></a> <span class="<%= joe.last_build.status %>">(<%= joe.last_build.status %>)</span>
34
+ <% if joe.last_build.duration %>
35
+ in <span class="duration"><%= joe.last_build.duration %></span> seconds.
36
+ <% end %>
37
+ </li>
38
+ <% if joe.last_build.failed? %>
39
+ <li><pre class="terminal"><code><%=ansi_color_codes h(joe.last_build.output) %></code></pre></li>
40
+ <% end %>
41
+ <% end %>
42
+ </ul>
43
+ </div>
44
+
45
+ <div class="footer">
46
+ <div class="contact">
47
+ <p>
48
+ <a href="http://github.com/defunkt/cijoe/tree/master#readme">Documentation</a><br/>
49
+ <a href="http://github.com/defunkt/cijoe">Source</a><br/>
50
+ <a href="http://github.com/defunkt/cijoe/issues">Issues</a><br/>
51
+ <a href="http://twitter.com/defunkt">Twitter</a>
52
+ </p>
53
+ </div>
54
+ <div class="contact">
55
+ <p>
56
+ Designed by <a href="http://tom.preston-werner.com/">Tom Preston-Werner</a><br/>
57
+ Influenced by <a href="http://integrityapp.com/">Integrity</a><br/>
58
+ Built with <a href="http://sinatrarb.com/">Sinatra</a><br/>
59
+ Keep it simple, Sam.
60
+ </p>
61
+ </div>
62
+ <div class="rss">
63
+ <a href="http://github.com/defunkt/cijoe">
64
+ <img src="<%= cijoe_root %>/octocat.png" alt="Octocat!" />
65
+ </a>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ </body>
70
+ </html>
@@ -0,0 +1,12 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+
4
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
5
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
+ require 'cijoe'
7
+
8
+ CIJoe::Server.set :project_path, "."
9
+ CIJoe::Server.set :environment, "test"
10
+
11
+ class Test::Unit::TestCase
12
+ end
@@ -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,50 @@
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
+ end
17
+
18
+ def test_ping
19
+ app.joe.last_build = build :worked
20
+ assert !app.joe.building?, "have a last build, but not a current"
21
+
22
+ get "/ping"
23
+ assert_equal 200, last_response.status
24
+ assert_equal app.joe.last_build.sha, last_response.body
25
+ end
26
+
27
+ def test_ping_building
28
+ app.joe.current_build = build :building
29
+ assert app.joe.building?, "buildin' a awsum project"
30
+
31
+ get "/ping"
32
+ assert_equal 412, last_response.status
33
+ assert_equal "building", last_response.body
34
+ end
35
+
36
+ def test_ping_failed
37
+ app.joe.last_build = build :failed
38
+
39
+ get "/ping"
40
+ assert_equal 412, last_response.status
41
+ assert_equal app.joe.last_build.sha, last_response.body
42
+ end
43
+
44
+ # Create a new, fake build. All we care about is status.
45
+
46
+ def build status
47
+ CIJoe::Build.new "user", "project", Time.now, Time.now,
48
+ "deadbeef", status, "output", 1337
49
+ end
50
+ end
metadata ADDED
@@ -0,0 +1,121 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mheffner-cijoe
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
10
+ platform: ruby
11
+ authors:
12
+ - Chris Wanstrath
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-02-25 00:00:00 -05:00
18
+ default_executable: cijoe
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: choice
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: sinatra
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ type: :runtime
43
+ version_requirements: *id002
44
+ - !ruby/object:Gem::Dependency
45
+ name: rack-test
46
+ prerelease: false
47
+ requirement: &id003 !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ type: :development
55
+ version_requirements: *id003
56
+ description: CI Joe is a simple Continuous Integration server.
57
+ email: chris@ozmm.org
58
+ executables:
59
+ - cijoe
60
+ extensions: []
61
+
62
+ extra_rdoc_files:
63
+ - LICENSE
64
+ - README.markdown
65
+ files:
66
+ - .gitignore
67
+ - LICENSE
68
+ - README.markdown
69
+ - Rakefile
70
+ - bin/cijoe
71
+ - deps.rip
72
+ - examples/cijoe.ru
73
+ - examples/cijoed
74
+ - lib/cijoe.rb
75
+ - lib/cijoe/build.rb
76
+ - lib/cijoe/campfire.rb
77
+ - lib/cijoe/commit.rb
78
+ - lib/cijoe/config.rb
79
+ - lib/cijoe/public/favicon.ico
80
+ - lib/cijoe/public/octocat.png
81
+ - lib/cijoe/public/screen.css
82
+ - lib/cijoe/server.rb
83
+ - lib/cijoe/version.rb
84
+ - lib/cijoe/views/template.erb
85
+ - test/helper.rb
86
+ - test/test_cijoe.rb
87
+ - test/test_cijoe_server.rb
88
+ has_rdoc: true
89
+ homepage: http://github.com/defunkt/cijoe
90
+ licenses: []
91
+
92
+ post_install_message:
93
+ rdoc_options:
94
+ - --charset=UTF-8
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ segments:
102
+ - 0
103
+ version: "0"
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ segments:
109
+ - 0
110
+ version: "0"
111
+ requirements: []
112
+
113
+ rubyforge_project:
114
+ rubygems_version: 1.3.6
115
+ signing_key:
116
+ specification_version: 3
117
+ summary: CI Joe is a simple Continuous Integration server.
118
+ test_files:
119
+ - test/test_cijoe_server.rb
120
+ - test/test_cijoe.rb
121
+ - test/helper.rb