glennr-cijoe 0.4.3
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/.gitignore +6 -0
- data/LICENSE +20 -0
- data/README.markdown +170 -0
- data/Rakefile +68 -0
- data/bin/cijoe +51 -0
- data/cijoe.gemspec +77 -0
- data/deps.rip +4 -0
- data/examples/build-failed +22 -0
- data/examples/build-worked +22 -0
- data/examples/cijoe.ru +15 -0
- data/examples/cijoed +53 -0
- data/glennr-cijoe.gemspec +82 -0
- data/lib/cijoe.rb +233 -0
- data/lib/cijoe/build.rb +62 -0
- data/lib/cijoe/campfire.rb +70 -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 +91 -0
- data/lib/cijoe/version.rb +3 -0
- data/lib/cijoe/views/template.erb +70 -0
- data/test/helper.rb +12 -0
- data/test/test_cijoe.rb +17 -0
- data/test/test_cijoe_server.rb +50 -0
- metadata +150 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Chris Wanstrath
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
CI Joe
|
2
|
+
======
|
3
|
+
|
4
|
+
Joe is a [Continuous
|
5
|
+
Integration](http://en.wikipedia.org/wiki/Continuous_integration)
|
6
|
+
server that'll run your tests on demand and report their pass/fail status.
|
7
|
+
|
8
|
+
Because knowing is half the battle.
|
9
|
+
|
10
|
+

|
11
|
+
|
12
|
+
Quickstart
|
13
|
+
----------
|
14
|
+
|
15
|
+
RubyGems:
|
16
|
+
|
17
|
+
$ gem install cijoe
|
18
|
+
$ git clone git://github.com/you/yourrepo.git
|
19
|
+
$ cijoe yourrepo
|
20
|
+
|
21
|
+
Boom. Navigate to <http://localhost:4567> to see Joe in action.
|
22
|
+
Check `cijoe -h` for other options.
|
23
|
+
|
24
|
+
Basically you need to run `cijoe` and hand it the path to a git
|
25
|
+
repo. Make sure this isn't a shared repo: Joe needs to own it.
|
26
|
+
|
27
|
+
Joe looks for various git config settings in the repo you hand it. For
|
28
|
+
instance, you can tell Joe what command to run by setting
|
29
|
+
`cijoe.runner`:
|
30
|
+
|
31
|
+
$ git config --add cijoe.runner "rake -s test:units"
|
32
|
+
|
33
|
+
Joe doesn't care about Ruby, Python, or whatever. As long as the
|
34
|
+
runner returns a non-zero exit status on fail and a zero on success,
|
35
|
+
everyone is happy.
|
36
|
+
|
37
|
+
Need to do some massaging of your repo before the tests run, like
|
38
|
+
maybe swapping in a new database.yml? No problem - Joe will try to
|
39
|
+
run `.git/hooks/after-reset` if it exists before each build phase.
|
40
|
+
Do it in there. Just make sure it's executable.
|
41
|
+
|
42
|
+
Want to notify IRC or email on test pass or failure? Joe will run
|
43
|
+
`.git/hooks/build-failed` or `.git/hooks/build-worked` if they exist
|
44
|
+
and are executable on build pass / fail. They're just shell scripts -
|
45
|
+
put whatever you want in there.
|
46
|
+
|
47
|
+
Tip: your repo's `HEAD` will point to the commit used to run the
|
48
|
+
build. Pull any metadata you want out of that scro.
|
49
|
+
|
50
|
+
|
51
|
+
Other Branches
|
52
|
+
----------------------
|
53
|
+
|
54
|
+
Want joe to run against a branch other than `master`? No problem:
|
55
|
+
|
56
|
+
$ git config --add cijoe.branch deploy
|
57
|
+
|
58
|
+
|
59
|
+
Concurrent Push's - a kind of "queueing"
|
60
|
+
----------------------------------------
|
61
|
+
|
62
|
+
Joe runs just one build at the time. If you expect concurrent push's
|
63
|
+
to your repo and want joe to build each in a kind of queue, just set:
|
64
|
+
|
65
|
+
$ git config --add cijoe.buildallfile tmp/cijoe.txt
|
66
|
+
|
67
|
+
Joe will save requests while another build runs. If more than one push
|
68
|
+
hits joe, he just picks the last after finishing the prior.
|
69
|
+
|
70
|
+
|
71
|
+
Campfire
|
72
|
+
-------------
|
73
|
+
|
74
|
+
Campfire notification is included, because it's what we use. Want Joe
|
75
|
+
notify your Campfire? Put this in your repo's `.git/config`:
|
76
|
+
|
77
|
+
[campfire]
|
78
|
+
token = your_api_token
|
79
|
+
subdomain = whatever
|
80
|
+
room = Awesomeness
|
81
|
+
ssl = false
|
82
|
+
|
83
|
+
Note: your API token may differ between subdomains!
|
84
|
+
|
85
|
+
Or do it the old fashion way:
|
86
|
+
|
87
|
+
$ cd yourrepo
|
88
|
+
$ git config --add campfire.token 98ADFLKJSDOIU7BLAH
|
89
|
+
$ git config --add campfire.subdomain github
|
90
|
+
etc.
|
91
|
+
|
92
|
+
|
93
|
+
Checkin' Status
|
94
|
+
----------------------
|
95
|
+
|
96
|
+
Want to see how your build's doing without any of this fancy UI crap?
|
97
|
+
Ping Joe for the lowdown:
|
98
|
+
|
99
|
+
curl http://localhost:4567/ping
|
100
|
+
|
101
|
+
Joe will return `200 OK` if all is quiet on the Western Front. If
|
102
|
+
Joe's busy building or your last build failed, you'll get `412
|
103
|
+
PRECONDITION FAILED`.
|
104
|
+
|
105
|
+
|
106
|
+
Multiple Projects
|
107
|
+
------------------------
|
108
|
+
|
109
|
+
Want CI for multiple projects? Just start multiple instances of Joe!
|
110
|
+
He can run on any port - try `cijoe -h` for more options.
|
111
|
+
|
112
|
+
If you're using Passenger, see [this blog post](http://chrismdp.github.com/2010/03/multiple-ci-joes-with-rack-and-passenger/).
|
113
|
+
|
114
|
+
|
115
|
+
HTTP Auth
|
116
|
+
----------------
|
117
|
+
|
118
|
+
Worried about people triggering your builds? Setup HTTP auth:
|
119
|
+
|
120
|
+
$ git config --add cijoe.user chris
|
121
|
+
$ git config --add cijoe.pass secret
|
122
|
+
|
123
|
+
|
124
|
+
GitHub Integration
|
125
|
+
--------------------------
|
126
|
+
|
127
|
+
Any POST to Joe will trigger a build. If you are hiding Joe behind
|
128
|
+
HTTP auth, that's okay - GitHub knows how to authenticate properly.
|
129
|
+
|
130
|
+

|
131
|
+
|
132
|
+
You can find the Post-Receive option under the 'Service Hooks' subtab
|
133
|
+
of your project's "Admin" tab.
|
134
|
+
|
135
|
+
|
136
|
+
Daemonize
|
137
|
+
----------------
|
138
|
+
|
139
|
+
Want to run Joe as a daemon? Use `nohup`:
|
140
|
+
|
141
|
+
$ nohup cijoe -p 4444 repo &
|
142
|
+
|
143
|
+
|
144
|
+
Other CI Servers
|
145
|
+
------------------------
|
146
|
+
|
147
|
+
Need more features? More notifiers? Check out one of these bad boys:
|
148
|
+
|
149
|
+
* [Cerberus](http://cerberus.rubyforge.org/)
|
150
|
+
* [Integrity](http://integrityapp.com/)
|
151
|
+
* [CruiseControl.rb](http://cruisecontrolrb.thoughtworks.com/)
|
152
|
+
* [BuildBot](http://buildbot.net/trac)
|
153
|
+
* [Signal](http://www.github.com/dcrec1/signal)
|
154
|
+
|
155
|
+
|
156
|
+
Screenshots
|
157
|
+
------------------
|
158
|
+
|
159
|
+

|
160
|
+
|
161
|
+

|
162
|
+
|
163
|
+
|
164
|
+
Questions? Concerns?
|
165
|
+
---------------------------------
|
166
|
+
|
167
|
+
[Issues](http://github.com/defunkt/cijoe/issues) or [the mailing list](http://groups.google.com/group/cijoe).
|
168
|
+
|
169
|
+
|
170
|
+
( Chris Wanstrath :: chris@ozmm.org )
|
data/Rakefile
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
desc "Build a gem"
|
2
|
+
task :gem => [ :gemspec, :build ]
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
|
7
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
|
8
|
+
require 'cijoe/version'
|
9
|
+
|
10
|
+
Jeweler::Tasks.new do |gemspec|
|
11
|
+
gemspec.name = "glennr-cijoe"
|
12
|
+
gemspec.summary = "CI Joe is a simple Continuous Integration server."
|
13
|
+
gemspec.description = "CI Joe is a simple Continuous Integration server."
|
14
|
+
gemspec.email = "chris@ozmm.org"
|
15
|
+
gemspec.homepage = "http://github.com/defunkt/cijoe"
|
16
|
+
gemspec.authors = ["Chris Wanstrath"]
|
17
|
+
gemspec.add_dependency 'choice'
|
18
|
+
gemspec.add_dependency 'sinatra'
|
19
|
+
gemspec.add_dependency 'tinder'
|
20
|
+
gemspec.add_development_dependency 'rack-test'
|
21
|
+
gemspec.version = CIJoe::Version.to_s
|
22
|
+
end
|
23
|
+
rescue LoadError
|
24
|
+
puts "Jeweler not available."
|
25
|
+
puts "Install it with: gem install jeweler"
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "Publish a RubyGem"
|
29
|
+
task :publish => :gem do
|
30
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/lib'
|
31
|
+
require 'cijoe/version'
|
32
|
+
|
33
|
+
sh "gem push pkg/glennr-cijoe-#{CIJoe::Version}.gem"
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'rake/testtask'
|
37
|
+
Rake::TestTask.new(:test) do |test|
|
38
|
+
test.libs << 'lib' << 'test'
|
39
|
+
test.pattern = 'test/**/test_*.rb'
|
40
|
+
test.verbose = true
|
41
|
+
end
|
42
|
+
|
43
|
+
begin
|
44
|
+
require 'rcov/rcovtask'
|
45
|
+
Rcov::RcovTask.new do |test|
|
46
|
+
test.libs << 'test'
|
47
|
+
test.pattern = 'test/**/test_*.rb'
|
48
|
+
test.verbose = true
|
49
|
+
end
|
50
|
+
rescue LoadError
|
51
|
+
task :rcov do
|
52
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
task :test => :check_dependencies
|
57
|
+
|
58
|
+
task :default => :test
|
59
|
+
|
60
|
+
require 'rake/rdoctask'
|
61
|
+
Rake::RDocTask.new do |rdoc|
|
62
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
63
|
+
|
64
|
+
rdoc.rdoc_dir = 'rdoc'
|
65
|
+
rdoc.title = "someproject #{version}"
|
66
|
+
rdoc.rdoc_files.include('README*')
|
67
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
68
|
+
end
|
data/bin/cijoe
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
3
|
+
|
4
|
+
require 'choice'
|
5
|
+
|
6
|
+
Choice.options do
|
7
|
+
banner "Usage: #{File.basename(__FILE__)} [-hpv] path_to_git_repo"
|
8
|
+
header ''
|
9
|
+
header 'Server options:'
|
10
|
+
|
11
|
+
option :host do
|
12
|
+
d = "0.0.0.0"
|
13
|
+
short '-h'
|
14
|
+
long '--host=HOST'
|
15
|
+
desc "The hostname or ip of the host to bind to (default #{d})"
|
16
|
+
default d
|
17
|
+
end
|
18
|
+
|
19
|
+
option :port do
|
20
|
+
d = 4567
|
21
|
+
short '-p'
|
22
|
+
long '--port=PORT'
|
23
|
+
desc "The port to listen on (default #{d})"
|
24
|
+
cast Integer
|
25
|
+
default d
|
26
|
+
end
|
27
|
+
|
28
|
+
separator ''
|
29
|
+
separator 'Common options: '
|
30
|
+
|
31
|
+
option :help do
|
32
|
+
long '--help'
|
33
|
+
desc 'Show this message'
|
34
|
+
end
|
35
|
+
|
36
|
+
option :version do
|
37
|
+
short '-v'
|
38
|
+
long '--version'
|
39
|
+
desc 'Show version'
|
40
|
+
action do
|
41
|
+
puts "#{File.basename(__FILE__)} v#{CIJoe::Version}"
|
42
|
+
exit
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
options = Choice.choices
|
48
|
+
|
49
|
+
require 'cijoe'
|
50
|
+
|
51
|
+
CIJoe::Server.start(options[:host], options[:port], File.expand_path(Choice.rest[0]))
|
data/cijoe.gemspec
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{cijoe}
|
8
|
+
s.version = "0.4.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Chris Wanstrath"]
|
12
|
+
s.date = %q{2010-07-21}
|
13
|
+
s.default_executable = %q{cijoe}
|
14
|
+
s.description = %q{CI Joe is a simple Continuous Integration server.}
|
15
|
+
s.email = %q{chris@ozmm.org}
|
16
|
+
s.executables = ["cijoe"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.markdown"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".gitignore",
|
23
|
+
"LICENSE",
|
24
|
+
"README.markdown",
|
25
|
+
"Rakefile",
|
26
|
+
"bin/cijoe",
|
27
|
+
"deps.rip",
|
28
|
+
"examples/build-failed",
|
29
|
+
"examples/build-worked",
|
30
|
+
"examples/cijoe.ru",
|
31
|
+
"examples/cijoed",
|
32
|
+
"lib/cijoe.rb",
|
33
|
+
"lib/cijoe/build.rb",
|
34
|
+
"lib/cijoe/campfire.rb",
|
35
|
+
"lib/cijoe/commit.rb",
|
36
|
+
"lib/cijoe/config.rb",
|
37
|
+
"lib/cijoe/public/favicon.ico",
|
38
|
+
"lib/cijoe/public/octocat.png",
|
39
|
+
"lib/cijoe/public/screen.css",
|
40
|
+
"lib/cijoe/server.rb",
|
41
|
+
"lib/cijoe/version.rb",
|
42
|
+
"lib/cijoe/views/template.erb",
|
43
|
+
"test/helper.rb",
|
44
|
+
"test/test_cijoe.rb",
|
45
|
+
"test/test_cijoe_server.rb"
|
46
|
+
]
|
47
|
+
s.homepage = %q{http://github.com/defunkt/cijoe}
|
48
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
49
|
+
s.require_paths = ["lib"]
|
50
|
+
s.rubygems_version = %q{1.3.7}
|
51
|
+
s.summary = %q{CI Joe is a simple Continuous Integration server.}
|
52
|
+
s.test_files = [
|
53
|
+
"test/helper.rb",
|
54
|
+
"test/test_cijoe.rb",
|
55
|
+
"test/test_cijoe_server.rb"
|
56
|
+
]
|
57
|
+
|
58
|
+
if s.respond_to? :specification_version then
|
59
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
60
|
+
s.specification_version = 3
|
61
|
+
|
62
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
63
|
+
s.add_runtime_dependency(%q<choice>, [">= 0"])
|
64
|
+
s.add_runtime_dependency(%q<sinatra>, [">= 0"])
|
65
|
+
s.add_development_dependency(%q<rack-test>, [">= 0"])
|
66
|
+
else
|
67
|
+
s.add_dependency(%q<choice>, [">= 0"])
|
68
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
69
|
+
s.add_dependency(%q<rack-test>, [">= 0"])
|
70
|
+
end
|
71
|
+
else
|
72
|
+
s.add_dependency(%q<choice>, [">= 0"])
|
73
|
+
s.add_dependency(%q<sinatra>, [">= 0"])
|
74
|
+
s.add_dependency(%q<rack-test>, [">= 0"])
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
data/deps.rip
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Put this file to $PROJECT/.git/hooks/ for email notifications.
|
4
|
+
#
|
5
|
+
# You should have mail command provided by mailutils package on Debian
|
6
|
+
# based systems.
|
7
|
+
#
|
8
|
+
# sudo apt-get install mailutils
|
9
|
+
#
|
10
|
+
# You should have mail server running
|
11
|
+
#
|
12
|
+
# Do not forget: chmod +x build-failed
|
13
|
+
#
|
14
|
+
echo "
|
15
|
+
Visit http://ci.example.org/ for details
|
16
|
+
|
17
|
+
Author: $AUTHOR
|
18
|
+
Message:
|
19
|
+
$MESSAGE
|
20
|
+
|
21
|
+
$OUTPUT
|
22
|
+
" | mail -s "[example.org] BUILD FAILED $SHA" --to first@gmail.com second@gmail.com
|
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# Put this file to $PROJECT/.git/hooks/ for email notifications.
|
4
|
+
#
|
5
|
+
# You should have mail command provided by mailutils package on Debian
|
6
|
+
# based systems.
|
7
|
+
#
|
8
|
+
# sudo apt-get install mailutils
|
9
|
+
#
|
10
|
+
# You should have mail server running
|
11
|
+
#
|
12
|
+
# Do not forget: chmod +x build-worked
|
13
|
+
#
|
14
|
+
echo "
|
15
|
+
Visit http://ci.example.org/ for details
|
16
|
+
|
17
|
+
Author: $AUTHOR
|
18
|
+
Message:
|
19
|
+
$MESSAGE
|
20
|
+
|
21
|
+
" | mail -s "[example.org] build OK" --to first@gmail.com second@gmail.com
|
22
|
+
|