Class: SpecInfra::Backend::Dockerfile

Inherits:
Base
  • Object
show all
Defined in:
lib/specinfra/backend/dockerfile.rb

Instance Method Summary collapse

Methods inherited from Base

#check_zero, #commands, #method_missing, #set_commands, #set_example

Constructor Details

#initializeDockerfile

Returns a new instance of Dockerfile.



4
5
6
7
8
9
# File 'lib/specinfra/backend/dockerfile.rb', line 4

def initialize
  @lines = []
  ObjectSpace.define_finalizer(self) {
    File.write("Dockerfile", @lines.join("\n"))
  }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SpecInfra::Backend::Base

Instance Method Details

#from(base) ⇒ Object



16
17
18
# File 'lib/specinfra/backend/dockerfile.rb', line 16

def from(base)
  @lines << "FROM #{base}"
end

#run_command(cmd, opts = {}) ⇒ Object



11
12
13
14
# File 'lib/specinfra/backend/dockerfile.rb', line 11

def run_command(cmd, opts={})
  @lines << "RUN #{cmd}"
  CommandResult.new
end