mina-deploy / mina

Blazing fast deployer and server automation tool
https://rubygems.org/gems/mina
Other
4.34k stars 491 forks source link

fix rails_env variable #663

Closed blackbiron closed 2 years ago

blackbiron commented 3 years ago

the issue was i unable to set rails_env on deploy.rb (it will always back to :production)

lovro-bikic commented 2 years ago

Hi, thanks for the PR. Although there are no issues with this fix, I believe this happened to you because you first set the :rails_env variable and then required mina/rails, something like this:

# config/deploy.rb
set :rails_env, 'something'

require 'mina/rails'

Since mina/rails sets that variable, anything you set before requiring it will be overriden if mina/rails sets it too. The fix is simple, you should first require all tasks and then override variables:

# config/deploy.rb
require 'mina/rails'

set :rails_env, 'something'

Hope this helps! If it turns out that wasn't the issue, and it's in fact a bug in Mina, feel free to reopen the PR and we'll take a further look.