Class: Baps::Build

Inherits:
Object
  • Object
show all
Defined in:
lib/baps/build.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, version, &block) ⇒ Build

Returns a new instance of Build.

Raises:

  • (StandardError)


5
6
7
8
9
10
11
12
# File 'lib/baps/build.rb', line 5

def initialize(name, version, &block)
  raise StandardError.new('Nothing defined') unless block_given?
  @name = name
  @version = version
  @commands = []
  instance_eval(&block)
  @commands.unshift(Command.new("apt-get install -y -q #{dependencies.join(' ')}")) if dependencies
end

Instance Method Details

#deb_dirObject



21
22
23
# File 'lib/baps/build.rb', line 21

def deb_dir
  @deb_dir ||= File.join(dir, "debian-#{Time.now.utc.to_i}")
end

#dirObject



25
26
27
# File 'lib/baps/build.rb', line 25

def dir
  @dir ||= Dir.mktmpdir("baps-#{@name}-#{@version}-")
end

#startObject



14
15
16
17
18
19
# File 'lib/baps/build.rb', line 14

def start
  Dir.chdir(dir) do
    unpack_source
    @commands.each(&:execute)
  end
end