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 wildcard template dependencies. #20904

Merged
merged 1 commit into from Jul 27, 2015

Conversation

Projects
None yet
5 participants
@kaspth
Member

kaspth commented Jul 16, 2015

Fixes #20878.

@kaspth kaspth added the actionview label Jul 16, 2015

@kaspth kaspth self-assigned this Jul 16, 2015

@kaspth kaspth added this to the 5.0.0 milestone Jul 16, 2015

@kaspth

View changes

Show outdated Hide outdated railties/test/application/wildcard_dependencies_test.rb
@kaspth

This comment has been minimized.

Show comment
Hide comment
@kaspth

kaspth Jul 22, 2015

Member

@dhh I got something that's working here too, but I still need to add documentation.

I don't know how necessary it is to add a cache to the wildcard lookup. I'll try doing some benchmarking.

@jeremy @rafaelfranca the implementation I've done feels, eh, not so nice to me. Can you review? 😁

Member

kaspth commented Jul 22, 2015

@dhh I got something that's working here too, but I still need to add documentation.

I don't know how necessary it is to add a cache to the wildcard lookup. I'll try doing some benchmarking.

@jeremy @rafaelfranca the implementation I've done feels, eh, not so nice to me. Can you review? 😁

@dhh

This comment has been minimized.

Show comment
Hide comment
@dhh

dhh Jul 23, 2015

Member

Awesome. I do think we'll need a cache, though. Otherwise every time that
template is eval'ed, you have to touch the filesystem. That won't fly.

On Wed, Jul 22, 2015 at 10:35 PM, Kasper Timm Hansen <
notifications@github.com> wrote:

@dhh https://github.com/dhh I got something that's working here too,
but I still need to add documentation.

I don't know how necessary it is to add a cache to the wildcard lookup.
I'll try doing some benchmarking.

@jeremy https://github.com/jeremy @rafaelfranca
https://github.com/rafaelfranca the implementation I've done feels, eh,
not so nice to me. Can you review? [image: 😁]


Reply to this email directly or view it on GitHub
#20904 (comment).

Member

dhh commented Jul 23, 2015

Awesome. I do think we'll need a cache, though. Otherwise every time that
template is eval'ed, you have to touch the filesystem. That won't fly.

On Wed, Jul 22, 2015 at 10:35 PM, Kasper Timm Hansen <
notifications@github.com> wrote:

@dhh https://github.com/dhh I got something that's working here too,
but I still need to add documentation.

I don't know how necessary it is to add a cache to the wildcard lookup.
I'll try doing some benchmarking.

@jeremy https://github.com/jeremy @rafaelfranca
https://github.com/rafaelfranca the implementation I've done feels, eh,
not so nice to me. Can you review? [image: 😁]


Reply to this email directly or view it on GitHub
#20904 (comment).

@kaspth

This comment has been minimized.

Show comment
Hide comment
@kaspth

kaspth Jul 23, 2015

Member

@dhh I've added a changelog entry, documentation and, most importantly, caching 😁

Member

kaspth commented Jul 23, 2015

@dhh I've added a changelog entry, documentation and, most importantly, caching 😁

@kaspth

This comment has been minimized.

Show comment
Hide comment
@kaspth

kaspth Jul 24, 2015

Member

I'm not sure where we document that custom trackers must support the view_paths argument to be able to use these wildcard dependencies.

Member

kaspth commented Jul 24, 2015

I'm not sure where we document that custom trackers must support the view_paths argument to be able to use these wildcard dependencies.

@kaspth

This comment has been minimized.

Show comment
Hide comment
@kaspth

kaspth Jul 24, 2015

Member

🏃 Travis 🏃

Member

kaspth commented Jul 24, 2015

🏃 Travis 🏃

@kaspth kaspth closed this Jul 24, 2015

@kaspth kaspth reopened this Jul 24, 2015

@kaspth

This comment has been minimized.

Show comment
Hide comment
@kaspth

kaspth Jul 25, 2015

Member

