Skip to content
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
7 changes: 5 additions & 2 deletions lib/generamba/code_generation/code_module.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module Generamba

SLASH_REGEX = /^\/|\/$/

C99IDENTIFIER = /[^\w]/

# Represents currently generating code module
class CodeModule
attr_reader :name,
Expand All @@ -11,6 +12,7 @@ class CodeModule
:year,
:prefix,
:project_name,
:product_module_name,
:xcodeproj_path,
:module_file_path,
:module_group_path,
Expand Down Expand Up @@ -38,6 +40,7 @@ def initialize(name, description, rambafile, options)

@prefix = rambafile[PROJECT_PREFIX_KEY]
@project_name = rambafile[PROJECT_NAME_KEY]
@product_module_name = rambafile[PRODUCT_MODULE_NAME_KEY] || @project_name.gsub(C99IDENTIFIER, '_')
@xcodeproj_path = rambafile[XCODEPROJ_PATH_KEY]

@module_file_path = rambafile[PROJECT_FILE_PATH_KEY].gsub(SLASH_REGEX, '')
Expand Down Expand Up @@ -108,4 +111,4 @@ def initialize(name, description, rambafile, options)
end

end
end
end
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 @@ -24,6 +24,7 @@ def self.create_file(file, code_module, template)
'name' => code_module.name,
'description' => code_module.description,
'project_name' => code_module.project_name,
'product_module_name' => code_module.product_module_name,
'project_targets' => code_module.project_targets,
'test_targets' => code_module.test_targets
}
Expand Down Expand Up @@ -60,4 +61,4 @@ def self.file_name_template(file)
return Liquid::Template.parse(template_text)
end
end
end
end
4 changes: 3 additions & 1 deletion lib/generamba/constants/rambafile_constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ module Generamba
PROJECT_FILE_PATH_KEY = 'project_file_path'
PROJECT_GROUP_PATH_KEY = 'project_group_path'

PRODUCT_MODULE_NAME_KEY = 'product_module_name'

TEST_TARGET_KEY = 'test_target'
TEST_TARGETS_KEY = 'test_targets'
TEST_FILE_PATH_KEY = 'test_file_path'
Expand All @@ -26,4 +28,4 @@ module Generamba
TEMPLATE_DECLARATION_LOCAL_KEY = 'local'
TEMPLATE_DECLARATION_GIT_KEY = 'git'
TEMPLATE_DECLARATION_BRANCH_KEY = 'branch'
end
end