Skip to content

Commit

Permalink
Merge pull request #111 from rambler-ios/feature/predefined-templates
Browse files Browse the repository at this point in the history
Feature/predefined templates
  • Loading branch information
etolstoy committed Apr 30, 2016
2 parents a3a6301 + 2ef44ae commit 3e1eb6f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
18 changes: 16 additions & 2 deletions lib/generamba/cli/setup_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ def setup
'Cartfile')
end

should_add_templates = yes?('Do you want to add some well known templates to the Rambafile? (yes/no)')
if should_add_templates
properties[TEMPLATES_KEY] = [
'{name: rviper_controller}',
'{name: mvvm_controller}',
'{name: swifty_viper}'
]
end

properties[PROJECT_TARGET_KEY] = project_target.name
properties[PROJECT_FILE_PATH_KEY] = project_file_path
properties[PROJECT_GROUP_PATH_KEY] = project_group_path
Expand All @@ -88,11 +97,16 @@ def setup

PrintTable.print_values(
values: properties,
title: "Summary for generamba setup"
title: 'Summary for generamba setup'
)

Generamba::RambafileGenerator.create_rambafile(properties)
puts('Rambafile successfully created! Now add some templates to the Rambafile and run `generamba template install`.'.green)
if should_add_templates
puts('Rambafile successfully created! Now run `generamba template install`.'.green)
else
puts('Rambafile successfully created!\n Go on and find some templates in our catalog using `generamba template list` command.\n Add any of them to the Rambafile and run `generamba template install`.'.green)
end

end
end
end
6 changes: 4 additions & 2 deletions lib/generamba/code_generation/Rambafile.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ test_group_path: {{ test_group_path }}{% endif %}

### Templates
templates:
#- {name: local_template_name, local: 'absolute/file/path'}
{% if templates.size > 0 %}{% for item in templates %}- {{ item }}
{% endfor %}{% else %}#- {name: local_template_name, local: 'absolute/file/path'}
#- {name: remote_template_name, git: 'https://github.com/igrekde/remote_template'}
#- {name: catalog_template_name}
#- {name: catalog_template_name}
{% endif %}

0 comments on commit 3e1eb6f

Please sign in to comment.