heidi 0.3.1 → 0.4.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.
- data/Gemfile +1 -0
- data/Gemfile.lock +3 -0
- data/README.rdoc +20 -0
- data/VERSION +1 -1
- data/bin/heidi +8 -82
- data/heidi.gemspec +49 -10
- data/lib/heidi.rb +4 -0
- data/lib/heidi/build.rb +42 -10
- data/lib/heidi/builder.rb +7 -2
- data/lib/heidi/hook.rb +2 -0
- data/lib/heidi/integrator.rb +11 -5
- data/lib/heidi/project.rb +37 -24
- data/lib/heidi/shell.rb +119 -0
- data/lib/heidi/tester.rb +6 -5
- data/lib/heidi/web.rb +65 -4
- data/lib/heidi/web/assets/css/bootstrap-responsive.css +643 -0
- data/lib/heidi/web/assets/css/bootstrap.css +3682 -0
- data/lib/heidi/web/{public/css/screen.css → assets/css/colors.css} +1 -75
- data/lib/heidi/web/assets/css/docs.css +772 -0
- data/lib/heidi/web/{public → assets}/images/HeidiBlue-480.png +0 -0
- data/lib/heidi/web/{public → assets}/images/HeidiBlue.gif +0 -0
- data/lib/heidi/web/{public → assets}/images/OrganisedMinds.png +0 -0
- data/lib/heidi/web/{public → assets}/images/heidi.jpeg +0 -0
- data/lib/heidi/web/assets/img/glyphicons-halflings-white.png +0 -0
- data/lib/heidi/web/assets/img/glyphicons-halflings.png +0 -0
- data/lib/heidi/web/assets/img/glyphicons/glyphicons_009_magic.png +0 -0
- data/lib/heidi/web/assets/img/glyphicons/glyphicons_042_group.png +0 -0
- data/lib/heidi/web/assets/img/glyphicons/glyphicons_079_podium.png +0 -0
- data/lib/heidi/web/assets/img/glyphicons/glyphicons_082_roundabout.png +0 -0
- data/lib/heidi/web/assets/img/glyphicons/glyphicons_155_show_thumbnails.png +0 -0
- data/lib/heidi/web/assets/img/glyphicons/glyphicons_163_iphone.png +0 -0
- data/lib/heidi/web/assets/img/glyphicons/glyphicons_214_resize_small.png +0 -0
- data/lib/heidi/web/assets/img/glyphicons/glyphicons_266_book_open.png +0 -0
- data/lib/heidi/web/assets/js/README.md +106 -0
- data/lib/heidi/web/assets/js/application.js +180 -0
- data/lib/heidi/web/assets/js/bootstrap-alert.js +94 -0
- data/lib/heidi/web/assets/js/bootstrap-button.js +100 -0
- data/lib/heidi/web/assets/js/bootstrap-carousel.js +157 -0
- data/lib/heidi/web/assets/js/bootstrap-collapse.js +136 -0
- data/lib/heidi/web/assets/js/bootstrap-dropdown.js +92 -0
- data/lib/heidi/web/assets/js/bootstrap-modal.js +210 -0
- data/lib/heidi/web/assets/js/bootstrap-popover.js +95 -0
- data/lib/heidi/web/assets/js/bootstrap-scrollspy.js +125 -0
- data/lib/heidi/web/assets/js/bootstrap-tab.js +130 -0
- data/lib/heidi/web/assets/js/bootstrap-tooltip.js +270 -0
- data/lib/heidi/web/assets/js/bootstrap-transition.js +51 -0
- data/lib/heidi/web/assets/js/bootstrap-typeahead.js +271 -0
- data/lib/heidi/web/assets/js/google-code-prettify/prettify.css +30 -0
- data/lib/heidi/web/assets/js/google-code-prettify/prettify.js +28 -0
- data/lib/heidi/web/assets/js/jquery.js +9252 -0
- data/lib/heidi/web/views/build.erb +40 -24
- data/lib/heidi/web/views/commit.erb +10 -7
- data/lib/heidi/web/views/config.erb +34 -18
- data/lib/heidi/web/views/home.erb +44 -25
- data/lib/heidi/web/views/layout.erb +57 -4
- data/lib/heidi/web/views/new_project.erb +56 -0
- data/lib/heidi/web/views/project.erb +114 -32
- data/lib/heidi/web/views/project_header.erb +20 -0
- data/spec/heidi/build_spec.rb +163 -2
- data/spec/heidi/builder_spec.rb +61 -1
- data/spec/heidi/hook_spec.rb +47 -1
- data/spec/heidi/integrator_spec.rb +96 -1
- data/spec/heidi/project_spec.rb +177 -2
- data/spec/heidi/shell_spec.rb +67 -0
- data/spec/heidi/web_spec.rb +78 -2
- data/spec/heidi_spec.rb +16 -5
- data/spec/spec_helper.rb +1 -1
- data/spec/support/01_rworld.rb +9 -0
- data/spec/support/mock_project.rb +39 -0
- data/spec/support/survivable.rb +10 -0
- metadata +131 -79
- data/spec/heidi/tester_spec.rb +0 -5
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -14,6 +14,8 @@ GEM
|
|
14
14
|
rack (1.4.1)
|
15
15
|
rack-protection (1.2.0)
|
16
16
|
rack
|
17
|
+
rack-test (0.6.1)
|
18
|
+
rack (>= 1.0)
|
17
19
|
rake (0.9.2.2)
|
18
20
|
rcov (0.9.10)
|
19
21
|
rdoc (3.12)
|
@@ -43,6 +45,7 @@ PLATFORMS
|
|
43
45
|
DEPENDENCIES
|
44
46
|
bundler (~> 1.0.0)
|
45
47
|
jeweler (~> 1.8.3)
|
48
|
+
rack-test
|
46
49
|
rcov
|
47
50
|
rdoc (~> 3.12)
|
48
51
|
rspec (~> 2.8.0)
|
data/README.rdoc
CHANGED
@@ -79,6 +79,7 @@ following directories:
|
|
79
79
|
- test/
|
80
80
|
- success/
|
81
81
|
- failure/
|
82
|
+
- after/
|
82
83
|
|
83
84
|
If you place shell scripts in these directories and make them executable,
|
84
85
|
these scripts will be executed inside the build directory at a given time.
|
@@ -89,6 +90,25 @@ these scripts will be executed inside the build directory at a given time.
|
|
89
90
|
[success] Is run when the tests where performed in good order. Send huray
|
90
91
|
emails here
|
91
92
|
[failure] Is run when the tests failed. Send he-or-she-broke-it emails here.
|
93
|
+
[after] Runs after success or failure.
|
94
|
+
|
95
|
+
=== Environment
|
96
|
+
|
97
|
+
Each hook is called with a Pretty-Clean-Environment. At the very least it is
|
98
|
+
made sure that you are not hindered by GemBundler.
|
99
|
+
|
100
|
+
How Heidi hooks hold up with RVM; I'm just not sure...
|
101
|
+
|
102
|
+
There is a number of Heidi variables passed into the hook as well
|
103
|
+
|
104
|
+
[$HEIDI_DIR] The project directory
|
105
|
+
[$HEIDI_LOG_DIR] The build's log directory (so you can write your own)
|
106
|
+
[$HEIDI_BUILD_DIR] The build root
|
107
|
+
[$HEIDI_BUILD_COMMIT] The abbrev. of the commit currently working on.
|
108
|
+
|
109
|
+
==== Caveat
|
110
|
+
|
111
|
+
These environment variable might be subject to change in the (near) future
|
92
112
|
|
93
113
|
== History
|
94
114
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/bin/heidi
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'heidi'
|
3
|
+
require 'heidi/shell'
|
5
4
|
|
6
5
|
cmd = ARGV.shift
|
7
6
|
for_a = ARGV.shift
|
@@ -12,32 +11,14 @@ if ENV['HEIDI_PATH']
|
|
12
11
|
ENV['HEIDI_PATH'] = nil
|
13
12
|
end
|
14
13
|
|
15
|
-
shell = SimpleShell.new
|
16
14
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
exit 1
|
21
|
-
end
|
22
|
-
end
|
15
|
+
|
16
|
+
include Heidi::Shell
|
17
|
+
noisy
|
23
18
|
|
24
19
|
case cmd
|
25
20
|
when "new"
|
26
|
-
|
27
|
-
puts "creating #{for_a}/projects"
|
28
|
-
shell.mkdir %W(-p #{for_a}/projects)
|
29
|
-
shell.mkdir %W(-p #{for_a}/bin)
|
30
|
-
puts "creating #{for_a}/Gemfile"
|
31
|
-
File.open("#{for_a}/Gemfile", File::CREAT|File::WRONLY) do |f|
|
32
|
-
f.puts 'source "http://rubygems.org"'
|
33
|
-
f.puts 'gem "heidi"'
|
34
|
-
end
|
35
|
-
|
36
|
-
puts "\nIf you like you can run: bundle install --binstubs"
|
37
|
-
puts "this will tie heidi and heidi_web to this location"
|
38
|
-
puts "\nFor even more tying down, run: bundle install --deployment"
|
39
|
-
puts "after running bundle install --binstubs"
|
40
|
-
|
21
|
+
new_heidi_root(for_a)
|
41
22
|
|
42
23
|
when "project"
|
43
24
|
repo = ARGV.shift
|
@@ -48,69 +29,14 @@ when "project"
|
|
48
29
|
end
|
49
30
|
|
50
31
|
check_heidi_root
|
32
|
+
new_project(for_a, repo)
|
51
33
|
|
52
|
-
if File.exists? "projects/#{for_a}"
|
53
|
-
$stderr.puts "projects/#{for_a} is in the way. Please remove it"
|
54
|
-
exit 1
|
55
|
-
end
|
56
|
-
|
57
|
-
# create a logs dir
|
58
|
-
puts "creating projects/#{for_a}"
|
59
|
-
puts "creating projects/#{for_a}/logs"
|
60
|
-
shell.mkdir %W(-p projects/#{for_a}/logs)
|
61
|
-
|
62
|
-
%w(build tests failure success before).each do |hook|
|
63
|
-
puts "creating projects/#{for_a}/hooks/#{hook}"
|
64
|
-
shell.mkdir %W(-p projects/#{for_a}/hooks/#{hook})
|
65
|
-
end
|
66
|
-
|
67
|
-
# make a clone
|
68
|
-
shell.in("projects/#{for_a}") do |sh|
|
69
|
-
puts "filling #{for_a} cache"
|
70
|
-
|
71
|
-
puts "git clone #{repo}"
|
72
|
-
sh.git %W(clone #{repo} cached)
|
73
|
-
|
74
|
-
sh.in("cached") do |cached|
|
75
|
-
puts "setting the name of the project to: #{for_a}"
|
76
|
-
cached.git %W(config heidi.name #{for_a})
|
77
|
-
end
|
78
|
-
end
|
79
|
-
puts "Creating default test hook: projects/#{for_a}/hooks/tests/01_rspec"
|
80
|
-
File.open("projects/#{for_a}/hooks/tests/01_rspec", File::CREAT|File::WRONLY) do |f|
|
81
|
-
f.puts %q(#!/bin/sh
|
82
|
-
|
83
|
-
# edit this file to your needs
|
84
|
-
bundle exec rake spec
|
85
|
-
)
|
86
|
-
end
|
87
|
-
shell.chmod %W(+x projects/#{for_a}/hooks/tests/01_rspec)
|
88
|
-
puts "\n"
|
89
|
-
puts "Now edit or add some hooks and run: heidi integrate #{for_a}"
|
90
34
|
|
91
35
|
when "drop"
|
92
36
|
check_heidi_root
|
93
|
-
|
94
|
-
# remove build and cache dir, expose logs directly
|
95
|
-
puts "removing build dir"
|
96
|
-
shell.rm %W(-r projects/#{for_a}/build)
|
97
|
-
puts "removing cache (preserving project config)"
|
98
|
-
shell.cp %W(-pr projects/#{for_a}/cached/.git/config projects/#{for_a})
|
99
|
-
shell.rm %W(-r projects/#{for_a}/cached)
|
100
|
-
puts "exposing builds"
|
101
|
-
shell.mv %W(projects/#{for_a}/logs/* projects/#{for_a}/)
|
102
|
-
shell.rm %W(-r projects/#{for_a}/logs)
|
37
|
+
remove_project(for_a)
|
103
38
|
|
104
39
|
when "integrate"
|
105
|
-
|
106
|
-
heidi.projects.each do |project|
|
107
|
-
next if !for_a.nil? && project.name != for_a
|
108
|
-
|
109
|
-
project.fetch
|
110
|
-
msg = project.integrate(!for_a.nil?)
|
111
|
-
unless msg.nil? || msg == true
|
112
|
-
$stderr.puts "#{project.name}: #{msg}"
|
113
|
-
end
|
114
|
-
end
|
40
|
+
integrate(for_a)
|
115
41
|
|
116
42
|
end
|
data/heidi.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "heidi"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Hartog C. de Mik"]
|
12
|
-
s.date = "2012-
|
12
|
+
s.date = "2012-03-01"
|
13
13
|
s.description = "CI-Joe alike CI system called Heidi."
|
14
14
|
s.email = "hartog@organisedminds.com"
|
15
15
|
s.executables = ["heidi", "heidi_web"]
|
@@ -36,34 +36,70 @@ Gem::Specification.new do |s|
|
|
36
36
|
"lib/heidi/hook.rb",
|
37
37
|
"lib/heidi/integrator.rb",
|
38
38
|
"lib/heidi/project.rb",
|
39
|
+
"lib/heidi/shell.rb",
|
39
40
|
"lib/heidi/tester.rb",
|
40
41
|
"lib/heidi/web.rb",
|
41
|
-
"lib/heidi/web/
|
42
|
-
"lib/heidi/web/
|
43
|
-
"lib/heidi/web/
|
44
|
-
"lib/heidi/web/
|
45
|
-
"lib/heidi/web/
|
42
|
+
"lib/heidi/web/assets/css/bootstrap-responsive.css",
|
43
|
+
"lib/heidi/web/assets/css/bootstrap.css",
|
44
|
+
"lib/heidi/web/assets/css/colors.css",
|
45
|
+
"lib/heidi/web/assets/css/docs.css",
|
46
|
+
"lib/heidi/web/assets/images/HeidiBlue-480.png",
|
47
|
+
"lib/heidi/web/assets/images/HeidiBlue.gif",
|
48
|
+
"lib/heidi/web/assets/images/OrganisedMinds.png",
|
49
|
+
"lib/heidi/web/assets/images/heidi.jpeg",
|
50
|
+
"lib/heidi/web/assets/img/glyphicons-halflings-white.png",
|
51
|
+
"lib/heidi/web/assets/img/glyphicons-halflings.png",
|
52
|
+
"lib/heidi/web/assets/img/glyphicons/glyphicons_009_magic.png",
|
53
|
+
"lib/heidi/web/assets/img/glyphicons/glyphicons_042_group.png",
|
54
|
+
"lib/heidi/web/assets/img/glyphicons/glyphicons_079_podium.png",
|
55
|
+
"lib/heidi/web/assets/img/glyphicons/glyphicons_082_roundabout.png",
|
56
|
+
"lib/heidi/web/assets/img/glyphicons/glyphicons_155_show_thumbnails.png",
|
57
|
+
"lib/heidi/web/assets/img/glyphicons/glyphicons_163_iphone.png",
|
58
|
+
"lib/heidi/web/assets/img/glyphicons/glyphicons_214_resize_small.png",
|
59
|
+
"lib/heidi/web/assets/img/glyphicons/glyphicons_266_book_open.png",
|
60
|
+
"lib/heidi/web/assets/js/README.md",
|
61
|
+
"lib/heidi/web/assets/js/application.js",
|
62
|
+
"lib/heidi/web/assets/js/bootstrap-alert.js",
|
63
|
+
"lib/heidi/web/assets/js/bootstrap-button.js",
|
64
|
+
"lib/heidi/web/assets/js/bootstrap-carousel.js",
|
65
|
+
"lib/heidi/web/assets/js/bootstrap-collapse.js",
|
66
|
+
"lib/heidi/web/assets/js/bootstrap-dropdown.js",
|
67
|
+
"lib/heidi/web/assets/js/bootstrap-modal.js",
|
68
|
+
"lib/heidi/web/assets/js/bootstrap-popover.js",
|
69
|
+
"lib/heidi/web/assets/js/bootstrap-scrollspy.js",
|
70
|
+
"lib/heidi/web/assets/js/bootstrap-tab.js",
|
71
|
+
"lib/heidi/web/assets/js/bootstrap-tooltip.js",
|
72
|
+
"lib/heidi/web/assets/js/bootstrap-transition.js",
|
73
|
+
"lib/heidi/web/assets/js/bootstrap-typeahead.js",
|
74
|
+
"lib/heidi/web/assets/js/google-code-prettify/prettify.css",
|
75
|
+
"lib/heidi/web/assets/js/google-code-prettify/prettify.js",
|
76
|
+
"lib/heidi/web/assets/js/jquery.js",
|
46
77
|
"lib/heidi/web/views/build.erb",
|
47
78
|
"lib/heidi/web/views/commit.erb",
|
48
79
|
"lib/heidi/web/views/config.erb",
|
49
80
|
"lib/heidi/web/views/home.erb",
|
50
81
|
"lib/heidi/web/views/layout.erb",
|
82
|
+
"lib/heidi/web/views/new_project.erb",
|
51
83
|
"lib/heidi/web/views/project.erb",
|
84
|
+
"lib/heidi/web/views/project_header.erb",
|
52
85
|
"spec/heidi/build_spec.rb",
|
53
86
|
"spec/heidi/builder_spec.rb",
|
54
87
|
"spec/heidi/git_spec.rb",
|
55
88
|
"spec/heidi/hook_spec.rb",
|
56
89
|
"spec/heidi/integrator_spec.rb",
|
57
90
|
"spec/heidi/project_spec.rb",
|
58
|
-
"spec/heidi/
|
91
|
+
"spec/heidi/shell_spec.rb",
|
59
92
|
"spec/heidi/web_spec.rb",
|
60
93
|
"spec/heidi_spec.rb",
|
61
|
-
"spec/spec_helper.rb"
|
94
|
+
"spec/spec_helper.rb",
|
95
|
+
"spec/support/01_rworld.rb",
|
96
|
+
"spec/support/mock_project.rb",
|
97
|
+
"spec/support/survivable.rb"
|
62
98
|
]
|
63
99
|
s.homepage = "http://github.com/coffeeaddict/heid"
|
64
100
|
s.licenses = ["MIT"]
|
65
101
|
s.require_paths = ["lib"]
|
66
|
-
s.rubygems_version = "1.8.
|
102
|
+
s.rubygems_version = "1.8.16"
|
67
103
|
s.summary = "A naive CI system"
|
68
104
|
|
69
105
|
if s.respond_to? :specification_version then
|
@@ -74,6 +110,7 @@ Gem::Specification.new do |s|
|
|
74
110
|
s.add_runtime_dependency(%q<sinatra>, [">= 0"])
|
75
111
|
s.add_runtime_dependency(%q<simple_shell>, [">= 0"])
|
76
112
|
s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
|
113
|
+
s.add_development_dependency(%q<rack-test>, [">= 0"])
|
77
114
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
78
115
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
79
116
|
s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
|
@@ -83,6 +120,7 @@ Gem::Specification.new do |s|
|
|
83
120
|
s.add_dependency(%q<sinatra>, [">= 0"])
|
84
121
|
s.add_dependency(%q<simple_shell>, [">= 0"])
|
85
122
|
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
123
|
+
s.add_dependency(%q<rack-test>, [">= 0"])
|
86
124
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
87
125
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
88
126
|
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
@@ -93,6 +131,7 @@ Gem::Specification.new do |s|
|
|
93
131
|
s.add_dependency(%q<sinatra>, [">= 0"])
|
94
132
|
s.add_dependency(%q<simple_shell>, [">= 0"])
|
95
133
|
s.add_dependency(%q<rspec>, ["~> 2.8.0"])
|
134
|
+
s.add_dependency(%q<rack-test>, [">= 0"])
|
96
135
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
97
136
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
98
137
|
s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
|
data/lib/heidi.rb
CHANGED
data/lib/heidi/build.rb
CHANGED
@@ -8,6 +8,9 @@ class Heidi
|
|
8
8
|
# A build is tied to a commit
|
9
9
|
#
|
10
10
|
class Build
|
11
|
+
FAILURE = "FAILURE"
|
12
|
+
SUCCESS = "SUCCESS"
|
13
|
+
|
11
14
|
attr_reader :project, :commit, :root, :log_root, :build_root, :shell,
|
12
15
|
:hooks, :logs
|
13
16
|
|
@@ -26,6 +29,8 @@ class Heidi
|
|
26
29
|
|
27
30
|
@shell.mkdir %W(-p #{@log_root}) unless File.exists?(@log_root)
|
28
31
|
@logs = Logs.new(@log_root)
|
32
|
+
|
33
|
+
@i_locked_build = false
|
29
34
|
end
|
30
35
|
|
31
36
|
def author
|
@@ -36,6 +41,16 @@ class Heidi
|
|
36
41
|
project.date(@commit)
|
37
42
|
end
|
38
43
|
|
44
|
+
def message
|
45
|
+
project.message(@commit)
|
46
|
+
end
|
47
|
+
|
48
|
+
def time
|
49
|
+
Time.parse(date)
|
50
|
+
rescue
|
51
|
+
Time.now
|
52
|
+
end
|
53
|
+
|
39
54
|
def load_hooks
|
40
55
|
log :info, "Loading hooks"
|
41
56
|
@hooks = {
|
@@ -77,7 +92,7 @@ class Heidi
|
|
77
92
|
shell.mv %W(#{@log_root} #{@log_root}.0)
|
78
93
|
end
|
79
94
|
|
80
|
-
%
|
95
|
+
%W(build/ #{SUCCESS} #{FAILURE}).each do |inode|
|
81
96
|
shell.rm("-r", "-f", inode) if File.exists? File.join(@root, inode)
|
82
97
|
end
|
83
98
|
|
@@ -103,9 +118,11 @@ class Heidi
|
|
103
118
|
def lock(&block)
|
104
119
|
log(:info, "Locking build")
|
105
120
|
File.open(lock_file, File::CREAT|File::TRUNC|File::WRONLY) do |f|
|
121
|
+
@i_locked_build = true
|
106
122
|
f.puts Time.now.ctime
|
107
123
|
end
|
108
124
|
|
125
|
+
|
109
126
|
if block_given?
|
110
127
|
yield
|
111
128
|
unlock
|
@@ -116,23 +133,28 @@ class Heidi
|
|
116
133
|
return unless locked?
|
117
134
|
log(:info, "Unlocking build")
|
118
135
|
File.unlink lock_file
|
136
|
+
@i_locked_build = false
|
119
137
|
end
|
120
138
|
|
121
139
|
def locked?
|
122
140
|
File.exists? lock_file
|
123
141
|
end
|
124
142
|
|
143
|
+
def locked_build?
|
144
|
+
@i_locked_build == true ? true : false
|
145
|
+
end
|
146
|
+
|
125
147
|
def record(what)
|
126
148
|
flags = File::CREAT|File::TRUNC|File::WRONLY
|
127
149
|
file = nil
|
128
150
|
case what
|
129
151
|
when :failure
|
130
|
-
project.build_status =
|
131
|
-
file = File.open(File.join(@root,
|
152
|
+
project.build_status = Heidi::FAILED
|
153
|
+
file = File.open(File.join(@root, FAILURE), flags)
|
132
154
|
when :success
|
133
|
-
project.build_status =
|
155
|
+
project.build_status = Heidi::PASSED
|
134
156
|
project.record_latest_build
|
135
|
-
file = File.open(File.join(@root,
|
157
|
+
file = File.open(File.join(@root, SUCCESS), flags)
|
136
158
|
end
|
137
159
|
|
138
160
|
unless file.nil?
|
@@ -142,19 +164,19 @@ class Heidi
|
|
142
164
|
end
|
143
165
|
|
144
166
|
def failed?
|
145
|
-
File.exists?(File.join(@root,
|
167
|
+
File.exists?(File.join(@root, FAILURE))
|
146
168
|
end
|
147
169
|
|
148
170
|
def success?
|
149
|
-
File.exists?(File.join(@root,
|
171
|
+
File.exists?(File.join(@root, SUCCESS))
|
150
172
|
end
|
151
173
|
|
152
174
|
def status
|
153
175
|
self.failed? ?
|
154
|
-
|
176
|
+
Heidi::FAILED :
|
155
177
|
self.success? ?
|
156
|
-
|
157
|
-
|
178
|
+
Heidi::PASSED :
|
179
|
+
Heidi::DNF
|
158
180
|
end
|
159
181
|
|
160
182
|
# file handle to tar ball
|
@@ -170,6 +192,8 @@ class Heidi
|
|
170
192
|
@log_root = log_root
|
171
193
|
@logs = []
|
172
194
|
|
195
|
+
FileUtils.mkdir_p log_root if !File.directory?(log_root)
|
196
|
+
|
173
197
|
Dir[File.join(@log_root, "*")].each do |file|
|
174
198
|
@logs << Log.new(file)
|
175
199
|
end
|
@@ -205,6 +229,14 @@ class Heidi
|
|
205
229
|
f.puts msg
|
206
230
|
end
|
207
231
|
end
|
232
|
+
|
233
|
+
read
|
234
|
+
end
|
235
|
+
|
236
|
+
def read
|
237
|
+
@contents = File.read(@file)
|
238
|
+
rescue
|
239
|
+
@contents = ""
|
208
240
|
end
|
209
241
|
|
210
242
|
def raw(msg)
|
data/lib/heidi/builder.rb
CHANGED
@@ -15,6 +15,11 @@ class Heidi
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def setup_build_dir
|
18
|
+
if build.locked? and !build.locked_build?
|
19
|
+
build.log(:error, "The build was locked externaly")
|
20
|
+
return false
|
21
|
+
end
|
22
|
+
|
18
23
|
if File.exists? build.build_root
|
19
24
|
build.log(:info, "Removing previous build")
|
20
25
|
build.shell.do "rm", "-r", build.build_root
|
@@ -28,10 +33,10 @@ class Heidi
|
|
28
33
|
return false
|
29
34
|
end
|
30
35
|
|
31
|
-
if project.
|
36
|
+
if project.branch
|
32
37
|
@git = Heidi::Git.new(build.build_root)
|
33
38
|
|
34
|
-
branch = project.
|
39
|
+
branch = project.branch
|
35
40
|
build.log(:info, "Switching to integration branch: #{branch}")
|
36
41
|
res = @git.switch(branch)
|
37
42
|
if res.nil?
|