trailblazer / trailblazer-loader

Require concept files, models and more without any autoloading magic.
MIT License
17 stars 23 forks source link

Fixed a concept files loading order sorting issue on Mac OS #5

Closed pnikolov closed 7 years ago

pnikolov commented 8 years ago

Issue is occurring on Mac OS X 10.11.2 when operation files fail to load after callbacks.

The proposed modification sorts the files of a concept correctly so operation files are shifted to the end of the loading order list.

The proposed solution is tested both on Linux and OS X.

apotonick commented 8 years ago

Nice! Did you see the tests that @Hermanverschooten added? I think we could catch that there, too! https://github.com/trailblazer/trailblazer-loader/blob/master/test/trailblazer/loader_test.rb

Thanks!!

pnikolov commented 8 years ago

This is with trailblazer-rails (v0.2.3).

I am trying to figure out a test which will fail on Linux hosts, now I see that the new test I committed fails only on Mac OS...

Hermanverschooten commented 8 years ago

I remember testing with 0 and -1, and that -1 returned the files in the wrong order, because it would force a resort. The sort goes

pnikolov commented 8 years ago

Yes, I saw the previous pull request. But on Mac OS X hosts is seems that the used sorting does not do the job. I can supply you with further debug information. Having this:

a!=operation, b=operation, return 0 leave them as is

Leads to the following loading order - having the callback after the operations:

"app/models/user.rb",
"app/concepts/user/operation/create.rb",
"app/concepts/user/operation/index.rb",
"app/concepts/user/callback.rb",
"app/concepts/user/operation/show.rb",
"app/concepts/user/contract/create.rb",
"app/concepts/user/operation/update.rb",
"app/concepts/user/contract/update.rb",
"app/concepts/user/cell/table.rb",
"app/concepts/user/policy.rb",
"app/concepts/user/scope.rb",
"app/concepts/user/cell/row.rb"

The test test_ordering_mac_osx fails on Mac and passes on Linux/Windows when 0 is returned, and passes on Mac/Linux/Windows when -1 is return in case of a!=operation, b=operation

apotonick commented 8 years ago

Ok, and now? @Hermanverschooten?

apotonick commented 8 years ago

Closing this as I "think" this is fixed with recent changes. :beers:

Thorsson commented 7 years ago

@apotonick I can confirm this issue is still relevant as I am having a problem running it on my macOS but on the ubuntu is running fine.

Thorsson commented 7 years ago

@apotonick What is the status on this one?

havrylyakar commented 7 years ago

@apotonick What is the status on this one?

apotonick commented 7 years ago

I don't know, I don't have a Mac. It's open-source and super simple code, go try and fix it yourself, it's fun!

apotonick commented 7 years ago

Please upgrade to 0.1.1. Thanks @pnikolov ! :beers: