Class: Idcf::Cli::Controller::Base
- Extended by:
- Extend::Init
- Includes:
- Include::Init, Lib::Include::RecurringCalling
- Defined in:
- lib/idcf/cli/controller/base.rb
Overview
Controller Base
Class Attribute Summary collapse
-
.links ⇒ Object
Returns the value of attribute links.
Instance Attribute Summary collapse
-
#cmd ⇒ Object
readonly
Returns the value of attribute cmd.
-
#code_conf ⇒ Object
readonly
Returns the value of attribute code_conf.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#m_classes ⇒ Object
readonly
Returns the value of attribute m_classes.
Class Method Summary collapse
- .init(argv) ⇒ Object
- .register_schema_method(o) ⇒ Object
-
.service_name ⇒ Object
service name.
-
.service_version(o) ⇒ Object
service version.
Methods included from Extend::Command
#register_method_option!, #register_module_method!, #register_schema_method_by_link!
Methods included from Extend::SearchModule
#add_classify_rule, #make_model_name, #make_module_classes, #make_service_paths, #search_module_class
Methods included from Extend::Override
Methods inherited from Thor
command_help_string, command_regist, description, error_exit, exit_on_failure?, module_path, sub_command_regist, subcommand_structure
Class Attribute Details
.links ⇒ Object
Returns the value of attribute links.
49 50 51 |
# File 'lib/idcf/cli/controller/base.rb', line 49 def links @links end |
Instance Attribute Details
#cmd ⇒ Object (readonly)
Returns the value of attribute cmd.
42 43 44 |
# File 'lib/idcf/cli/controller/base.rb', line 42 def cmd @cmd end |
#code_conf ⇒ Object (readonly)
Returns the value of attribute code_conf.
42 43 44 |
# File 'lib/idcf/cli/controller/base.rb', line 42 def code_conf @code_conf end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
42 43 44 |
# File 'lib/idcf/cli/controller/base.rb', line 42 def config @config end |
#m_classes ⇒ Object (readonly)
Returns the value of attribute m_classes.
42 43 44 |
# File 'lib/idcf/cli/controller/base.rb', line 42 def m_classes @m_classes end |
Class Method Details
.init(argv) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/idcf/cli/controller/base.rb', line 51 def init(argv) o = Thor::Options.new().parse(argv) register_schema_method(o) make_module_classes.each do |cn, c| register_module_method!(cn, c) end end |
.register_schema_method(o) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/idcf/cli/controller/base.rb', line 60 def register_schema_method(o) path = make_schema_path(o) return nil unless File.exist?(path) analyst = Idcf::JsonHyperSchema::Analyst.new @links = analyst.load(path).links @links.each do |link| register_schema_method_by_link!(link) end end |
.service_name ⇒ Object
service name
75 76 77 |
# File 'lib/idcf/cli/controller/base.rb', line 75 def service_name name.underscore.split('/').last end |
.service_version(o) ⇒ Object
service version
83 84 85 86 87 88 89 90 |
# File 'lib/idcf/cli/controller/base.rb', line 83 def service_version(o) sn = service_name list = Idcf::Cli::Lib::Configure.get_code_conf(sn, o) result = o[:version].nil? ? list.keys.last : o[:version] msg = "not found input version[#{o[:version]}]" raise Idcf::Cli::Error::CliError, msg unless list.keys.include?(result) result end |