Skip to content

Commit

Permalink
Merge branch 'feature/task-142' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	lib/generamba/cli/gen_command.rb
  • Loading branch information
Beniamin Sarkisyan committed Sep 3, 2016
2 parents f7346ba + d73cb41 commit c371453
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/generamba/cli/gen_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def gen(module_name, template_name)
module_info = ModuleInfoGenerator.new(code_module)
template = ModuleTemplate.new(template_name, module_info.scope)

parameters = GenCommandTableParametersFormatter.prepare_parameters_for_displaying(rambafile)
parameters = GenCommandTableParametersFormatter.prepare_parameters_for_displaying(code_module, template_name)
PrintTable.print_values(
values: parameters,
title: "Summary for gen #{module_name}"
Expand Down
26 changes: 20 additions & 6 deletions lib/generamba/helpers/gen_command_table_parameters_formatter.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit c371453

Please sign in to comment.