Whenever the partial resolver couldn't find the file passed by the developer, we would just get the partial resolver template itself:
app/views/bullet_train/partial_resolver.html.erb
Instead of just returning this string, I typed out a message telling the developer to make sure they have the package name in the string to help us resolve it for them, or they could use the --interactive flag and pass the annotated path (in case they weren't aware of it already).
Resolve partials with literal path strings
With that being said, if the developer passes the entire path starting from the package name, we can grab the package with the bundler so I added this feature to the script:
However, if it's something short like shared/attributes/_code.html.erb, then the script changes the string to shared/attributes/code and defaults to the behavior we already had in place for resolving the partial:
I added a TODO here because I set up things to resolve the shorthand string if it's made up of 3 parts or less, i.e.:
shared/attributes/code
OR
shared/box
I'm thinking we should have another way of determining these though. Should we flag them if they start with shared? Any other strings? I'm not sure about this part, but at I least wrote the TODO in case we need to handle it sooner than later.
Closes #114.
Error handling for unresolved partials
Whenever the partial resolver couldn't find the file passed by the developer, we would just get the partial resolver template itself:
Instead of just returning this string, I typed out a message telling the developer to make sure they have the package name in the string to help us resolve it for them, or they could use the
--interactive
flag and pass the annotated path (in case they weren't aware of it already).Resolve partials with literal path strings
With that being said, if the developer passes the entire path starting from the package name, we can grab the package with the bundler so I added this feature to the script:
However, if it's something short like
shared/attributes/_code.html.erb
, then the script changes the string toshared/attributes/code
and defaults to the behavior we already had in place for resolving the partial:Resolving shorthand partials
I added a TODO here because I set up things to resolve the shorthand string if it's made up of 3 parts or less, i.e.:
I'm thinking we should have another way of determining these though. Should we flag them if they start with
shared
? Any other strings? I'm not sure about this part, but at I least wrote the TODO in case we need to handle it sooner than later.