crazy_ivan 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/LICENSE +20 -0
- data/README.rdoc +94 -0
- data/Rakefile +92 -0
- data/TODO +33 -0
- data/VERSION +1 -0
- data/bin/crazy_ivan +114 -0
- data/crazy_ivan.gemspec +182 -0
- data/lib/crazy_ivan.rb +5 -0
- data/lib/html_asset_crush.rb +56 -0
- data/lib/report_assembler.rb +78 -0
- data/lib/test_runner.rb +71 -0
- data/templates/css/ci.css +11 -0
- data/templates/index.html +105 -0
- data/templates/javascript/json-template.js +544 -0
- data/templates/javascript/prototype.js +4917 -0
- data/test/crazy_ivan_test.rb +4 -0
- data/test/test_helper.rb +9 -0
- data/vendor/json-1.1.7/CHANGES +119 -0
- data/vendor/json-1.1.7/GPL +340 -0
- data/vendor/json-1.1.7/README +78 -0
- data/vendor/json-1.1.7/RUBY +58 -0
- data/vendor/json-1.1.7/Rakefile +270 -0
- data/vendor/json-1.1.7/TODO +1 -0
- data/vendor/json-1.1.7/VERSION +1 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log +52 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat +900 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat +901 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log +261 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log +262 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log +82 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log +34 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat +900 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat +901 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log +81 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log +82 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log +82 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat +1000 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat +1001 -0
- data/vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log +82 -0
- data/vendor/json-1.1.7/benchmarks/generator_benchmark.rb +165 -0
- data/vendor/json-1.1.7/benchmarks/parser_benchmark.rb +197 -0
- data/vendor/json-1.1.7/bin/edit_json.rb +9 -0
- data/vendor/json-1.1.7/bin/prettify_json.rb +75 -0
- data/vendor/json-1.1.7/data/example.json +1 -0
- data/vendor/json-1.1.7/data/index.html +38 -0
- data/vendor/json-1.1.7/data/prototype.js +4184 -0
- data/vendor/json-1.1.7/doc-templates/main.txt +283 -0
- data/vendor/json-1.1.7/ext/json/ext/generator/extconf.rb +11 -0
- data/vendor/json-1.1.7/ext/json/ext/generator/generator.c +919 -0
- data/vendor/json-1.1.7/ext/json/ext/generator/unicode.c +182 -0
- data/vendor/json-1.1.7/ext/json/ext/generator/unicode.h +53 -0
- data/vendor/json-1.1.7/ext/json/ext/parser/extconf.rb +11 -0
- data/vendor/json-1.1.7/ext/json/ext/parser/parser.c +1829 -0
- data/vendor/json-1.1.7/ext/json/ext/parser/parser.rl +686 -0
- data/vendor/json-1.1.7/ext/json/ext/parser/unicode.c +154 -0
- data/vendor/json-1.1.7/ext/json/ext/parser/unicode.h +58 -0
- data/vendor/json-1.1.7/install.rb +26 -0
- data/vendor/json-1.1.7/lib/json.rb +10 -0
- data/vendor/json-1.1.7/lib/json/Array.xpm +21 -0
- data/vendor/json-1.1.7/lib/json/FalseClass.xpm +21 -0
- data/vendor/json-1.1.7/lib/json/Hash.xpm +21 -0
- data/vendor/json-1.1.7/lib/json/Key.xpm +73 -0
- data/vendor/json-1.1.7/lib/json/NilClass.xpm +21 -0
- data/vendor/json-1.1.7/lib/json/Numeric.xpm +28 -0
- data/vendor/json-1.1.7/lib/json/String.xpm +96 -0
- data/vendor/json-1.1.7/lib/json/TrueClass.xpm +21 -0
- data/vendor/json-1.1.7/lib/json/add/core.rb +135 -0
- data/vendor/json-1.1.7/lib/json/add/rails.rb +58 -0
- data/vendor/json-1.1.7/lib/json/common.rb +354 -0
- data/vendor/json-1.1.7/lib/json/editor.rb +1371 -0
- data/vendor/json-1.1.7/lib/json/ext.rb +15 -0
- data/vendor/json-1.1.7/lib/json/json.xpm +1499 -0
- data/vendor/json-1.1.7/lib/json/pure.rb +77 -0
- data/vendor/json-1.1.7/lib/json/pure/generator.rb +430 -0
- data/vendor/json-1.1.7/lib/json/pure/parser.rb +269 -0
- data/vendor/json-1.1.7/lib/json/version.rb +8 -0
- data/vendor/json-1.1.7/tests/fixtures/fail1.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail10.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail11.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail12.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail13.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail14.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail18.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail19.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail2.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail20.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail21.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail22.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail23.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail24.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail25.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail27.json +2 -0
- data/vendor/json-1.1.7/tests/fixtures/fail28.json +2 -0
- data/vendor/json-1.1.7/tests/fixtures/fail3.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail4.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail5.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail6.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail7.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail8.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/fail9.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass1.json +56 -0
- data/vendor/json-1.1.7/tests/fixtures/pass15.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass16.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass17.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass2.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass26.json +1 -0
- data/vendor/json-1.1.7/tests/fixtures/pass3.json +6 -0
- data/vendor/json-1.1.7/tests/test_json.rb +312 -0
- data/vendor/json-1.1.7/tests/test_json_addition.rb +164 -0
- data/vendor/json-1.1.7/tests/test_json_fixtures.rb +34 -0
- data/vendor/json-1.1.7/tests/test_json_generate.rb +106 -0
- data/vendor/json-1.1.7/tests/test_json_rails.rb +146 -0
- data/vendor/json-1.1.7/tests/test_json_unicode.rb +62 -0
- data/vendor/json-1.1.7/tools/fuzz.rb +139 -0
- data/vendor/json-1.1.7/tools/server.rb +61 -0
- metadata +196 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Edward Ocampo-Gooding
|
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.rdoc
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
= Crazy Ivan
|
2
|
+
|
3
|
+
Crazy Ivan (CI) is simplest possible continuous integration tool.
|
4
|
+
|
5
|
+
== Usage
|
6
|
+
|
7
|
+
Create a directory where your projects will live
|
8
|
+
$ mkdir /var/continuous-integration
|
9
|
+
|
10
|
+
Setup a project or two in that directory
|
11
|
+
$ cd /var/continuous-integration
|
12
|
+
$ git clone git://github.com/edward/active_merchant.git
|
13
|
+
|
14
|
+
Setup continuous-integration for each project
|
15
|
+
$ crazy_ivan setup # creates example ci scripts in
|
16
|
+
# each project (see How this works)
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
$ crazy_ivan setup # creates the ci directory, and
|
21
|
+
# creates a configuration file,
|
22
|
+
# sets a cron job to run crazy_ivan
|
23
|
+
|
24
|
+
Manually run it once to check everything is ok
|
25
|
+
$ cd /var/continuous-integration
|
26
|
+
$ crazy_ivan /var/www/ci # the test reports path should be
|
27
|
+
# accessible via your web server
|
28
|
+
|
29
|
+
$ open /var/www/ci/index.html # or check it through your browser
|
30
|
+
|
31
|
+
Set a cron job to run it every 15 minutes
|
32
|
+
$ echo "0,15,30,45 * * * * cd /var/continuous-integration; crazy_ivan /var/www/ci" > ci.cron
|
33
|
+
$ crontab ci.cron
|
34
|
+
|
35
|
+
Note that you don’t want this running too frequently; having overlapping
|
36
|
+
runs is possible and would be bad.
|
37
|
+
|
38
|
+
(Functionality to have this run as a web-hook is planned.)
|
39
|
+
|
40
|
+
== How this works
|
41
|
+
|
42
|
+
* crazy_ivan is executed periodically by cron
|
43
|
+
* crazy_ivan looks in directories one level deeper than where it’s been called
|
44
|
+
|
45
|
+
=> asked to run in /projects
|
46
|
+
/shopify
|
47
|
+
looks in each /liquid
|
48
|
+
of these dirs /active_merchant
|
49
|
+
========> /active_shipping
|
50
|
+
|
51
|
+
=> within each directory, it expects three executable scripts
|
52
|
+
to execute at the /:
|
53
|
+
|
54
|
+
/shopify
|
55
|
+
/.ci
|
56
|
+
update
|
57
|
+
version
|
58
|
+
test
|
59
|
+
|
60
|
+
* crazy_ivan first executes `update` and captures the output:
|
61
|
+
|
62
|
+
#!/usr/bin/env bash
|
63
|
+
|
64
|
+
git pull # Whatever your application
|
65
|
+
# needs to do to update your
|
66
|
+
# source from a repository
|
67
|
+
|
68
|
+
* crazy_ivan then exectutes `version` and captures the output:
|
69
|
+
|
70
|
+
#!/usr/bin/env bash
|
71
|
+
|
72
|
+
#!/usr/bin/env ruby -wKU # Get a version hash/fingerprint/id
|
73
|
+
puts `git show`[/^commit (.+)$/, 1] # from your version control system
|
74
|
+
#
|
75
|
+
# (Note that this will be truncated
|
76
|
+
# to fit within a filename length.)
|
77
|
+
|
78
|
+
* crazy_ivan then executes `test` and captures the output:
|
79
|
+
|
80
|
+
#!/usr/bin/env bash
|
81
|
+
|
82
|
+
rake db:migrate # This task prepares the application
|
83
|
+
rake test # for running tests, then runs them
|
84
|
+
|
85
|
+
* At each of these three steps, the output is repackaged
|
86
|
+
into a .json file to be consumed in the directory holding
|
87
|
+
the static html.
|
88
|
+
|
89
|
+
|
90
|
+
== Copyright and Credits
|
91
|
+
|
92
|
+
Copyright (c) 2009 Edward Ocampo-Gooding. See LICENSE for details.
|
93
|
+
|
94
|
+
Heavily inspired/first code sketch written by Tobi Lütke.
|
data/Rakefile
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "crazy_ivan"
|
8
|
+
gem.summary = 'Crazy Ivan (CI) is simplest possible continuous integration tool.'
|
9
|
+
gem.description = "Continuous integration should really just be a script that captures the output of running your project update & test commands and presents recent results in a static html page.
|
10
|
+
|
11
|
+
By keeping test reports in json, per-project CI configuration in 3 probably-one-line scripts, things are kept simple, quick, and super extensible.
|
12
|
+
|
13
|
+
Want to use git, svn, or hg? No problem.
|
14
|
+
Need to fire off results to Twitter or Campfire? It's one line away.
|
15
|
+
|
16
|
+
CI depends on cron."
|
17
|
+
gem.email = "edward@edwardog.net"
|
18
|
+
gem.homepage = "http://github.com/edward/crazy_ivan"
|
19
|
+
gem.authors = ["Edward Ocampo-Gooding"]
|
20
|
+
gem.rubyforge_project = "crazyivan"
|
21
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
22
|
+
end
|
23
|
+
Jeweler::RubyforgeTasks.new do |rubyforge|
|
24
|
+
rubyforge.doc_task = "rdoc"
|
25
|
+
end
|
26
|
+
rescue LoadError
|
27
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
28
|
+
end
|
29
|
+
|
30
|
+
begin
|
31
|
+
require 'rake/contrib/sshpublisher'
|
32
|
+
namespace :rubyforge do
|
33
|
+
|
34
|
+
desc "Release gem and RDoc documentation to RubyForge"
|
35
|
+
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
36
|
+
|
37
|
+
namespace :release do
|
38
|
+
desc "Publish RDoc to RubyForge."
|
39
|
+
task :docs => [:rdoc] do
|
40
|
+
config = YAML.load(
|
41
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
42
|
+
)
|
43
|
+
|
44
|
+
host = "#{config['username']}@rubyforge.org"
|
45
|
+
remote_dir = "/var/www/gforge-projects/the-perfect-gem/"
|
46
|
+
local_dir = 'rdoc'
|
47
|
+
|
48
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
rescue LoadError
|
53
|
+
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
54
|
+
end
|
55
|
+
|
56
|
+
require 'rake/testtask'
|
57
|
+
Rake::TestTask.new(:test) do |test|
|
58
|
+
test.libs << 'lib' << 'test'
|
59
|
+
test.pattern = 'test/**/*_test.rb'
|
60
|
+
test.verbose = true
|
61
|
+
end
|
62
|
+
|
63
|
+
begin
|
64
|
+
require 'rcov/rcovtask'
|
65
|
+
Rcov::RcovTask.new do |test|
|
66
|
+
test.libs << 'test'
|
67
|
+
test.pattern = 'test/**/*_test.rb'
|
68
|
+
test.verbose = true
|
69
|
+
end
|
70
|
+
rescue LoadError
|
71
|
+
task :rcov do
|
72
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
task :test => :check_dependencies
|
77
|
+
|
78
|
+
task :default => :test
|
79
|
+
|
80
|
+
require 'rake/rdoctask'
|
81
|
+
Rake::RDocTask.new do |rdoc|
|
82
|
+
if File.exist?('VERSION')
|
83
|
+
version = File.read('VERSION')
|
84
|
+
else
|
85
|
+
version = ""
|
86
|
+
end
|
87
|
+
|
88
|
+
rdoc.rdoc_dir = 'rdoc'
|
89
|
+
rdoc.title = "Crazy Ivan #{version}"
|
90
|
+
rdoc.rdoc_files.include('README*')
|
91
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
92
|
+
end
|
data/TODO
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
* When the .ci directory scripts are missing, prompt with a
|
2
|
+
|
3
|
+
Create update script? [Y]/n?
|
4
|
+
|
5
|
+
then ask them about the git or svn repository. Do a friendly wizard thing with nice colours.
|
6
|
+
This should be as nice as Phusion’s thing.
|
7
|
+
|
8
|
+
* TestRunner#run_script should warn or complain on empty scripts or on scripts that do not return output
|
9
|
+
|
10
|
+
* Think about using popen4 instead (fixes exit status code issue with popen3)
|
11
|
+
|
12
|
+
* What about making all setup just be:
|
13
|
+
|
14
|
+
$ ci install [/var/continuous-integration]
|
15
|
+
# Defaults to creating ^^^ and prompting for each project somehow
|
16
|
+
|
17
|
+
* Needs more logging; should log to system when running each project
|
18
|
+
|
19
|
+
* Add a 'periscope' web-hook with rack to run tests.
|
20
|
+
|
21
|
+
* Come up with a better executable name ("ci" is taken by RCS)
|
22
|
+
|
23
|
+
* Come up with a better way of making the scripts executable other than just chmod-755-ing them.
|
24
|
+
|
25
|
+
* Come up with a better way of dealing with the filename length issue. (Having to truncate at 240 chars right now.)
|
26
|
+
|
27
|
+
* Create example script templates for popular version control systems
|
28
|
+
|
29
|
+
* Add functionality to detect new test runs and update index.html in-browser (have a poll every 30 seconds or something on projects.json and recents.json)
|
30
|
+
|
31
|
+
* Use datejs to parse the timestamp to easily produce deltas (i.e. "Last test ran 2 days ago")
|
32
|
+
|
33
|
+
* Do something like use a file-lock to prevent overlapping runs and notify in the index.html that it's happening
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.0
|
data/bin/crazy_ivan
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
#!/usr/bin/env ruby -wKU
|
2
|
+
|
3
|
+
require File.join(File.dirname(__FILE__), *%w[.. lib crazy_ivan])
|
4
|
+
require File.join(File.dirname(__FILE__), *%w[.. vendor json-1.1.7 lib json])
|
5
|
+
require "optparse"
|
6
|
+
require "logger"
|
7
|
+
|
8
|
+
CRAZY_IVAN_VERSION = File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION]))
|
9
|
+
|
10
|
+
def setup
|
11
|
+
Dir['*'].each do |dir|
|
12
|
+
Dir.chdir(dir) do
|
13
|
+
FileUtils.mkdir_p('.ci')
|
14
|
+
|
15
|
+
Dir.chdir('.ci') do
|
16
|
+
File.open('update', 'w+') do |f|
|
17
|
+
f.puts "#!/usr/bin/env bash"
|
18
|
+
f.puts "git pull"
|
19
|
+
end
|
20
|
+
|
21
|
+
File.open('version', 'w+') do |f|
|
22
|
+
f.puts "#!/usr/bin/env ruby -wKU"
|
23
|
+
f.puts "puts `git show`[/^commit (.+)$/, 1]"
|
24
|
+
end
|
25
|
+
|
26
|
+
File.open('test', 'w+') do |f|
|
27
|
+
f.puts "#!/usr/bin/env bash"
|
28
|
+
f.puts "rake"
|
29
|
+
end
|
30
|
+
|
31
|
+
File.chmod 0755, 'update', 'version', 'test'
|
32
|
+
end
|
33
|
+
|
34
|
+
puts
|
35
|
+
puts "Created #{dir}/.ci/update"
|
36
|
+
puts " #{' ' * (dir + "/.ci").size}/version"
|
37
|
+
puts " #{' ' * (dir + "/.ci").size}/test"
|
38
|
+
puts
|
39
|
+
puts "Take a look at those 3 scripts to make sure "
|
40
|
+
puts "they do the right thing for each case."
|
41
|
+
puts
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def generate_test_reports_in(output_directory)
|
47
|
+
Dir['*'].each do |dir|
|
48
|
+
if File.directory?(dir)
|
49
|
+
report = ReportAssembler.new(output_directory)
|
50
|
+
report.test_results << TestRunner.new(dir).invoke
|
51
|
+
report.generate
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def show_howto
|
57
|
+
puts "Hankering for a continuous integration server, eh?"
|
58
|
+
puts
|
59
|
+
puts "1. Jump over to where you want to keep your projects"
|
60
|
+
puts " and git clone or svn checkout or whatever-them down:"
|
61
|
+
puts " $ mkdir -p /var/continuous-integration/projects/"
|
62
|
+
puts " $ cd /var/continuous-integration/projects"
|
63
|
+
puts " $ git clone git@github.com:edward/active_merchant.git"
|
64
|
+
puts
|
65
|
+
puts "2. Run:"
|
66
|
+
puts " $ crazy_ivan setup"
|
67
|
+
puts
|
68
|
+
puts "3. Run it manually to check that everything is ok:"
|
69
|
+
puts " $ crazy_ivan /var/www/ci"
|
70
|
+
puts
|
71
|
+
puts " (/var/www/ci should be accessible through your web server)"
|
72
|
+
puts " Check /var/www/ci/index.html through a web browser."
|
73
|
+
puts
|
74
|
+
puts "4. Set up cron to run it every 15 minutes:"
|
75
|
+
puts " $ echo \"0,15,30,45 * * * * cd /var/continuous-integration; crazy_ivan /var/www/ci\" > ci.cron"
|
76
|
+
puts " $ crontab ci.cron"
|
77
|
+
puts
|
78
|
+
puts "5. Profit."
|
79
|
+
puts
|
80
|
+
puts "Please see http://github.com/edward/crazy_ivan for more."
|
81
|
+
end
|
82
|
+
|
83
|
+
options = {}
|
84
|
+
|
85
|
+
ARGV.options do |opts|
|
86
|
+
opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} test_reports_path"
|
87
|
+
|
88
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
89
|
+
show_howto
|
90
|
+
puts opts
|
91
|
+
exit
|
92
|
+
end
|
93
|
+
|
94
|
+
opts.on_tail("--version", "Show version") do
|
95
|
+
puts CRAZY_IVAN_VERSION
|
96
|
+
exit
|
97
|
+
end
|
98
|
+
|
99
|
+
begin
|
100
|
+
opts.parse!
|
101
|
+
|
102
|
+
case ARGV[0]
|
103
|
+
when /setup/
|
104
|
+
setup
|
105
|
+
when /\w+/
|
106
|
+
output_directory = ARGV[0]
|
107
|
+
FileUtils.mkdir_p(output_directory)
|
108
|
+
generate_test_reports_in(output_directory)
|
109
|
+
else
|
110
|
+
show_howto
|
111
|
+
exit
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
data/crazy_ivan.gemspec
ADDED
@@ -0,0 +1,182 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{crazy_ivan}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Edward Ocampo-Gooding"]
|
12
|
+
s.date = %q{2009-08-30}
|
13
|
+
s.default_executable = %q{crazy_ivan}
|
14
|
+
s.description = %q{Continuous integration should really just be a script that captures the output of running your project update & test commands and presents recent results in a static html page.
|
15
|
+
|
16
|
+
By keeping test reports in json, per-project CI configuration in 3 probably-one-line scripts, things are kept simple, quick, and super extensible.
|
17
|
+
|
18
|
+
Want to use git, svn, or hg? No problem.
|
19
|
+
Need to fire off results to Twitter or Campfire? It's one line away.
|
20
|
+
|
21
|
+
CI depends on cron.}
|
22
|
+
s.email = %q{edward@edwardog.net}
|
23
|
+
s.executables = ["crazy_ivan"]
|
24
|
+
s.extra_rdoc_files = [
|
25
|
+
"LICENSE",
|
26
|
+
"README.rdoc"
|
27
|
+
]
|
28
|
+
s.files = [
|
29
|
+
".gitignore",
|
30
|
+
"LICENSE",
|
31
|
+
"README.rdoc",
|
32
|
+
"Rakefile",
|
33
|
+
"TODO",
|
34
|
+
"VERSION",
|
35
|
+
"bin/crazy_ivan",
|
36
|
+
"crazy_ivan.gemspec",
|
37
|
+
"lib/crazy_ivan.rb",
|
38
|
+
"lib/html_asset_crush.rb",
|
39
|
+
"lib/report_assembler.rb",
|
40
|
+
"lib/test_runner.rb",
|
41
|
+
"templates/css/ci.css",
|
42
|
+
"templates/index.html",
|
43
|
+
"templates/javascript/json-template.js",
|
44
|
+
"templates/javascript/prototype.js",
|
45
|
+
"test/crazy_ivan_test.rb",
|
46
|
+
"test/test_helper.rb",
|
47
|
+
"vendor/json-1.1.7/CHANGES",
|
48
|
+
"vendor/json-1.1.7/GPL",
|
49
|
+
"vendor/json-1.1.7/README",
|
50
|
+
"vendor/json-1.1.7/RUBY",
|
51
|
+
"vendor/json-1.1.7/Rakefile",
|
52
|
+
"vendor/json-1.1.7/TODO",
|
53
|
+
"vendor/json-1.1.7/VERSION",
|
54
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkComparison.log",
|
55
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast-autocorrelation.dat",
|
56
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_fast.dat",
|
57
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty-autocorrelation.dat",
|
58
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_pretty.dat",
|
59
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe-autocorrelation.dat",
|
60
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt#generator_safe.dat",
|
61
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkExt.log",
|
62
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast-autocorrelation.dat",
|
63
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_fast.dat",
|
64
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty-autocorrelation.dat",
|
65
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_pretty.dat",
|
66
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe-autocorrelation.dat",
|
67
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure#generator_safe.dat",
|
68
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkPure.log",
|
69
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator-autocorrelation.dat",
|
70
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails#generator.dat",
|
71
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/GeneratorBenchmarkRails.log",
|
72
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkComparison.log",
|
73
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser-autocorrelation.dat",
|
74
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt#parser.dat",
|
75
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkExt.log",
|
76
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser-autocorrelation.dat",
|
77
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure#parser.dat",
|
78
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkPure.log",
|
79
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser-autocorrelation.dat",
|
80
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails#parser.dat",
|
81
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkRails.log",
|
82
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser-autocorrelation.dat",
|
83
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML#parser.dat",
|
84
|
+
"vendor/json-1.1.7/benchmarks/data-p4-3GHz-ruby18/ParserBenchmarkYAML.log",
|
85
|
+
"vendor/json-1.1.7/benchmarks/generator_benchmark.rb",
|
86
|
+
"vendor/json-1.1.7/benchmarks/parser_benchmark.rb",
|
87
|
+
"vendor/json-1.1.7/bin/edit_json.rb",
|
88
|
+
"vendor/json-1.1.7/bin/prettify_json.rb",
|
89
|
+
"vendor/json-1.1.7/data/example.json",
|
90
|
+
"vendor/json-1.1.7/data/index.html",
|
91
|
+
"vendor/json-1.1.7/data/prototype.js",
|
92
|
+
"vendor/json-1.1.7/doc-templates/main.txt",
|
93
|
+
"vendor/json-1.1.7/ext/json/ext/generator/extconf.rb",
|
94
|
+
"vendor/json-1.1.7/ext/json/ext/generator/generator.c",
|
95
|
+
"vendor/json-1.1.7/ext/json/ext/generator/unicode.c",
|
96
|
+
"vendor/json-1.1.7/ext/json/ext/generator/unicode.h",
|
97
|
+
"vendor/json-1.1.7/ext/json/ext/parser/extconf.rb",
|
98
|
+
"vendor/json-1.1.7/ext/json/ext/parser/parser.c",
|
99
|
+
"vendor/json-1.1.7/ext/json/ext/parser/parser.rl",
|
100
|
+
"vendor/json-1.1.7/ext/json/ext/parser/unicode.c",
|
101
|
+
"vendor/json-1.1.7/ext/json/ext/parser/unicode.h",
|
102
|
+
"vendor/json-1.1.7/install.rb",
|
103
|
+
"vendor/json-1.1.7/lib/json.rb",
|
104
|
+
"vendor/json-1.1.7/lib/json/Array.xpm",
|
105
|
+
"vendor/json-1.1.7/lib/json/FalseClass.xpm",
|
106
|
+
"vendor/json-1.1.7/lib/json/Hash.xpm",
|
107
|
+
"vendor/json-1.1.7/lib/json/Key.xpm",
|
108
|
+
"vendor/json-1.1.7/lib/json/NilClass.xpm",
|
109
|
+
"vendor/json-1.1.7/lib/json/Numeric.xpm",
|
110
|
+
"vendor/json-1.1.7/lib/json/String.xpm",
|
111
|
+
"vendor/json-1.1.7/lib/json/TrueClass.xpm",
|
112
|
+
"vendor/json-1.1.7/lib/json/add/core.rb",
|
113
|
+
"vendor/json-1.1.7/lib/json/add/rails.rb",
|
114
|
+
"vendor/json-1.1.7/lib/json/common.rb",
|
115
|
+
"vendor/json-1.1.7/lib/json/editor.rb",
|
116
|
+
"vendor/json-1.1.7/lib/json/ext.rb",
|
117
|
+
"vendor/json-1.1.7/lib/json/json.xpm",
|
118
|
+
"vendor/json-1.1.7/lib/json/pure.rb",
|
119
|
+
"vendor/json-1.1.7/lib/json/pure/generator.rb",
|
120
|
+
"vendor/json-1.1.7/lib/json/pure/parser.rb",
|
121
|
+
"vendor/json-1.1.7/lib/json/version.rb",
|
122
|
+
"vendor/json-1.1.7/tests/fixtures/fail1.json",
|
123
|
+
"vendor/json-1.1.7/tests/fixtures/fail10.json",
|
124
|
+
"vendor/json-1.1.7/tests/fixtures/fail11.json",
|
125
|
+
"vendor/json-1.1.7/tests/fixtures/fail12.json",
|
126
|
+
"vendor/json-1.1.7/tests/fixtures/fail13.json",
|
127
|
+
"vendor/json-1.1.7/tests/fixtures/fail14.json",
|
128
|
+
"vendor/json-1.1.7/tests/fixtures/fail18.json",
|
129
|
+
"vendor/json-1.1.7/tests/fixtures/fail19.json",
|
130
|
+
"vendor/json-1.1.7/tests/fixtures/fail2.json",
|
131
|
+
"vendor/json-1.1.7/tests/fixtures/fail20.json",
|
132
|
+
"vendor/json-1.1.7/tests/fixtures/fail21.json",
|
133
|
+
"vendor/json-1.1.7/tests/fixtures/fail22.json",
|
134
|
+
"vendor/json-1.1.7/tests/fixtures/fail23.json",
|
135
|
+
"vendor/json-1.1.7/tests/fixtures/fail24.json",
|
136
|
+
"vendor/json-1.1.7/tests/fixtures/fail25.json",
|
137
|
+
"vendor/json-1.1.7/tests/fixtures/fail27.json",
|
138
|
+
"vendor/json-1.1.7/tests/fixtures/fail28.json",
|
139
|
+
"vendor/json-1.1.7/tests/fixtures/fail3.json",
|
140
|
+
"vendor/json-1.1.7/tests/fixtures/fail4.json",
|
141
|
+
"vendor/json-1.1.7/tests/fixtures/fail5.json",
|
142
|
+
"vendor/json-1.1.7/tests/fixtures/fail6.json",
|
143
|
+
"vendor/json-1.1.7/tests/fixtures/fail7.json",
|
144
|
+
"vendor/json-1.1.7/tests/fixtures/fail8.json",
|
145
|
+
"vendor/json-1.1.7/tests/fixtures/fail9.json",
|
146
|
+
"vendor/json-1.1.7/tests/fixtures/pass1.json",
|
147
|
+
"vendor/json-1.1.7/tests/fixtures/pass15.json",
|
148
|
+
"vendor/json-1.1.7/tests/fixtures/pass16.json",
|
149
|
+
"vendor/json-1.1.7/tests/fixtures/pass17.json",
|
150
|
+
"vendor/json-1.1.7/tests/fixtures/pass2.json",
|
151
|
+
"vendor/json-1.1.7/tests/fixtures/pass26.json",
|
152
|
+
"vendor/json-1.1.7/tests/fixtures/pass3.json",
|
153
|
+
"vendor/json-1.1.7/tests/test_json.rb",
|
154
|
+
"vendor/json-1.1.7/tests/test_json_addition.rb",
|
155
|
+
"vendor/json-1.1.7/tests/test_json_fixtures.rb",
|
156
|
+
"vendor/json-1.1.7/tests/test_json_generate.rb",
|
157
|
+
"vendor/json-1.1.7/tests/test_json_rails.rb",
|
158
|
+
"vendor/json-1.1.7/tests/test_json_unicode.rb",
|
159
|
+
"vendor/json-1.1.7/tools/fuzz.rb",
|
160
|
+
"vendor/json-1.1.7/tools/server.rb"
|
161
|
+
]
|
162
|
+
s.homepage = %q{http://github.com/edward/crazy_ivan}
|
163
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
164
|
+
s.require_paths = ["lib"]
|
165
|
+
s.rubyforge_project = %q{crazyivan}
|
166
|
+
s.rubygems_version = %q{1.3.5}
|
167
|
+
s.summary = %q{Crazy Ivan (CI) is simplest possible continuous integration tool.}
|
168
|
+
s.test_files = [
|
169
|
+
"test/crazy_ivan_test.rb",
|
170
|
+
"test/test_helper.rb"
|
171
|
+
]
|
172
|
+
|
173
|
+
if s.respond_to? :specification_version then
|
174
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
175
|
+
s.specification_version = 3
|
176
|
+
|
177
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
178
|
+
else
|
179
|
+
end
|
180
|
+
else
|
181
|
+
end
|
182
|
+
end
|