Skip to content

Commit

Permalink
Merge branch 'feature/additional-template-parameters' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	lib/generamba/code_generation/code_module.rb
  • Loading branch information
Egor Tolstoy committed Jul 19, 2016
2 parents c9a395a + 37c6aab commit 278fdc9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/generamba/cli/gen_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Application < Thor
method_option :test_file_path, :desc => 'Specifies a location in the filesystem for new test files'
method_option :test_group_path, :desc => 'Specifies a location in Xcode groups for new test files'
method_option :test_path, :desc => 'Specifies a location (both in the filesystem and Xcode) for new test files'
method_option :custom_parameters, :type => :hash, :default => {}, :desc => 'Specifies extra parameters in format `key1:value1 key2:value2` for usage during code generation'
def gen(module_name, template_name)

does_rambafile_exist = Dir[RAMBAFILE_NAME].count > 0
Expand Down
6 changes: 5 additions & 1 deletion lib/generamba/code_generation/code_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class CodeModule
:project_targets,
:test_targets,
:podfile_path,
:cartfile_path
:cartfile_path,
:custom_parameters

def initialize(name, description, rambafile, options)
# Base initialization
Expand Down Expand Up @@ -49,6 +50,9 @@ def initialize(name, description, rambafile, options)
@test_targets = [rambafile[TEST_TARGET_KEY]] if rambafile[TEST_TARGET_KEY] != nil
@test_targets = rambafile[TEST_TARGETS_KEY] if rambafile[TEST_TARGETS_KEY] != nil

# Custom parameters
@custom_parameters = options[:custom_parameters]

# Options adaptation
@author = options[:author] if options[:author]
@project_targets = options[:module_targets].split(',') if options[:module_targets]
Expand Down
3 changes: 2 additions & 1 deletion lib/generamba/code_generation/content_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def self.create_file(file, code_module, template)
'date' => Time.now.strftime('%d/%m/%Y'),
'developer' => developer,
'module_info' => module_info,
'prefix' => code_module.prefix
'prefix' => code_module.prefix,
'custom_parameters' => code_module.custom_parameters
}

module_info['file_basename'] = file_basename
Expand Down

0 comments on commit 278fdc9

Please sign in to comment.