-
Notifications
You must be signed in to change notification settings - Fork 128
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
Load Bowerfile from all gem dependencies before load #162
Conversation
Awesome, thanks! |
Load Bowerfile from all gem dependencies before load
Sorry to revive this old PR but I'm having issues with it and the code doesn't seem right. @gabealmer maybe you can help... I'm using 0.11 with rails 5, I've created the initializer with:
When I run For testing purposes, I updated the rake task to load the environment:
Now the initializer is called but after the DSL config is evaluated, causing any configurations to be ignored. Decided to investigate this evaluation and found that it's intentionally done before rails initialization as below:
or in the performer class:
That makes me think that you're not supposed to load the rails environment from the rake task but then I ask, how can you run rake tasks with custom configurations if the initializer is never loaded? |
@louman I use it only for a rake task, so I had to configure So personally I don't use the rails initializer, nor the
I think you are all set.
while in my main Rails app I have to call Do you really want to load it to the application, or just the documentation was misleading regarding to this? |
I don't really need the environment, just the configuration to also read Bowerfiles from gems. Can you post an example of your rakefile? Thanks in advance. |
For example I have this rake task file if defined?(BowerRails)
BowerRails.configure do |config|
config.use_gem_deps_for_bowerfile = true
end
unless Rake::Task.task_defined?('bower:install')
namespace :bower do
task :install do
Rake::Task['app:bower:install:development'].invoke
end
end
end
end And then in every gem and in the main app's load 'engine_name/rake_tasks/bower.rake' With this you can call |
I faced the same limitation as discussed in #133, so implemented an easy solution by checking all gem dependencies for a Bowerfile.
If one found then it is evaluated before the main Bowerfile of the project what you are working on.
It works like all definitions would be in the same Bowerfile. Maybe it's not the ideal solution, but at least it works.