-
Notifications
You must be signed in to change notification settings - Fork 15
Support alias names for bundled templates #49
Conversation
Allows to use `-t swift4` to use the `swift3` template with Swift4 code Or `-t android-java` to use the `android` template and disambiguate with the new `android-kotlin` one
…android.alias Inverse the roles of the original vs the alias for consistency with android.kotlin
+ Code style nitpickings/harmonization
fac9070
to
5125be3
Compare
I have a question about alias for custom path. Do you want to authorize creating custom alias for custom templates or not ? Actually we have two resolution methods for templates. |
lib/gyro/template.rb
Outdated
# | ||
def self.find(template_param, fail_on_error = true) | ||
template = if template_param.include?('/') | ||
find_by_path(template_param, fail_on_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
find_by_path
take one argument and here you give two arguments. There is a mistake or non finish fail_on_error
injection ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. fail_on_error
was passed to find_by_path
in early stage of dev of that feature, but I finally decided to move the handling of failure inside find
directly and forgot to remove the parameter here. I'll fix it 👍
I wondered about that but I don't see how that would work or be useful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested gyro with ruby 2.0 and 2.4. Everything is ok for template generation in different configurations (by name and by path).
This new feature allows us to create alias names for existing templates.
Introducing
android-java
andswift4
template namesThis feature allowed us to:
android
toandroid-java
, for better consistency with the newandroid-kotlin
templateandroid
, so that using-t android
will still work (and not break the setup for existing users of gyro) and use the same template as if we used-t android-java
explicitlyswift4
pointing to the templateswift3
, since theswift3
template is also compatible with Swift 4 so using the alias allows for a more logical name in the invocation ofgyro
.This PR also closes #29