Working on a very simple extension right now.. some specs are all green.. but when I try to install it into a sample spree (1.1.1) store the migrations won't make it.
When I uncomment the isolate_namespace part all is working again..
Have some more doubts about the isolate_namespace part. There are a lot of extra steps to make when using the rails (resource) generators. .everything needs to be namespaced with Spree.. not sure if that's a good idea.
found out some more..
when running rake -T | grep spree in the hosted app you will see the correct rake task. Since the Spree namespace is isolated. the task has a different name :
rake -T | grep spree
rake spree_brands_engine_spree:install:migrations # Copy migrations from spree_brands_engine_spree to application
in this sample the engine is spree_brands
we might need to adjust the install generator? or is this a rails issue..since calling this rake task
rake railties:install:migrations FROM=spree_brands
does not work..
What happens if you swap the engine_name and isolate_namespace calls? The reason I ask is because isolate_namespace calls engine_name again: https://github.com/rails/rails/blob/3-2-stable/railties/lib/rails/engine.rb#L380.
Reverse order of isolate_namespace and engine_name call in extension …
This is a potential fix for #1580
that could be the solution indeed.. let me try it!
Yes I just did and it worked!
I'm still experiencing an issue similar to this. When I try to generate a resource in an extension folder it throws a NameError on the ::Engine::Spree constant. If I comment out the isolate_namespace line the generators work as expected.
I've tried swapping the lines but the error persists as long as the isolate_namespace line is present.
If I require spree/core at the top of the engine file and comment out the engine_name line (as it is called in isolate_namespace) the generators work fine.
I'm not sure if this is correct though.
have diner in a minute.. will dive in after.. also..I will try to write to some specs for this.. perhaps using Aruba or something similar.. this must be testable after all..
Some Aruba tests would be handy for this kind of thing. Let me see what I can come up with today.
Ensure that an extension can have a model generated in it
Adds a regression test for #1580
Ensure that migrations are created within the dummy app
This is a regression test for #1580
I've added an Aruba feature to cmd with @9c60156. That seems to be generating a model within the extension just fine. Then I added another commit with @373b86e that checks that the migration gets copied over to spec/dummy.
Therefore, I think this bug is fixed now. Sorry it took so long!
I'm still struggling with this but it might be an unrelated issue. I've updated my spree dependencies to the 1-1-stable branch to get these commits and now I'm getting this in my newly created extension folders. This is generated by running bundle install or rails generators in the spree_test extension folder.
Could not find gem 'spree_core (~> 1.1.2.beta) ruby', which is required by gem 'spree_test (>= 0) ruby', in any of the sources.
I've figured it out. The 1-1-stable branch has a dependency in the spree_cmd extension generator for spree 1.1.2.beta. Once I change the generated dependency in the gemspec for the extension the bundle installer works as expected.
The generators and dummy app rake tasks work as expected as well.