idcfcloud 0.2.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +12 -0
  3. data/.rubocop.yml +12 -2
  4. data/README.md +15 -4
  5. data/idcfcloud.gemspec +7 -8
  6. data/lib/idcf/cli/command/morio.rb +4 -4
  7. data/lib/idcf/cli/conf/const.rb +32 -29
  8. data/lib/idcf/cli/controller/base.rb +50 -23
  9. data/lib/idcf/cli/controller/cdn.rb +3 -0
  10. data/lib/idcf/cli/controller/compute.rb +15 -1
  11. data/lib/idcf/cli/controller/extend/command.rb +25 -2
  12. data/lib/idcf/cli/controller/extend/search_module.rb +0 -10
  13. data/lib/idcf/cli/controller/extend/util.rb +12 -0
  14. data/lib/idcf/cli/controller/include/client.rb +1 -1
  15. data/lib/idcf/cli/controller/include/command.rb +1 -1
  16. data/lib/idcf/cli/controller/include/util.rb +3 -5
  17. data/lib/idcf/cli/controller/include/validate.rb +1 -1
  18. data/lib/idcf/cli/extend/configure.rb +2 -4
  19. data/lib/idcf/cli/extend/update.rb +20 -20
  20. data/lib/idcf/cli/extend/update_file.rb +3 -3
  21. data/lib/idcf/cli/gem_ext/idcf/json_hyper_schema/expands/link_info_base_extension.rb +25 -9
  22. data/lib/idcf/cli/gem_ext/thor/init_util.rb +6 -3
  23. data/lib/idcf/cli/index.rb +17 -5
  24. data/lib/idcf/cli/lib/api.rb +5 -4
  25. data/lib/idcf/cli/lib/configure.rb +2 -2
  26. data/lib/idcf/cli/lib/convert/filter/field_filter.rb +9 -12
  27. data/lib/idcf/cli/lib/convert/filter/json_path_filter.rb +1 -1
  28. data/lib/idcf/cli/lib/convert/formatter/base.rb +1 -2
  29. data/lib/idcf/cli/lib/convert/formatter/csv_format.rb +15 -32
  30. data/lib/idcf/cli/lib/convert/formatter/json_format.rb +1 -1
  31. data/lib/idcf/cli/lib/convert/formatter/table_format.rb +2 -2
  32. data/lib/idcf/cli/lib/convert/formatter/xml_format.rb +1 -1
  33. data/lib/idcf/cli/lib/convert/helper.rb +16 -5
  34. data/lib/idcf/cli/lib/document.rb +42 -0
  35. data/lib/idcf/cli/lib/util/cli_file.rb +1 -1
  36. data/lib/idcf/cli/lib/util/cli_logger.rb +3 -3
  37. data/lib/idcf/cli/lib/util/ini_conf.rb +2 -2
  38. data/lib/idcf/cli/lib/util/input.rb +40 -5
  39. data/lib/idcf/cli/lib/util/yml_conf.rb +1 -1
  40. data/lib/idcf/cli/service/base.rb +6 -6
  41. data/lib/idcf/cli/service/ilb/base_server_for_protocol.rb +22 -18
  42. data/lib/idcf/cli/validate/custom/month_check_validator.rb +1 -1
  43. data/lib/idcf/cli/validate/custom/require_relation_validator.rb +2 -2
  44. data/lib/idcf/cli/validate/define/base.rb +3 -2
  45. data/lib/idcf/cli/version.rb +1 -1
  46. metadata +45 -44
@@ -37,7 +37,7 @@ module Idcf
37
37
  def output_default_schema(service, version, regions)
38
38
  return nil if regions.keys.include?('default')
39
39
  latist = latest_schema(regions.values)
40
- path = make_schema_file_path(service, version, 'default')
40
+ path = make_schema_file_path(service, version, 'default')
41
41
  output_complement_file(JSON.pretty_generate(latist), path)
42
42
  end
43
43
 
@@ -47,11 +47,11 @@ module Idcf
47
47
  # @return Hash or nil
48
48
  def latest_schema(schemas)
49
49
  result = nil
50
- v_str = '$version'
50
+ v_str = '$version'
51
51
  schemas.each do |data|
52
52
  result ||= data
53
- v1 = Gem::Version.create(data[v_str])
54
- v2 = Gem::Version.create(result[v_str])
53
+ v1 = Gem::Version.create(data[v_str])
54
+ v2 = Gem::Version.create(result[v_str])
55
55
  next unless v1 > v2
56
56
  result = data
57
57
  end
@@ -62,9 +62,9 @@ module Idcf
62
62
  view = Idcf::Cli::Lib::Util::Template.new
63
63
  view.set('variables', make_script_variables)
64
64
  paths = {}
65
- Idcf::Cli::Conf::Const::COMP_PATHS.each do |k, _v|
66
- str = view.fetch("#{k}/#{COMP_N}.erb")
67
- path = "#{Idcf::Cli::Conf::Const::OUT_DIR}/#{COMP_N}.#{k}"
65
+ Idcf::Cli::Conf::Const::COMP_PATHS.each_key do |k|
66
+ str = view.fetch("#{k}/#{COMP_N}.erb")
67
+ path = "#{Idcf::Cli::Conf::Const::OUT_DIR}/#{COMP_N}.#{k}"
68
68
  paths[k] = File.expand_path(path)
69
69
  output_complement_file(str, paths[k])
70
70
  end
@@ -82,7 +82,7 @@ module Idcf
82
82
  end
83
83
 
84
84
  def startup_script_qa(paths, script)
85
- list = %w(y N)
85
+ list = %w[y N]
86
86
  puts "Do you want to edit the startup script?(#{list.join('/')})"
87
87
  puts "[#{startup_script_path(script)}]"
88
88
  ans = Idcf::Cli::Lib::Util::Input.qa_answer_input(list)
@@ -106,7 +106,7 @@ module Idcf
106
106
  # @param paths [Hash]
107
107
  def output_startup_script(script, paths)
108
108
  s_script_path = startup_script_path(script)
109
- write_str = "source #{paths[script]}"
109
+ write_str = "source #{paths[script]}"
110
110
 
111
111
  if write_path?(s_script_path, write_str)
112
112
  File.open(s_script_path, 'a') do |f|
@@ -169,20 +169,20 @@ module Idcf
169
169
  # @param names [Array]
170
170
  # @return Hash
171
171
  def make_flat_variables(list, names = [])
172
- {}.tap do |result|
173
- name = names.empty? ? 'top' : names.join('_')
174
- result[name] = list.keys
175
- list.each do |k, v|
176
- next unless v.class == Hash
177
- names << k
178
- result.merge!(make_flat_variables(v, names))
179
- names.pop
180
- end
172
+ result = {}
173
+ name = names.empty? ? 'top' : names.join('_')
174
+ result[name] = list.keys
175
+ list.each do |k, v|
176
+ next unless v.class == Hash
177
+ names << k
178
+ result.merge!(make_flat_variables(v, names))
179
+ names.pop
181
180
  end
181
+ result
182
182
  end
183
183
 
184
184
  def extract_commands(thor_class, commands)
185
- thor_class.commands.keys.each do |k_c|
185
+ thor_class.commands.each_key do |k_c|
186
186
  commands << k_c if commands.index(k_c).nil?
187
187
  end
188
188
 
@@ -192,7 +192,7 @@ module Idcf
192
192
  def extract_command_infos(t_class, s_name, infos)
193
193
  commands = []
194
194
  return extract_commands(t_class, commands) if infos[s_name].nil?
195
- infos[s_name].keys.each do |name|
195
+ infos[s_name].each_key do |name|
196
196
  commands << name.to_s
197
197
  end
198
198
  extract_commands(t_class, commands)
@@ -36,7 +36,7 @@ module Idcf
36
36
  def download_schema_file(path)
