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

Add the ability to specify arbitrary templates #147

Merged
merged 1 commit into from
Apr 30, 2014

Conversation

gfontenot
Copy link
Member

This adds the ability to define a templates key in your liftoffrc. The
value for this key should be an array of key/value pairs in the format of:

<template name>: <destination relative to project root>

Fixes #146

@gfontenot
Copy link
Member Author

I need to add documentation to this before merging.

module Liftoff
class TemplateGenerator
def generate_templates(config, file_manager)
if config.templates
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about having config.templates default to {}, so we don't need this conditional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Users can override this value in their own config files, so leaving the conditional out is potentially unsafe.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would it be unsafe?

def templates
  @templates || {}
end

would return {} in all cases where this conditional would have returned false, and each_pair on an empty hash is a noop.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see what you mean. I thought you meant default in the config.

I might do this as a part of another PR. Right now, we're using this pattern pretty consistently, and it might be good to try to do this across the board.

This adds the ability to define a `templates` key in your `liftoffrc`.
The value for this key should be an array of key/value pairs in the
format of:

<template name>: <destination relative to project root>

We'll add a real default for this key soon, but I'd just like to make
sure this isn't nil for now.
@gfontenot gfontenot merged commit 6e82ff9 into master Apr 30, 2014
@gfontenot gfontenot deleted the gf-arbitrary-templates branch April 30, 2014 22:31
@gfontenot gfontenot mentioned this pull request Apr 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow arbitrary template files
3 participants