Sha256: 7bd8b3be0bf966c366df78f08ba022ff04b33333729f29d74cd5d03cfb5842a0

Contents?: true

Size: 1.81 KB

Versions: 5

Compression:

Stored size: 1.81 KB

Contents

require 'rake'
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'whiskey_disk'))

namespace :deploy do
  desc "Perform initial setup for deployment"
  task :setup do
    @whiskey_disk = WhiskeyDisk.new
    @whiskey_disk.ensure_main_parent_path_is_present
    @whiskey_disk.ensure_config_parent_path_is_present      if @whiskey_disk.has_config_repo?
    @whiskey_disk.checkout_main_repository
    @whiskey_disk.checkout_configuration_repository         if @whiskey_disk.has_config_repo?
    @whiskey_disk.update_main_repository_checkout
    @whiskey_disk.update_configuration_repository_checkout  if @whiskey_disk.has_config_repo?
    @whiskey_disk.refresh_configuration                     if @whiskey_disk.has_config_repo?
    @whiskey_disk.initialize_all_changes
    @whiskey_disk.run_post_setup_hooks
    @whiskey_disk.flush
    @whiskey_disk.summarize

    exit(1) unless @whiskey_disk.success?
  end
  
  desc "Deploy now."
  task :now do
    @whiskey_disk = WhiskeyDisk.new(:staleness_checks => true)
    @whiskey_disk.update_main_repository_checkout
    @whiskey_disk.update_configuration_repository_checkout  if @whiskey_disk.has_config_repo?
    @whiskey_disk.refresh_configuration                     if @whiskey_disk.has_config_repo?
    @whiskey_disk.run_post_deploy_hooks
    @whiskey_disk.flush
    @whiskey_disk.summarize

    exit(1) unless @whiskey_disk.success?
  end
  
  task :post_setup do
    @whiskey_disk = WhiskeyDisk.new
    env = @whiskey_disk.setting(:environment)
    Rake::Task["deploy:#{env}:post_setup"].invoke if Rake::Task.task_defined? "deploy:#{env}:post_setup"      
  end

  task :post_deploy do
    @whiskey_disk = WhiskeyDisk.new
    env = @whiskey_disk.setting(:environment)
    Rake::Task["deploy:#{env}:post_deploy"].invoke if Rake::Task.task_defined? "deploy:#{env}:post_deploy"      
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
ol-whisk_deploy-0.6.25 lib/whiskey_disk/rake.rb
ol-whisk_deploy-0.6.26 lib/whiskey_disk/rake.rb
whisk_deploy-0.6.26 lib/whiskey_disk/rake.rb
whiskey_disk-0.6.24 lib/whiskey_disk/rake.rb
whiskey_disk-0.6.23 lib/whiskey_disk/rake.rb