37
37
  d = file_load(path)
38
38
  JSON.parse(d)
39
- rescue
39
+ rescue StandardError => _e
40
40
  Idcf::Cli::Lib::Util::CliLogger.info("json format error:#{path}")
41
41
  raise Idcf::Cli::Error::CliError, BROKEN_UPDATE_FILE
42
42
  end
@@ -49,7 +49,7 @@ module Idcf
49
49
  def check_json_schema(j)
50
50
  analyst = Idcf::JsonHyperSchema::Analyst.new
51
51
  analyst.schema_links(j)
52
- rescue => e
52
+ rescue StandardError => e
53
53
  Idcf::Cli::Lib::Util::CliLogger.info('json-schema format error')
54
54
  log_msg = "#{BROKEN_UPDATE_FILE}:#{e.message}"
55
55
  Idcf::Cli::Lib::Util::CliLogger.error(log_msg)
@@ -58,7 +58,7 @@ module Idcf
58
58
 
59
59
  def file_load(path)
60
60
  open(path).read
61
- rescue
61
+ rescue StandardError => _e
62
62
  nil
63
63
  end
64
64
 
@@ -45,6 +45,22 @@ module Idcf
45
45
  make_params(args[url_param_names.size])
46
46
  end
47
47
 
48
+ def parent_titles(schema = nil)
49
+ result = []
50
+ if schema.present?
51
+ parent_schema = schema.parent
52
+ if parent_schema.present?
53
+ result << parent_schema.title if parent_schema.title.present?
54
+ result.concat(parent_titles(parent_schema))
55
+ end
56
+ else
57
+ result << title
58
+ result.concat(parent_titles(@data))
59
+ result.reverse!
60
+ end
61
+ result
62
+ end
63
+
48
64
  protected
49
65
 
50
66
  def make_result_api_params(target, args, api_result, resource_id)
@@ -79,7 +95,7 @@ module Idcf
79
95
  def result_api_str(target, args, api_result, resource_id)
80
96
  return resource_id if target == '#{resource_id}'
81
97
  result_api_str_regexp(target, args, api_result)
82
- rescue => e
98
+ rescue Standarderror => e
83
99
  raise Idcf::Cli::Error::CliError, e.message
84
100
  end
85
101
 
@@ -109,16 +125,16 @@ module Idcf
109
125
  end
110
126
 
111
127
  def make_query_params(param)
112
- {}.tap do |result|
113
- next unless param.class == Hash
114
- query_param_names.each do |k|
115
- result[k] = param[k] if param.key?(k)
116
- reg = Regexp.new("#{k}[\\.\\[].+")
117
- param.keys.each do |pk|
118
- result[pk] = param[pk] if (reg =~ pk).present?
119
- end
128
+ result = {}
129
+ return result unless param.class == Hash
130
+ query_param_names.each do |k|
131
+ result[k] = param[k] if param.key?(k)
132
+ reg = Regexp.new("#{k}[\\.\\[].+")
133
+ param.each_key do |pk|
134
+ result[pk] = param[pk] if (reg =~ pk).present?
120
135
  end
121
136
  end
137
+ result
122
138
  end
123
139
  end
124
140
  end
@@ -33,7 +33,8 @@ class Thor
33
33
  file_name = File.basename(f, '.*')
34
34
  next if file_name == 'base'
35
35
 
36
- command_regist file_name, "#{b_path}/#{under_path}/#{file_name}", arg
36
+ require_path = "#{b_path}/#{under_path}/#{file_name}"
37
+ command_regist(file_name, require_path, arg)
37
38
  end
38
39
  end
39
40
 
@@ -46,7 +47,8 @@ class Thor
46
47
  require require_path
47
48
 
48
49
  class_const = require_path.classify.constantize
49
- class_const.init(arg)
50
+ class_const.init(arg) if arg.include?(command) || map.values.include?(command.to_sym)
51
+
50
52
  register class_const,
51
53
  command,
52
54
  "#{command_help_string(command)} [OPTION]",
@@ -72,7 +74,7 @@ class Thor
72
74
 
73
75
  def subcommand_structure
74
76
  {}.tap do |result|
75
- commands.each do |k, _v|
77
+ commands.each_key do |k|
76
78
  result[k.to_s] = nil
77
79
  end
78
80
  result = subcommand_class_structure(result)
@@ -95,6 +97,7 @@ class Thor
95
97
 
96
98
  def subcommand_class_structure(result)
97
99
  subcommand_classes.each do |k, v|
100
+ v.init({})
98
101
  commands = v.subcommand_structure
99
102
  result[k.to_s] = nil
100
103
  result[k.to_s] = commands unless commands.empty?
@@ -28,12 +28,24 @@ module Idcf
28
28
  # @param arg [Hash] options
29
29
  def init(arg)
30
30
  map COMMAND_MAPS
31
+ add_classify_rule
31
32
  sub_command_regist('controller', File.dirname(__FILE__), arg)
32
33
  rescue Idcf::Cli::Error::CliError => e
33
34
  error_exit(e)
34
- rescue => e
35
+ rescue StandardError => e
35
36
  error_exit(Idcf::Cli::Error::CliError.new(e.message))
36
37
  end
38
+
39
+ protected
40
+
41
+ # add classify rule
42
+ def add_classify_rule
43
+ Idcf::Cli::Conf::Const::CLASSIFY_RULE.each do |rule|
44
+ ActiveSupport::Inflector.inflections do |inflect|
45
+ inflect.irregular(*rule)
46
+ end
47
+ end
48
+ end
37
49
  end
38
50
 
39
51
  def initialize(*args)
@@ -48,7 +60,7 @@ module Idcf
48
60
  def init
49
61
  configure
50
62
  update
51
- rescue => e
63
+ rescue StandardError => e
52
64
  self.class.error_exit(e)
53
65
  end
54
66
 
@@ -56,7 +68,7 @@ module Idcf
56
68
 
57
69
  def update
58
70
  do_update(options)
59
- rescue => e
71
+ rescue StandardError => e
60
72
  self.class.error_exit(e)
61
73
  end
62
74
 
@@ -67,7 +79,7 @@ module Idcf
67
79
  def configure
68
80
  init_f = ARGV[0] == 'init'
69
81
  do_configure(options, init_f)
70
- rescue => e
82
+ rescue StandardError => e
71
83
  self.class.error_exit(e)
72
84
  end
73
85
 
@@ -75,7 +87,7 @@ module Idcf
75
87
 
76
88
  def version
77
89
  puts Idcf::Cli::Conf::Const::VERSION_STR
78
- rescue => e
90
+ rescue StandardError => e
79
91
  self.class.error_exit(e)
80
92
  end
81
93
  end
@@ -1,4 +1,5 @@
1
1
  require 'idcf/cli/lib/util/cli_logger'
2
+ require 'idcf/cli/lib/document'
2
3
  module Idcf
3
4
  module Cli
4
5
  module Lib
@@ -113,16 +114,16 @@ module Idcf
113
114
  min = link.url_param_names.size + offset
114
115
  max = between_max(min, link)
115
116
 
116
- msg = format('Argument: %s', self.class.command_param_str(link))
117
+ msg = format('Argument: %<arg>s', arg: self.class.command_param_str(link))
118
+ msg = "#{msg}\n#{Idcf::Cli::Lib::Document.make_document_desc(link)}"
117
119
  cli_error msg unless args.size.between?(min, max)
118
120
  end
119
121
 
120
122
  def between_max(min, link)
121
123
  offset = 0
122
124
  required_f = self.class.param_required?(link)
123
- if !required_f && (link.properties.present? || link.query_param_names.present?)
124
- offset = 1
125
- end
125
+ offset = 1 if !required_f && (link.properties.present? || link.query_param_names.present?)
126
+
126
127
  min + offset
127
128
  end
128
129
 
