Class: Brut::CLI::Apps::New::Base
- Inherits:
-
Object
- Object
- Brut::CLI::Apps::New::Base
- Includes:
- Brut::CLI::Apps::New
- Defined in:
- lib/brut/cli/apps/new/base.rb
Overview
Constructs the base of any Brut app.
Direct Known Subclasses
Segments::BareBones, Segments::Demo, Segments::Heroku, Segments::Sidekiq
Defined Under Namespace
Classes: ErbBinding
Instance Attribute Summary collapse
-
#project_root ⇒ Object
readonly
Returns the value of attribute project_root.
Instance Method Summary collapse
-
#create! ⇒ Object
-
#initialize(app_name:, options:, versions:, current_dir:, templates_dir:) ⇒ Base
constructor
A new instance of Base.
-
#output_post_add_messaging(stdout:) ⇒ Object
Constructor Details
#initialize(app_name:, options:, versions:, current_dir:, templates_dir:) ⇒ Base
Returns a new instance of Base.
12 13 14 15 16 |
# File 'lib/brut/cli/apps/new/base.rb', line 12 def initialize(app_name:, options:, versions:, current_dir:, templates_dir:) @project_root = current_dir / app_name @templates_dir = templates_dir / "Base" @erb_binding = ErbBinding.new(options:, app_name:, versions:) end |
Instance Attribute Details
#project_root ⇒ Object (readonly)
Returns the value of attribute project_root.
11 12 13 |
# File 'lib/brut/cli/apps/new/base.rb', line 11 def project_root @project_root end |
Instance Method Details
#create! ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/brut/cli/apps/new/base.rb', line 21 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 |
#output_post_add_messaging(stdout:) ⇒ Object
18 19 |
# File 'lib/brut/cli/apps/new/base.rb', line 18 def output_post_add_messaging(stdout:) end |