Skip to content

Conversation

@rsyring
Copy link

@rsyring rsyring commented Jul 8, 2013

Can these changes get merged upstream and get them released to pypi?

Thanks.

Jesse Myers and others added 30 commits September 27, 2012 15:39
…prompt.

This feature allows a skeleton to be constructed with a longer list of
variable prompts without necesssarily requiring the user to painfully
input every answer. For example, a template to generate a default python
project could use the same value of its project name and main package name
without typing both -- or could support different values.

There are two main changes here:

 - Var instances get assigned a reference to the calling skeleton ('owner')
   before prompt() is called. This allows the Var to call back into the
   skeleton to query what other values have been set without requiring Var
   instances to know about each other or save state. This reference is
   cleared after prompt() returns.

 - Var.default is now a property so its getter can be overridden nicely
   in the DependentVar subclass.
Validator simply takes over the responsibility formerly in Var.validate(),
which now delegates to a validator instance. Var is instantiated with a
default Validator if none is provided.

RegexValidator takes a pattern as input and validates that the user's
input matches the pattern, raising an error if none.

Example:

    variables = [
        Var('foo',validator=RegexValidator('[a-z]+'))
    ]
 - Formatting now uses a formatter class
 - StringFormatter remains the default
 - JinjaFormatter may be used trivially by setting 'use_jinja'
As described in the pocoo-libs thread "Bug in jinja2.lexer",
https://groups.google.com/forum/?fromgroups=#!topic/pocoo-libs/6DylMqq1voI
Jinja normalizes newlines in a manner that loses a newline at the end
of a file.

Add a check for the trailing newline in a template to be rendered by
JinjaFormatter and add an extra newline to preserve the original in
the output.
Forgot to update tests to reflect my preceding change
By delaying the file open, you can read the existing file
Allow loading from non-cwd destination directory
Set __dst_dir__ in write() instead of cmd()
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.

3 participants