Class: Orats::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/orats/cli.rb

Overview

the thor driven command line interface

Instance Method Summary collapse

Constructor Details

#initialize(args, local_options, config) ⇒ CLI

for now none of the code below is in action and the readme explicitly says you can only store the postgres and redis credentials since the args only get inserted into the new and nuke commands



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/orats/cli.rb', line 26

def initialize(args, local_options, config)
  super

  matched_options = []

  config[:current_command].options.each do |key|
    aliases = key[1].aliases
    option = key[0].to_s.gsub('_', '-')

    aliases.each do |item|
      matched_options << item if local_options.join.include?(item)
    end

    matched_options << option if local_options.include?("--#{option}")
  end
end

Instance Method Details

#new(target_path) ⇒ Object



57
58
59
# File 'lib/orats/cli.rb', line 57

def new(target_path)
  Commands::New::Exec.new(target_path, options).init
end

#nuke(target_path) ⇒ Object



72
73
74
# File 'lib/orats/cli.rb', line 72

def nuke(target_path)
  Commands::Nuke.new(target_path, options).init
end

#templatesObject



78
79
80
# File 'lib/orats/cli.rb', line 78

def templates
  Commands::New::Exec.new.available_templates
end

#versionObject



84
85
86
# File 'lib/orats/cli.rb', line 84

def version
  puts "Orats version #{VERSION}"
end