Class: FPM::Fry::DockerFile::Source
- Inherits:
-
Struct
- Object
- Struct
- FPM::Fry::DockerFile::Source
- Defined in:
- lib/fpm/fry/docker_file.rb
Instance Attribute Summary collapse
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#variables ⇒ Object
Returns the value of attribute variables.
Instance Method Summary collapse
- #dockerfile ⇒ Object
-
#initialize(variables, cache = Source::Null::Cache) ⇒ Source
constructor
A new instance of Source.
- #self_tar_io ⇒ Object
- #tar_io ⇒ Object
Constructor Details
#initialize(variables, cache = Source::Null::Cache) ⇒ Source
Returns a new instance of Source.
13 14 15 16 17 18 19 20 21 |
# File 'lib/fpm/fry/docker_file.rb', line 13 def initialize(variables, cache = Source::Null::Cache) variables = variables.dup.freeze super(variables, cache) if cache.respond_to? :logger @logger = cache.logger else @logger = Cabin::Channel.get end end |
Instance Attribute Details
#cache ⇒ Object
Returns the value of attribute cache
11 12 13 |
# File 'lib/fpm/fry/docker_file.rb', line 11 def cache @cache end |
#variables ⇒ Object
Returns the value of attribute variables
11 12 13 |
# File 'lib/fpm/fry/docker_file.rb', line 11 def variables @variables end |
Instance Method Details
#dockerfile ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fpm/fry/docker_file.rb', line 23 def dockerfile df = [] df << "FROM #{variables[:image]}" df << "RUN mkdir /tmp/build" file_map.each do |from, to| df << "COPY #{map_from(from)} #{map_to(to)}" end df << "" return df.join("\n") end |
#self_tar_io ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fpm/fry/docker_file.rb', line 44 def self_tar_io sio = StringIO.new tar = Gem::Package::TarWriter.new(sio) tar.add_file(NAME,'0777') do |io| io.write(dockerfile) end #tar.close sio.rewind return sio end |