Sha256: 83451d9875284f0e239399708b82cba3bf94c58d4b2c128ccc7e2b9fdacce2c0

Contents?: true

Size: 1.37 KB

Versions: 2

Compression:

Stored size: 1.37 KB

Contents

######################################################################
#                              DB CHECKS                             #
######################################################################
Capistrano::Configuration.instance(:must_exist).load do
  extend ChickenSoup

  namespace :capabilities do
    namespace :variable do
      namespace :check do
        desc <<-DESC
          [internal] Checks to see if all necessary DB capabilities variables have been set up.
        DESC
        task :db do
          required_variables = [
            :skip_backup_before_migration,
            :db_backups_path
          ]

          verify_variables(required_variables)
        end
      end
    end

    namespace :deployment do
      namespace :check do
        desc <<-DESC
          [internal] Checks to see if the DB is ready for deployment.
        DESC
        task :db, :roles => :db, :only => {:primary => true} do
          backup_task_exists = capture("cd #{current_path} && #{rake} -T | grep db:backup | wc -l").chomp
          abort("There must be a task named db:backup in order to deploy.  If you do not want to backup your DB during deployments, set the skip_backup_before_migration variable to true in your deploy.rb.") if backup_task_exists == '0'

          run "if [ ! -d #{db_backups_path} ]; then mkdir #{db_backups_path}; fi"
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chicken_soup-0.6.1 lib/chicken_soup/capabilities/shared/db-checks.rb
chicken_soup-0.6.0 lib/chicken_soup/capabilities/shared/db-checks.rb