Sha256: 99758531a9019b276f8232e06335737a77019bad7d9e268e33811aef5dbc11fc

Contents?: true

Size: 783 Bytes

Versions: 7

Compression:

Stored size: 783 Bytes

Contents

Capistrano::Configuration.instance(:must_exist).load do
  _cset :site_roles, [:app]

  namespace :site do
    desc "Serve up a custom maintenance page."
    task :disable, :roles => site_roles do
      require 'erb'
      on_rollback { delete "#{shared_path}/system/maintenance.html" }
      reason   = ENV['REASON' ]
      deadline = ENV['UNTIL' ]

      template = File.join(File.dirname(__FILE__), "..", "..", "..", "files", 'app', 'maintenance.html.erb')
      page     = ERB.new(File.read(template)).result(binding)

      upload_string page, "#{shared_path}/system/maintenance.html", :via => :scp, :mode => 644
    end

    desc "Remove custom maintenance page."
    task :enable, :roles => site_roles do
      run "rm #{shared_path}/system/maintenance.html"
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
thunder_punch-0.1.6 lib/thunder_punch/recipes/site.rb
thunder_punch-0.1.5 lib/thunder_punch/recipes/site.rb
thunder_punch-0.1.4 lib/thunder_punch/recipes/site.rb
thunder_punch-0.1.3 lib/thunder_punch/recipes/site.rb
thunder_punch-0.1.2 lib/thunder_punch/recipes/site.rb
thunder_punch-0.1.1 lib/thunder_punch/recipes/site.rb
thunder_punch-0.1.0 lib/thunder_punch/recipes/site.rb