Class: HappySystem::AxoCommand

Inherits:
DevSystem::SimpleCommand show all
Defined in:
lib/happy_system/subsystems/axo/commands/axo_command.rb

Instance Attribute Summary

Attributes inherited from Liza::Controller

#menv

Instance Method Summary collapse

Methods inherited from DevSystem::SimpleCommand

#after, #ask?, #before, #default_args, #default_booleans, #default_strings, #given_args, #given_booleans, #given_strings, #input_args, #input_booleans, #input_strings, #set_arg, #set_boolean, #set_default_arg, #set_default_array, #set_default_boolean, #set_default_string, #set_input_arg, #set_input_array, #set_input_boolean, #set_input_string, #set_string, #simple_arg, #simple_arg_ask, #simple_arg_ask_snakecase, #simple_args, #simple_args_from_2, #simple_array, #simple_boolean, #simple_boolean_yes, #simple_booleans, #simple_color, #simple_controller_placement, #simple_string, #simple_strings

Methods inherited from DevSystem::BaseCommand

#action_method_name, #action_name, #after, #around, #before, #call, call, #env, get_command_signatures, #not_found, typo, #typo

Methods inherited from DevSystem::Command

get_command_signatures

Methods inherited from Liza::Controller

#`, `, attr_accessor, attr_reader, attr_writer, #attrs, box, #box, call, color, division, division!, division?, inherited, menv_accessor, menv_reader, menv_writer, on_connected, panel, #panel, plural, require, requirements, sh, #sh, singular, subsystem, subsystem!, subsystem?, subsystem_token, token

Methods inherited from Liza::Unit

_erbs_for, #add, add, cl, #cl, class_methods_defined, const_added, const_missing, constants_defined, define_error, descendants_select, division, erbs_available, erbs_defined, erbs_for, errors, #fetch, fetch, get, #get, instance_methods_defined, log, #log, log?, #log?, #log_array, log_array, log_hash, #log_hash, #log_level, log_level, #log_level?, log_level?, log_levels, #log_levels, #log_render_convert, #log_render_format, #log_render_in, #log_render_out, method_added, methods_defined, namespace, part, raise_error, #raise_error, reload!, #reload!, #render, #render!, #render_stack, renderable_formats_for, renderable_names, section, sections, #set, set, #settings, settings, singleton_method_added, sleep, #sleep, stick, #stick, sticks, #sticks, subclasses_select, subunits, system, #system, system?, test_class, time_diff, #time_diff

Instance Method Details

#call_defaultObject



5
6
7
8
9
10
11
12
# File 'lib/happy_system/subsystems/axo/commands/axo_command.rb', line 5

def call_default
  find!

  env[:axo] = @axo
  HappyBox[:axo].call(env)

  log "done at #{Time.now}"
end

#find!Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/happy_system/subsystems/axo/commands/axo_command.rb', line 14

def find!
  @name = simple_args[0]

  if @name
    @axo = Liza.const "#{@name}_axo"
    return
  end

  @axo = pick_axo
  @name = @axo.last_namespace.snakecase
ensure
  log :low, "@name = #{@name}"
  log :low, "@axo = #{@axo}"
end

#pick_axoObject



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/happy_system/subsystems/axo/commands/axo_command.rb', line 29

def pick_axo
  Lizarb.eager_load!
  axos = Axo.descendants
  options = axos.sort_by(&:last_namespace).map do |axo|
    [
      "#{axo.last_namespace.snakecase.ljust 30} - #{axo} - #{(axo.get :description) || "No description."}",
      axo
    ]
  end.to_h
  InputShell.pick_one "Pick an Axolotl ASCII Animation to run", options
end