I've looked at how Haml and Slim register themselves and they both use the ERB tracker. Perhaps the trackers should implement supports_view_paths instead of having it as a configured that's used when registering, then it'll just work for Haml and Slim and possibly others.

I've talked myself into doing that. I'll change it now 👍

Member

kaspth commented Jul 25, 2015

I've looked at how Haml and Slim register themselves and they both use the ERB tracker. Perhaps the trackers should implement supports_view_paths instead of having it as a configured that's used when registering, then it'll just work for Haml and Slim and possibly others.

I've talked myself into doing that. I'll change it now 👍

@kaspth kaspth closed this Jul 25, 2015

@kaspth kaspth reopened this Jul 25, 2015

@dhh

This comment has been minimized.

Show comment
Hide comment
@dhh

dhh Jul 26, 2015

Member

Excellent! @rafaelfranca do you have any comments on the view handler implementation?

Member

dhh commented Jul 26, 2015

Excellent! @rafaelfranca do you have any comments on the view handler implementation?

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
@rafaelfranca
Member

rafaelfranca commented Jul 27, 2015

:shipit:

kaspth added a commit that referenced this pull request Jul 27, 2015

@kaspth kaspth merged commit c5583cd into rails:master Jul 27, 2015

@kaspth kaspth deleted the kaspth:wildcard-template-dependencies branch Jul 27, 2015

@kaspth

This comment has been minimized.

Show comment
Hide comment
@kaspth

kaspth Jul 27, 2015

Member

Boom! Thanks everyone 🎉

Member

kaspth commented Jul 27, 2015

Boom! Thanks everyone 🎉

@dhh

This comment has been minimized.

Show comment
Hide comment
@dhh

dhh Jul 27, 2015

Member

Awesome work, Kasper!

On Mon, Jul 27, 2015 at 8:29 PM, Kasper Timm Hansen <
notifications@github.com> wrote:

Boom! Thanks everyone [image: 🎉]


Reply to this email directly or view it on GitHub
#20904 (comment).

Member

dhh commented Jul 27, 2015

Awesome work, Kasper!

On Mon, Jul 27, 2015 at 8:29 PM, Kasper Timm Hansen <
notifications@github.com> wrote:

Boom! Thanks everyone [image: 🎉]


Reply to this email directly or view it on GitHub
#20904 (comment).

@rafaelfranca rafaelfranca modified the milestones: 5.0.0 [temp], 5.0.0 Dec 30, 2015

@dhh

This comment has been minimized.

Show comment
Hide comment
@dhh

dhh Feb 10, 2016

Member

Found an issue with this in deployment. The dependency tree generated by the wildcards is not deterministic. I think the directory scan returns results in an unordered fashion. This means each server generates a unique digest for the same wildcard dependency declaration. Which means that the caching doesn't work. I remember we used to have this problem with Sprockets as well. @kaspth can you investigate?

Member

dhh commented Feb 10, 2016

Found an issue with this in deployment. The dependency tree generated by the wildcards is not deterministic. I think the directory scan returns results in an unordered fashion. This means each server generates a unique digest for the same wildcard dependency declaration. Which means that the caching doesn't work. I remember we used to have this problem with Sprockets as well. @kaspth can you investigate?

@kaspth

This comment has been minimized.

Show comment
Hide comment
@kaspth

kaspth Feb 10, 2016

Member

@dhh yup, will do 👍

Member

kaspth commented Feb 10, 2016

@dhh yup, will do 👍

if tracker.present?
tracker.call(name, template)
if tracker.respond_to?(:supports_view_paths?) && tracker.supports_view_paths?

This comment has been minimized.

@eduardoschneiders

eduardoschneiders Feb 10, 2016

Isn't it better to do something like this here?

if tracker.try(:supports_view_paths?)
@eduardoschneiders

eduardoschneiders Feb 10, 2016

Isn't it better to do something like this here?

if tracker.try(:supports_view_paths?)

This comment has been minimized.

@kaspth

kaspth Feb 10, 2016

Member

We don't use try internally :)

@kaspth

kaspth Feb 10, 2016

Member

We don't use try internally :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment