diff --git a/lib/generamba/cli/gen_command.rb b/lib/generamba/cli/gen_command.rb index 882409a..258453f 100644 --- a/lib/generamba/cli/gen_command.rb +++ b/lib/generamba/cli/gen_command.rb @@ -42,15 +42,15 @@ def gen(module_name, template_name) rambafile = YAML.load_file(RAMBAFILE_NAME) - parameters = GenCommandTableParametersFormatter.prepare_parameters_for_displaying(rambafile) + template = ModuleTemplate.new(template_name) + code_module = CodeModule.new(module_name, module_description, rambafile, options) + + parameters = GenCommandTableParametersFormatter.prepare_parameters_for_displaying(code_module, template_name) PrintTable.print_values( values: parameters, title: "Summary for gen #{module_name}" ) - template = ModuleTemplate.new(template_name) - code_module = CodeModule.new(module_name, module_description, rambafile, options) - DependencyChecker.check_all_required_dependencies_has_in_podfile(template.dependencies, code_module.podfile_path) DependencyChecker.check_all_required_dependencies_has_in_cartfile(template.dependencies, code_module.cartfile_path) diff --git a/lib/generamba/helpers/gen_command_table_parameters_formatter.rb b/lib/generamba/helpers/gen_command_table_parameters_formatter.rb index 448ee2e..bed9b50 100644 --- a/lib/generamba/helpers/gen_command_table_parameters_formatter.rb +++ b/lib/generamba/helpers/gen_command_table_parameters_formatter.rb @@ -1,17 +1,31 @@ module Generamba # Provides methods for prepare parameters for displaying in table. class GenCommandTableParametersFormatter + require 'json' + # This method prepared parameter for displaying - def self.prepare_parameters_for_displaying(parameters) - params = parameters.clone + def self.prepare_parameters_for_displaying(code_module, template_name) + params = {} + + params['Targets'] = code_module.project_targets.join(',') + params['Module path'] = code_module.module_file_path + + if code_module.module_file_path != code_module.module_group_path + params['Module group path'] = code_module.module_group_path + end - templates = [] + params['Test targets'] = code_module.test_targets.join(',') if code_module.test_targets + params['Test file path'] = code_module.test_file_path if code_module.test_file_path - params['templates'].each do |param| - templates.push(param['name']) + if code_module.test_file_path != code_module.test_group_path + params['Test group path'] = code_module.test_group_path end - params['templates'] = templates.join("\n") + params['Template'] = template_name + + if code_module.custom_parameters + params['Custom parameters'] = code_module.custom_parameters.to_json + end params end