@@ -40,7 +40,7 @@ module Idcf
40
40
  profile = get_profile(o)
41
41
 
42
42
  return get_user_conf(path, profile)
43
- rescue
43
+ rescue StandardError => _e
44
44
  return code_config.find(path) if code_config
45
45
  f_path = Idcf::Cli::Conf::Const::CODE_CONF_PATH
46
46
  @code_config = Idcf::Cli::Lib::Util::YmlConf.new(f_path)
@@ -65,7 +65,7 @@ module Idcf
65
65
  region = ''
66
66
  region = get_user_conf('region', get_profile(o)) if read_conf
67
67
  region.empty? ? 'default' : region
68
- rescue
68
+ rescue StandardError => _e
69
69
  'default'
70
70
  end
71
71
 
@@ -6,7 +6,7 @@ module Idcf
6
6
  module Filter
7
7
  # filter fields
8
8
  class FieldFilter < Base
9
- MSG_NO_TARGETS = '[fields][%s] is not found.'.freeze
9
+ MSG_NO_TARGETS = '[fields][%<field>s] is not found.'.freeze
10
10
 
11
11
  # filter
12
12
  #
@@ -41,18 +41,15 @@ module Idcf
41
41
 
42
42
  def extraction(data, condition)
43
43
  check_extraction(data, condition)
44
- {}.tap do |result|
45
- condition.split(',').each do |key|
46
- next if key.empty?
44
+ result = {}
45
+ condition.split(',').each do |key|
46
+ next if key.blank?
47
47
 
48
- val = data[key]
49
- if @options[:table_flag]
50
- result[key] = [Array, Hash].include?(val.class) ? val.to_s : val
51
- next
52
- end
53
- result[key] = val
54
- end
48
+ val = data[key]
49
+ flg = @options[:table_flag] && [Array, Hash].include?(val.class)
50
+ result[key] = flg ? val.to_s : val
55
51
  end
52
+ result
56
53
  end
57
54
 
58
55
  def check_extraction(data, condition)
@@ -63,7 +60,7 @@ module Idcf
63
60
  end
64
61
 
65
62
  return nil if no_targets.empty?
66
- cli_error(MSG_NO_TARGETS % no_targets.join(','))
63
+ cli_error(format(MSG_NO_TARGETS, field: no_targets.join(',')))
67
64
  end
68
65
  end
69
66
  end
@@ -19,7 +19,7 @@ module Idcf
19
19
  end
20
20
  path = JsonPath.new(condition)
21
21
  path.on(data.to_json)
22
- rescue => e
22
+ rescue StandardError => e
23
23
  cli_error("[json-path]#{e.message}")
24
24
  end
25
25
  end
@@ -8,9 +8,8 @@ module Idcf
8
8
  # format
9
9
  #
10
10
  # @param _data [Hash]
11
- # @param _err_f [Boolean]
12
11
  # @return String
13
- def format(_data, _err_f)
12
+ def format(_data)
14
13
  raise Idcf::Cli::Error::CliError, 'override'
15
14
  end
16
15
  end
@@ -8,9 +8,9 @@ module Idcf
8
8
  module Formatter
9
9
  # csv formatter
10
10
  class CsvFormat < Base
11
- def format(data, err_f)
12
- result = CSV.generate do |csv|
13
- scrape_line(data, err_f).each do |v|
11
+ def format(data)
12
+ result = CSV.generate(force_quotes: true) do |csv|
13
+ scrape_line(data).each do |v|
14
14
  csv << v
15
15
  end
16
16
  end
@@ -20,11 +20,11 @@ module Idcf
20
20
 
21
21
  protected
22
22
 
23
- def scrape_line(data, err_f)
24
- list = scrape(data, err_f)
23
+ def scrape_line(data)
24
+ list = scrape(data)
25
25
  return [] if list.size.zero?
26
26
 
27
- result = []
27
+ result = []
28
28
  headers = make_header(list.first)
29
29
  result << headers
30
30
  push_list(list, headers, result)
