From f7c637e0a351283e93cf6891255eace56d3c7e7e Mon Sep 17 00:00:00 2001 From: Egor Tolstoy Date: Mon, 25 Apr 2016 22:50:21 +0300 Subject: [PATCH] Added the ability to specify author name in Rambafile (Issue #107) --- lib/generamba/cli/gen_command.rb | 1 + lib/generamba/code_generation/code_module.rb | 7 ++++++- lib/generamba/constants/rambafile_constants.rb | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/generamba/cli/gen_command.rb b/lib/generamba/cli/gen_command.rb index c5f1bef..ddc2d86 100644 --- a/lib/generamba/cli/gen_command.rb +++ b/lib/generamba/cli/gen_command.rb @@ -12,6 +12,7 @@ class Application < Thor desc 'gen [MODULE_NAME] [TEMPLATE_NAME]', 'Creates a new VIPER module with a given name from a specific template' method_option :description, :aliases => '-d', :desc => 'Provides a full description to the module' + method_option :author, :desc => 'Specifies the author name for generated module' method_option :module_targets, :desc => 'Specifies project targets for adding new module files' method_option :module_file_path, :desc => 'Specifies a location in the filesystem for new files' method_option :module_group_path, :desc => 'Specifies a location in Xcode groups for new files' diff --git a/lib/generamba/code_generation/code_module.rb b/lib/generamba/code_generation/code_module.rb index 322a9f0..afb9d19 100644 --- a/lib/generamba/code_generation/code_module.rb +++ b/lib/generamba/code_generation/code_module.rb @@ -23,7 +23,12 @@ def initialize(name, description, rambafile, options) @name = name @description = description - @author = UserPreferences.obtain_username + if rambafile[AUTHOR_NAME_KEY] != nil + @author = rambafile[AUTHOR_NAME_KEY] + else + @author = UserPreferences.obtain_username + end + @company = rambafile[COMPANY_KEY] @year = Time.now.year.to_s diff --git a/lib/generamba/constants/rambafile_constants.rb b/lib/generamba/constants/rambafile_constants.rb index 7fb6533..e99cd9a 100644 --- a/lib/generamba/constants/rambafile_constants.rb +++ b/lib/generamba/constants/rambafile_constants.rb @@ -2,6 +2,7 @@ module Generamba # Keys of Rambafile files COMPANY_KEY = 'company' + AUTHOR_NAME_KEY = 'author' PROJECT_NAME_KEY = 'project_name' PROJECT_PREFIX_KEY = 'prefix' XCODEPROJ_PATH_KEY = 'xcodeproj_path'