Class: Egads::Build
Defined Under Namespace
Modules: BuildHelpers
Instance Attribute Summary collapse
Instance Method Summary
collapse
#build_type, #can_build?, #error, #patch_path, #sha_is_checked_out?, #should_build?, #working_directory_is_clean?
#sha, #short_sha, #tarball
Methods inherited from Group
exit_on_failure?
Instance Attribute Details
#build_sha ⇒ Object
Returns the value of attribute build_sha.
12
13
14
|
# File 'lib/egads/command/build.rb', line 12
def build_sha
@build_sha
end
|
Instance Method Details
#check_build ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/egads/command/build.rb', line 14
def check_build
say_status :rev, "#{rev} parsed to #{sha}"
unless should_build?
say_status :done, "#{build_type} tarball for #{sha} already exists. Pass --force to rebuild."
exit 0
end
exit 1 unless can_build?
say_status :build, "Making #{build_type} tarball for #{sha}", :yellow
end
|
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/egads/command/build.rb', line 34
def
exit 1 unless sha_is_checked_out?
= ["REVISION"]
+= Config.
run_with_code("git add -f #{ * ' '} && git commit --no-verify -m '[egads seed] [ci skip]'")
self.build_sha = run_with_code("git rev-parse --verify HEAD").strip
run_with_code "git reset #{sha}"
end
|
#make_tarball ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/egads/command/build.rb', line 47
def make_tarball
if options[:seed]
run_with_code "git archive #{build_sha} --output #{tarball.local_tar_path}"
else
seed_ref = "refs/remotes/origin/#{Config.seed_branch}"
seed_parent = run_with_code("git rev-parse --verify #{seed_ref}^").strip
File.open('egads-seed', 'w') {|f| f << seed_parent + "\n" }
patch_files = [patch_path, 'egads-seed']
run_with_code "git diff --binary #{seed_ref} #{build_sha} > #{patch_path}"
run_with_code "tar -zcf #{tarball.local_tar_path} #{patch_files * ' '}"
patch_files.each {|f| File.delete(f) }
end
end
|
#push_seed ⇒ Object
73
74
75
76
77
|
# File 'lib/egads/command/build.rb', line 73
def push_seed
if options[:seed]
run_with_code "git push -f origin #{build_sha}:refs/heads/#{Config.seed_branch}"
end
end
|
#run_after_build_hooks ⇒ Object
65
66
67
|
# File 'lib/egads/command/build.rb', line 65
def run_after_build_hooks
run_hooks_for(:build, :after)
end
|
#run_before_build_hooks ⇒ Object
26
27
28
|
# File 'lib/egads/command/build.rb', line 26
def run_before_build_hooks
run_hooks_for(:build, :before)
end
|
#upload ⇒ Object
69
70
71
|
# File 'lib/egads/command/build.rb', line 69
def upload
invoke(Egads::Upload, [sha], force: options[:force], seed: options[:seed]) unless options['no-upload']
end
|
#write_revision_file ⇒ Object
30
31
32
|
# File 'lib/egads/command/build.rb', line 30
def write_revision_file
File.open('REVISION', 'w') {|f| f << sha + "\n" }
end
|