Class: Baps::Build
- Inherits:
-
Object
- Object
- Baps::Build
- Defined in:
- lib/baps/build.rb
Instance Method Summary collapse
- #deb_dir ⇒ Object
- #dir ⇒ Object
-
#initialize(name, version, &block) ⇒ Build
constructor
A new instance of Build.
- #start ⇒ Object
Constructor Details
#initialize(name, version, &block) ⇒ Build
Returns a new instance of Build.
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_dir ⇒ Object
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 |
#dir ⇒ Object
25 26 27 |
# File 'lib/baps/build.rb', line 25 def dir @dir ||= Dir.mktmpdir("baps-#{@name}-#{@version}-") end |
#start ⇒ Object
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 |