Open dwmoore opened 10 years ago
What happens if you choose:
option Build a starter application?
1) Build a RailsApps example application
and then:
option Choose a starter application.
5) rails-devise
It builds for me without a problem.
I've also built the application using:
option Build a starter application?
3) Custom application (experimental)
The Rails.application.secrets.domain_name
variable should be available in the config/secrets.yml file. I wonder if your config/secrets.yml file is missing?
It fails on the rails-devise test app for me as well. Also, I have the secrets.yml file so that is not the issue. I will add that I had this exact battle on all my composer generated apps when I precompiled for Heroku deployment, I just learned quickly on to kill out that line or set the environment variable on my local machine.
I am hazarding a guess that your build succeeds because you have a local environment variable set for domain_name whereas most other users will not on their first build. It shouldn't matter what domain_name is, just that you have one. That way you don't get nil returned on Rails.application.secrets.domain_name.
Using the nil guard is probably not the best approach to fixing this but it takes care of the problem for those who don't have a domain_name environment variable set up at the time of running rails composer. Once Rails.application.secrets.domain_name actually gets a value, it takes over from the default.
When selecting Heroku deployment as an option in addition to Devise as user authentication an error is thrown on precompile due to the environment variable used in config/initializers/devise.rb:13. This value is nil on setup.
Next there is an error stating that the Devise secret key must be set.
Now precompile should work.
To fix the first issue, I am thinking something like this in config/initializers/devise.rb:
As for the next issue, I am not sure if the default key can be used and simply uncommented or if a new key is required. If the earlier is possible then the fix seems straight forward. If the later, I would defer to your expertise.
Thanks again for providing this killer resource!