-
Notifications
You must be signed in to change notification settings - Fork 47
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
Simplify dependency managment in engine installs #227
Comments
This is how bundler does it: rubygems/bundler@a0d97c4 It's possible |
This works, but not sure if it should be part of this gem or if this is something people could add if they don't like manually requiring gems in their engines... Gem.loaded_specs["admin"].runtime_dependencies.each do |dep|
begin
require dep.name
rescue LoadError
require dep.name.gsub("-", "/")
end
end Perhaps with a comment that explains what it does and what it can be replaced with? |
Hmm I don't think we should add it by default... At least not until we've tried it a bit more ourselves first :D Perhaps it can just be documented in the readme or something for now? Making it a manual process to require gems would also be a good fit for our "less magic" philosophy. We should probably document that the user must require gems manually in the readme as well. Even if it's not godmin specific. |
Yeah I guess the difference is that its a Rails convention to automatically require gems. People who just build Rails apps are not familiar with other setups. Rails kinda hides the fact that they use If we add it I think we should do it with a generator though, so it's easy to remove. Not hide it somewhere in the gem. |
Sure, but everyone who uses engines already will be confused that they don't have to require? :) That's probably less people though. Maybe we should nudge people in the right direction and move away from auto require. Are there still gems that don't follow this naming convention? If so, it would be confusing to have to require those manually for no apparent reason. But perhaps there are no such gems anymore :) |
Anyone who knows they'll have to require dependencies will open that file in order to require the dependency. They will then see that piece of code and a comment explaining what it does, and can choose between keeping it or removing it in favour of manually requiring. I guess? Thing is we can't really move away from auto require, since we can't change the fact it's on by default in Rails, for the main app. So if you have a standalone Godmin without any engines, you get auto require. You mean the dash naming convention? No it's not followed by everyone which is why Bundler does that thing I linked to above, and which is part of the snippet I posted above as well. |
I meant if some gems do something even weirder. gem: That would not be caught by the require above. It would blow up in bundler as well, unless they have more code to handler even weirder stuff :D Yes, I know it'll be a difference between engine installs and standalone. But other things are different as well. The I just feel like this isn't an issue with godmin. It's the way engines work :) |
Yeah I think Well, |
Okay, here's another idea. Let's just not add dependencies to the gemspecs at all? We could stop promoting the practice of putting godmin in Keeping dependencies in an engine's gemspec seems useful only if you plan on extracting the engine to a gem. But if that is not the use case we are building for, maybe we should change that. This would involve changing some generators, mainly, and the documentation. |
Yep. Perhaps that is a better idea. Any other drawbacks we can think of other than “gemification” of an engine? |
Well, I had some memory that one reason we did this was so that engine binstubs, |
Can we simplify Gemfile vs .gemspec when installing in an engine? It should at least be possible to automatically require all things specified in the .gemspec file. People not familiar with creating gems and engines have been confused about the fact that you need to manually require dependencies when specifying them in a .gemspec. Not sure this is something we should solve though.
Here's an example of requiring all runtime dependencies:
However, this does not handle gems such asgodmin-tags
that needs to require a file calledgodmin/tags
. How does bundler handle this?The text was updated successfully, but these errors were encountered: