Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/author setting #108

Merged
merged 2 commits into from
Apr 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/generamba/cli/gen_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 7 additions & 1 deletion lib/generamba/code_generation/code_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -44,6 +49,7 @@ def initialize(name, description, rambafile, options)
@test_targets = rambafile[TEST_TARGETS_KEY] if rambafile[TEST_TARGETS_KEY] != nil

# Options adaptation
@author = options[:author] if options[:author]
@project_targets = options[:module_targets].split(',') if options[:module_targets]
@test_targets = options[:test_targets].split(',') if options[:test_targets]

Expand Down
1 change: 1 addition & 0 deletions lib/generamba/constants/rambafile_constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down