Class: DockerTools::Debootstrap
- Inherits:
-
Object
- Object
- DockerTools::Debootstrap
- Defined in:
- lib/docker_tools/debootstrap.rb
Instance Attribute Summary collapse
-
#archive ⇒ Object
Returns the value of attribute archive.
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#initialize(name, distro, tmpdir = '/tmp') ⇒ Debootstrap
constructor
A new instance of Debootstrap.
- #run ⇒ Object
Constructor Details
#initialize(name, distro, tmpdir = '/tmp') ⇒ Debootstrap
Returns a new instance of Debootstrap.
5 6 7 8 9 10 |
# File 'lib/docker_tools/debootstrap.rb', line 5 def initialize(name, distro, tmpdir='/tmp') @name = name @distro = distro @tmpdir = tmpdir @archive = "#{@tmpdir}/#{@name}.tar" end |
Instance Attribute Details
#archive ⇒ Object
Returns the value of attribute archive.
3 4 5 |
# File 'lib/docker_tools/debootstrap.rb', line 3 def archive @archive end |
Instance Method Details
#cleanup ⇒ Object
21 22 23 |
# File 'lib/docker_tools/debootstrap.rb', line 21 def cleanup `rm -rf #{@tmpdir}/#{@name}*` end |
#run ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/docker_tools/debootstrap.rb', line 12 def run output = `debootstrap --download-only #{@distro} #{@tmpdir}/#{@name}` unless $?.to_i == 0 puts output throw "Could not run debootstrap" end `cd #{@tmpdir}/#{@name} && tar -cvf ../#{@name}.tar .` end |