Class: MSPRelease::Build
Defined Under Namespace
Classes: NoChangesFileError
Instance Method Summary
collapse
#exec
Constructor Details
#initialize(basedir, project, options = {}) ⇒ Build
Returns a new instance of Build.
8
9
10
11
12
13
14
|
# File 'lib/msp_release/build.rb', line 8
def initialize(basedir, project, options={})
@basedir = basedir
@project = project
@options = options
@sign = options.fetch(:sign, true)
end
|
Instance Method Details
#output_directory ⇒ Object
52
53
54
55
|
# File 'lib/msp_release/build.rb', line 52
def output_directory
File.expand_path(@project.config[:deb_output_directory] ||
File.join(@basedir, '..'))
end
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/msp_release/build.rb', line 35
def perform!
dir = File.expand_path(@basedir)
raise "directory does not exist: #{dir}" unless
File.directory?(dir)
e = Exec.new(:name => 'build', :quiet => false, :status => :any)
Dir.chdir(@project.dir) do
e.exec(build_command)
end
if e.last_exitstatus != 0
LOG.warn("Warning: #{build_command} exited with #{e.last_exitstatus}")
end
@project.build_result(output_directory)
end
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/msp_release/build.rb', line 16
def perform_from_cli!
LOG.debug("Building package...")
result =
begin
self.perform!
rescue Exec::UnexpectedExitStatus => e
raise CLI::Exit, "build failed:\n#{e.stderr}"
rescue Build::NoChangesFileError => e
raise CLI::Exit, "Unable to find changes file with version: " +
"#{e.message}\nAvailable: \n" +
self.available_changes_files.map { |f| " #{f}" }.join("\n")
end
result.tap do
LOG.debug("Package built: #{result.package}")
end
end
|