Class: Spriggan::BuildJob
- Inherits:
-
Object
- Object
- Spriggan::BuildJob
- Defined in:
- lib/spriggan/buildjob.rb
Instance Method Summary collapse
-
#initialize(source_dir, dest_dir) ⇒ BuildJob
constructor
A new instance of BuildJob.
- #run! ⇒ Object
Constructor Details
#initialize(source_dir, dest_dir) ⇒ BuildJob
Returns a new instance of BuildJob.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/spriggan/buildjob.rb', line 11 def initialize(source_dir, dest_dir) @bare_repo = Pathname.new(source_dir). @apt_root = Pathname.new(dest_dir). unless @bare_repo.directory? and (@bare_repo + 'config').file? raise ArgumentError, 'invalid source' end unless @apt_root.directory? and (@apt_root + 'conf' + 'distributions').file? raise ArgumentError, 'invalid destination' end @project = {} @project[:root] = @bare_repo + 'spriggan' @project[:name] = @bare_repo.basename.to_s.sub(/\.git$/, '') @project[:name] = @bare_repo.parent.basename.to_s if @project[:name] == '' @project[:cache] = @project[:root] + 'cache' @build = {} @build[:timestamp] = Time.now.strftime("%Y%m%d%H%M%S") @build[:id] = @build[:timestamp] + '-' + rand(2**40).to_s(32).rjust(8, '0') @build[:root] = @project[:root] + 'jobs' + @build[:id] @build[:files] = @build[:root] + 'fs' @build[:pkgs] = @build[:root] + 'pkgs' @build[:debs] = @build[:root] + 'debs' @packages = {} @signatures = {'packages' => {}, 'metapackage' => nil} end |
Instance Method Details
#run! ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/spriggan/buildjob.rb', line 42 def run! [@project[:cache], @build[:files], @build[:pkgs], @build[:debs]].each(&:mkpath) begin execute_mutations! ensure @build[:root].rmtree if @build[:root].directory? end end |