Sha256: 803dcaa2d1305541c44820831fb1cba59269e656625c70bbfb9324cb81ce5a8a

Contents?: true

Size: 1.57 KB

Versions: 4

Compression:

Stored size: 1.57 KB

Contents

######################################################################
#                         ENVIRONMENT CHECKS                         #
######################################################################
Capistrano::Configuration.instance(:must_exist).load do
  on      :start,                                 'environment:check', :except => ['staging', 'production']

  before  'environment:check',                    'environment:check:common'

  namespace :environment do
    namespace :check do
      desc "[internal] Checks for environment variables shared among all deployment types."
      task :common do
        abort "You need to specify staging or production when you deploy. ie 'cap staging db:backup'" unless exists?(:rails_env)
        abort "You need to specify a deployment type in your application's 'deploy.rb' file. ie 'set :deployment_type, :heroku'" unless exists?(:deployment_type)

        required_variables = [
          :application,
          :application_short
        ]

        verify_variables(required_variables)
      end

      desc "[internal] Runs checks for all of the capabilities listed."
      task :capabilities do
        if exists?(:capabilities)
          fetch(:capabilities).each do |capability|
            environment.check.send(capability.to_s) if environment.check.respond_to?(capability.to_sym)
          end
        end
      end

      desc "[internal] Checks to see if all the necessary environment variables have been set up for a proper deployment."
      task :default do
        environment.check.capabilities
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
chicken_soup-0.0.5 lib/chicken_soup/environment/checks.rb
chicken_soup-0.0.4 lib/chicken_soup/environment/checks.rb
chicken_soup-0.0.3 lib/chicken_soup/environment/checks.rb
chicken_soup-0.0.2 lib/chicken_soup/environment/checks.rb