Class: Brut::CLI::Apps::New::Segments::Demo

Inherits:
Base
  • Object
show all
Defined in:
lib/brut/cli/apps/new/segments/demo.rb

Overview

Additional classes and configuration for a new Brut app that provides a more demonstration of the features.

Instance Attribute Summary

Attributes inherited from Base

#project_root

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#create!, #output_post_add_messaging

Constructor Details

#initialize(app_name:, options:, versions:, current_dir:, templates_dir:) ⇒ Demo

Returns a new instance of Demo.



8
9
10
11
12
# File 'lib/brut/cli/apps/new/segments/demo.rb', line 8

def initialize(app_name:, options:, versions:, current_dir:, templates_dir:)
  @project_root  = current_dir / app_name
  @templates_dir = templates_dir / "segments" / "Demo"
  @erb_binding   = ErbBindingDelegate.new(options:, app_name:, versions:)
end

Class Method Details

.friendly_nameObject



5
# File 'lib/brut/cli/apps/new/segments/demo.rb', line 5

def self.friendly_name = "Demo features and files"

.segment_nameObject



6
# File 'lib/brut/cli/apps/new/segments/demo.rb', line 6

def self.segment_name = "demo_features"

Instance Method Details

#<=>(other) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/brut/cli/apps/new/segments/demo.rb', line 14

def <=>(other)
  if self.class == other.class
    0
  else
    1
  end
end

#add!Object



22
23
24
25
26
27
28
29
# File 'lib/brut/cli/apps/new/segments/demo.rb', line 22

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

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