Class: MKBrut::Segments::Heroku

Inherits:
Base
  • Object
show all
Defined in:
lib/mkbrut/segments/heroku.rb

Constant Summary

Constants included from MKBrut

VERSION

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#create!

Constructor Details

#initialize(app_options:, current_dir:, templates_dir:) ⇒ Heroku



4
5
6
7
8
# File 'lib/mkbrut/segments/heroku.rb', line 4

def initialize(app_options:, current_dir:, templates_dir:)
  @project_root  = current_dir / app_options.app_name
  @templates_dir = templates_dir / "segments" / "Heroku"
  @erb_binding   = MKBrut::ErbBindingDelegate.new(app_options)
end

Class Method Details

.friendly_nameObject



2
# File 'lib/mkbrut/segments/heroku.rb', line 2

def self.friendly_name = "Heroku-based Deployment"

Instance Method Details

#add!Object



10
11
12
13
14
15
16
17
# File 'lib/mkbrut/segments/heroku.rb', line 10

def add!
  operations = copy_files(@templates_dir, @project_root) + 
               other_operations

  operations.each do |operation|
    operation.call
  end
end

#other_operationsObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/mkbrut/segments/heroku.rb', line 19

def other_operations
  [
    MKBrut::Ops::AppendToFile.new(
      file: @project_root / ".gitignore",
      content: %{
# These are generated by bin/deploy
deploy/Dockerfile.*
}
    )
  ]
end