@@ -33,7 +33,7 @@ module Idcf
33
33
  def make_header(first_list)
34
34
  result = []
35
35
  if first_list.class == Hash
36
- first_list.each do |k, _v|
36
+ first_list.each_key do |k|
37
37
  result << k
38
38
  end
39
39
  else
@@ -56,10 +56,8 @@ module Idcf
56
56
 
57
57
  # scrape
58
58
  # @param data [Hash]
59
- # @param err_f [Boolean]
60
59
  # @return Array in Hash
61
- def scrape(data, err_f)
62
- return [flat_hash(data)] if err_f
60
+ def scrape(data)
63
61
  return [flat_hash(data)] if data.class == Hash
64
62
  return [[data]] unless data.class == Array
65
63
 
@@ -83,29 +81,14 @@ module Idcf
83
81
  end
84
82
 
85
83
  def flat_hash(data)
86
- {}.tap do |result|
87
- return {} unless data.class == Hash
88
- data.each do |k, v|
89
- value = v
90
- arr_f = v.class == Array || v.class == Hash
91
- next if k != :message && arr_f
92
- value = flat(value) if arr_f
93
- result[k.to_sym] = value
94
- end
84
+ result = {}
85
+ return result unless data.class == Hash
86
+ data.each do |k, v|
87
+ value = v
88
+ value = JSON.generate(value) if v.class == Array || v.class == Hash
89
+ result[k.to_sym] = value
95
90
  end
96
- end
97
-
98
- def flat(list)
99
- result = []
100
- list.each do |k, v|
101
- if list.class == Hash
102
- result << "#{k}:#{v.join('/')}"
103
- next
104
- end
105
- result << (v.nil? ? k : v)
106
- end
107
-
108
- result.join("\n")
91
+ result
109
92
  end
110
93
  end
111
94
  end
@@ -8,7 +8,7 @@ module Idcf
8
8
  module Formatter
9
9
  # json formatter
10
10
  class JsonFormat < Base
11
- def format(data, _err_f)
11
+ def format(data)
12
12
  JSON.pretty_generate(data)
13
13
  end
14
14
  end
@@ -7,9 +7,9 @@ module Idcf
7
7
  module Formatter
8
8
  # table formatter
9
9
  class TableFormat < CsvFormat
10
- def format(data, err_f)
10
+ def format(data)
11
11
  require 'kosi'
12
- Kosi::Table.new.render(scrape_line(data, err_f))
12
+ Kosi::Table.new.render(scrape_line(data))
13
13
  end
14
14
  end
15
15
  end
@@ -10,7 +10,7 @@ module Idcf
10
10
  module Formatter
11
11
  # xml formatter
12
12
  class XmlFormat < Base
13
- def format(data, _err_f)
13
+ def format(data)
14
14
  data.to_xml(dasherize: false)
15
15
  end
16
16
  end
@@ -9,16 +9,15 @@ module Idcf
9
9
  module Convert
10
10
  # format helper
11
11
  class Helper
12
- FILTER_OPTION = [:json_path, :fields].freeze
12
+ FILTER_OPTION = %i[json_path fields].freeze
13
13
 
14
14
  # data convert
15
15
  #
16
16
  # @param data [Hash]
17
- # @param err_f [Boolean]
18
17
  # @param f [String] format
19
18
  # @return String
20
- def format(data, err_f, f)
21
- cls_load("Formatter::#{f.classify}Format").new.format(data, err_f)
19
+ def format(data, f)
20
+ cls_load("Formatter::#{f.classify}Format").new.format(data)
22
21
  end
23
22
 
24
23
  # is filter target
@@ -31,6 +30,19 @@ module Idcf
31
30
  false
32
31
  end
33
32
 
33
+ # only filter
34
+ #
35
+ # @param o [Hash]
36
+ # @return Boolean
37
+ def only_filter_fields?(o)
38
+ return false if o[:fields].nil?
39
+ list = []
40
+ FILTER_OPTION.each do |k|
41
+ list << k if o[k].present?
42
+ end
43
+ list.count == 1
44
+ end
45
+
34
46
  # data convert
