Class: DevSystem::ShellCommand

Inherits:
Command show all
Defined in:
lib/dev_system/sub/shell/commands/shell_command.rb

Instance Method Summary collapse

Methods inherited from Command

call, get_command_signatures

Methods inherited from Liza::Controller

color, inherited, on_connected

Methods inherited from Liza::Unit

const_missing, division, part, system, #system, test_class

Instance Method Details

#call(args) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/dev_system/sub/shell/commands/shell_command.rb', line 3

def call args
  puts
  puts "Liza         #{ Liza.source_location[0] }"
  puts "App.folder   #{ App.folder }"
  puts "App.root     #{ App.root }/"
  puts "App.path     #{ App.path }/"
  puts

  largest_system_name = AppShell.consts[:systems].keys.map(&:to_s).map(&:size).max

  AppShell.consts[:systems].each do |system_name, tree_system|
    system = tree_system["system"][0]
    length = largest_system_name + 6

    puts "#{ 
      "#{system.to_s}"
        .ljust(length)
        .sub(system.to_s, color(system).to_s)
     } #{ system.source_location[0] }"
  end

  puts
end

#color(klass) ⇒ Object

color helpers



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/dev_system/sub/shell/commands/shell_command.rb', line 29

def color klass
  return klass unless klass < Liza::Unit

  namespace, _sep, classname = klass.to_s.rpartition('::')

  if namespace.empty?
    return stick classname, Liza.const(classname).system.color
  end

  "#{
    stick namespace, Liza.const(namespace).system.color
  }::#{
    stick classname, Liza.const(classname).color
  }"
end