Class: Idcf::Cli::Index

Inherits:
Thor
  • Object
show all
Includes:
Extend::Init
Defined in:
lib/idcf/cli/index.rb

Overview

Index

Constant Summary collapse

COMMAND_MAPS =

command alias [alias] => [command]

{}.freeze

Constants included from Extend::UpdateFile

Extend::UpdateFile::BROKEN_UPDATE_FILE

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Thor

command_help_string, command_regist, description, error_exit, exit_on_failure?, module_path, sub_command_regist, subcommand_structure

Constructor Details

#initialize(*args) ⇒ Index

Returns a new instance of Index.



37
38
39
40
# File 'lib/idcf/cli/index.rb', line 37

def initialize(*args)
  @variables = {}
  super(*args)
end

Class Method Details

.init(arg) ⇒ Object

init

Parameters:

  • arg (Hash)

    options



29
30
31
32
33
34
# File 'lib/idcf/cli/index.rb', line 29

def init(arg)
  map COMMAND_MAPS
  sub_command_regist('controller', File.dirname(__FILE__), arg)
rescue => e
  error_exit(Idcf::Cli::Error::CliError.new(e.message))
end

Instance Method Details

#configureObject



65
66
67
68
69
70
# File 'lib/idcf/cli/index.rb', line 65

def configure
  init_f = ARGV[0] == 'init'
  do_configure(options, init_f)
rescue => e
  self.class.error_exit(e)
end

#initObject



46
47
48
49
50
51
# File 'lib/idcf/cli/index.rb', line 46

def init
  configure
  update
rescue => e
  self.class.error_exit(e)
end

#updateObject



55
56
57
58
59
# File 'lib/idcf/cli/index.rb', line 55

def update
  do_update(options)
rescue => e
  self.class.error_exit(e)
end

#versionObject



74
75
76
77
78
# File 'lib/idcf/cli/index.rb', line 74

def version
  puts Idcf::Cli::Conf::Const::VERSION_STR
rescue => e
  self.class.error_exit(e)
end