35
47
  #
36
48
  # @param data [Hash]
@@ -38,7 +50,6 @@ module Idcf
38
50
  # @param table_flag [Boolean]
39
51
  # @return Hash
40
52
  def filter(data, o, table_flag)
41
- return data unless [Hash, Array].include?(data.class)
42
53
  result = data.deep_dup
43
54
  FILTER_OPTION.each do |k|
44
55
  next if o[k].nil? || o[k].empty?
@@ -0,0 +1,42 @@
1
+ require 'idcf/cli/conf/const'
2
+
3
+ module Idcf
4
+ module Cli
5
+ module Lib
6
+ # document
7
+ class Document
8
+ class << self
9
+ attr_reader :region, :version
10
+
11
+ def init(region: '', version: '')
12
+ @region = region
13
+ @version = version
14
+ end
15
+
16
+ def make_document_desc(link)
17
+ "reference : #{make_document_url(link)}"
18
+ end
19
+
20
+ def make_document_url(link)
21
+ result = URI(Idcf::Cli::Conf::Const::DOCUMENT_URL)
22
+ add_params = {
23
+ 'id' => make_document_id(link)
24
+ }.to_param
25
+ result.query = result.query ? "#{result.query}&#{add_params}" : add_params
26
+ result.to_s
27
+ end
28
+
29
+ def make_document_id(link)
30
+ results = [Idcf::Cli::Conf::Const::DOCUMENT_ID_PREFIX]
31
+ titles = link.parent_titles
32
+ results << titles.shift.downcase
33
+ results << (@region.present? && @region != 'default' ? @region : @version)
34
+ results.concat(titles)
35
+ result = results.join(Idcf::Cli::Conf::Const::DOCUMENT_ID_SEP)
36
+ result.gsub(/ /, Idcf::Cli::Conf::Const::DOCUMENT_SPACE_CONVERSION)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -12,7 +12,7 @@ module Idcf
12
12
  def mkdir(path)
13
13
  target = file?(path) ? File.dirname(path) : path
14
14
  FileUtils.mkdir_p(target, mode: 0o755)
15
- rescue => e
15
+ rescue StandardError => e
16
16
  raise Idcf::Cli::Error::CliError, e.message
17
17
  end
18
18
 
@@ -12,7 +12,7 @@ module Idcf
12
12
  class CliLogger
13
13
  class << self
14
14
  attr_reader :logger, :current_path
15
- LOG_METHODS = %w(debug error fatal info unknown warn).freeze
15
+ LOG_METHODS = %w[debug error fatal info unknown warn].freeze
16
16
 
17
17
  def log_instance
18
18
  return nil unless output_log?
@@ -68,7 +68,7 @@ module Idcf
68
68
  return false unless conf.get_user_conf('output_log').casecmp('y').zero?
69
69
  path = conf.get_user_conf('log_path')
70
70
  path.present?
71
- rescue => _e
71
+ rescue StandardError => _e
72
72
  false
73
73
  end
74
74
 
@@ -77,7 +77,7 @@ module Idcf
77
77
 
78
78
  path = "#{base_path}/#{Idcf::Cli::Conf::Const::LOG_FILE_NAME}"
79
79
  File.expand_path(path)
80
- rescue => _e
80
+ rescue StandardError => _e
81
81
  nil
82
82
  end
83
83
 
@@ -40,10 +40,10 @@ module Idcf
40
40
  def find(name, profile)
41
41
  begin
42
42
  @load_data[profile].fetch(name)
43
- rescue
43
+ rescue StandardError => _e
44
44
  @load_data['default'].fetch(name)
45
45
  end
46
- rescue
46
+ rescue StandardError => _e
47
47
  msg = "Error: could not read #{profile}:#{name}"
48
48
  raise Idcf::Cli::Error::CliError, msg
49
49
  end