Class: Trokko::Scaffolders::Dockerfile

Inherits:
Object
  • Object
show all
Defined in:
lib/trokko/scaffolders/dockerfile.rb

Overview

Generating Dockerfile according to configurations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ruby_version:, db:, thor:) ⇒ Dockerfile

Returns a new instance of Dockerfile.



9
10
11
12
13
# File 'lib/trokko/scaffolders/dockerfile.rb', line 9

def initialize(ruby_version:, db:, thor:)
  @ruby_version = ruby_version
  @db = db
  @thor = thor
end

Instance Attribute Details

#dbObject (readonly)

Returns the value of attribute db.



7
8
9
# File 'lib/trokko/scaffolders/dockerfile.rb', line 7

def db
  @db
end

#ruby_versionObject (readonly)

Returns the value of attribute ruby_version.



7
8
9
# File 'lib/trokko/scaffolders/dockerfile.rb', line 7

def ruby_version
  @ruby_version
end

#thorObject (readonly)

Returns the value of attribute thor.



7
8
9
# File 'lib/trokko/scaffolders/dockerfile.rb', line 7

def thor
  @thor
end

Instance Method Details

#generateObject



15
16
17
18
19
20
21
22
# File 'lib/trokko/scaffolders/dockerfile.rb', line 15

def generate
  thor.template(
    'templates/Dockerfile.erb',
    "#{thor.name}/Dockerfile",
    force: true,
    context: binding
  )
end