Class: Wlog::TemplateUi

Inherits:
Object
  • Object
show all
Includes:
StaticConfigurations
Defined in:
lib/wlog/ui/template_ui.rb

Overview

Author:

  • Simon Symeonidis

Constant Summary

Constants included from StaticConfigurations

StaticConfigurations::AppDirectory, StaticConfigurations::AppName, StaticConfigurations::ConfigDirectory, StaticConfigurations::ConfigFile, StaticConfigurations::DataDirectory, StaticConfigurations::DefaultDb, StaticConfigurations::TaintFile, StaticConfigurations::TemplateDir, StaticConfigurations::TemplateOutputDir, StaticConfigurations::TemplateSampleFile

Instance Method Summary collapse

Constructor Details

#initializeTemplateUi

Returns a new instance of TemplateUi.



13
14
15
16
17
# File 'lib/wlog/ui/template_ui.rb', line 13

def initialize
  @strmaker = SysConfig.string_decorator
  # Checks for templates dir each run
  BootstrapTemplates.new.execute
end

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/wlog/ui/template_ui.rb', line 19

def run
  cmd = 'default'

  while cmd != 'end'
    cmd = Readline.readline("[#{@strmaker.green('templates')}] ").chomp
    case cmd
    when /^(ls|show)/ then ls
    when /^set/       then set(cmd.split.drop 1)
    when /^help/      then print_help
    when /^end/       then next
    end
  end
end