Search code examples
ruby-on-rails-4capistrano

Configure maintenance_template_path for 'capistrano-maintenace' gem


In the capistrano/maintenance gem, I'm having trouble setting the path for the :maintenance_template_path variable.

I've tried

# Set the maintenance file path
set :maintenance_template_path, '/views/errors/maintenance'
set :maintenance_template_path, '/errors/maintenance'
set :maintenance_template_path, '/app/views/errors/maintenance'
set :maintenance_template_path, '/errors/maintenance.erb.html'
set :maintenance_template_path, '/views/errors/maintenance.erb.html'
set :maintenance_template_path, 'app/views/errors/maintenance.erb.html'

I keep getting No such file or directory @ rb_sysopen error.

The file is in the correct spot /Users/David/Documents/Development/myRailsApp/app/views/errors/maintenance.erb.html

What is the correct configuration?


Solution

  • It requires an absolute path. Assuming you are using config/deploy.rb, then you could do this:

    set :maintenance_template_path, 
        File.expand_path("../../app/views/errors/maintenance.erb.html", __FILE__)