Guest User

Untitled

a guest
Jun 21st, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. #
  2. # Enable/disable maintenance mode.
  3. # setup a particular template in deploy.yml
  4. # uses layouts/maintenance.html.erb by default
  5. #
  6.  
  7. require 'lib/deploy_helpers'
  8. require 'erb'
  9.  
  10. namespace :maintenance do
  11.  
  12. task :on, :roles => :web do
  13. maintenance_page = DEPLOY_CONFIG['maintenance_page'] || "#{Rails.root}/app/views/layouts/maintenance.html.erb"
  14. if path_exists?("#{asset_path}")
  15. maintenance = ERB.new(File.read("#{maintenance_page}")).result(binding)
  16. put maintenance, "#{shared_path}/system/maintenance.html", :mode => 0644
  17. end
  18. end
  19.  
  20. task :off, :roles => :web do
  21. run "rm #{shared_path}/system/maintenance.html" if path_exists?("#{asset_path}")
  22. end
  23.  
  24. end
Add Comment
Please, Sign In to add comment