Class: MKBrut::Base
Overview
Constructs the base of any Brut app.
Direct Known Subclasses
Defined Under Namespace
Classes: ErbBinding
Constant Summary
Constants included from MKBrut
Instance Method Summary collapse
- #create! ⇒ Object
-
#initialize(app_options:, current_dir:, templates_dir:) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(app_options:, current_dir:, templates_dir:) ⇒ Base
Returns a new instance of Base.
11 12 13 14 15 |
# File 'lib/mkbrut/base.rb', line 11 def initialize(app_options:, current_dir:, templates_dir:) @project_root = current_dir / .app_name @templates_dir = templates_dir / "Base" @erb_binding = ErbBinding.new() end |
Instance Method Details
#create! ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/mkbrut/base.rb', line 17 def create! if @project_root.exist? raise "Project root #{@project_root} already exists" end operations = [ Ops::Mkdir.new(@project_root) ] + copy_files(@templates_dir, @project_root) operations.each do |operation| operation.call end end |