Module: BootstrapLeather::Generators::Utils

Included in:
InstallGenerator
Defined in:
lib/generators/bootstrap_leather/utils.rb

Overview

Utilities for generators

Instance Method Summary collapse

Instance Method Details

#ask_for(wording, default_value = nil, override_if_present_value = nil) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/bootstrap_leather/utils.rb', line 11

def ask_for(wording, default_value = nil, override_if_present_value = nil)
  if override_if_present_value.present?
    display(
      "Using [#{override_if_present_value}] for question '#{wording}'"
    ) && override_if_present_value
  else
    ask(
      "           ?  #{wording} Press <enter> for [#{default_value}] >",
      :yellow
    ).presence || default_value
  end
end

#output(output, color = :green) ⇒ Object



7
8
9
# File 'lib/generators/bootstrap_leather/utils.rb', line 7

def output(output, color = :green)
  say("           -  #{output}", color)
end