class Heroploy::Tasks::CheckTaskLib

Attributes

defined_tasks[RW]
deploy_config[RW]
env_config[RW]

Public Class Methods

new(deploy_config, env_config) click to toggle source
# File lib/heroploy/tasks/check_task_lib.rb, line 20
def initialize(deploy_config, env_config)
  @deploy_config = deploy_config
  @env_config = env_config
  @defined_tasks = []
  define      
end

Public Instance Methods

define() click to toggle source
# File lib/heroploy/tasks/check_task_lib.rb, line 27
def define
  define_remote_check
  define_pushed_check
  define_branch_check
  define_staged_check
  define_config_check
  define_travis_check
  define_all_check
end
define_all_check() click to toggle source
# File lib/heroploy/tasks/check_task_lib.rb, line 97
def define_all_check
  desc "do all the checks for #{env_config.name}"
  task :all => @defined_tasks
end
define_branch_check() click to toggle source
# File lib/heroploy/tasks/check_task_lib.rb, line 57
def define_branch_check
  if env_config.checks.branch then
    desc "check we can deploy to #{env_config.name} from the current branch"
    task :branch do
      valid_branch = env_config.checks.branch
      check_branch(current_branch, valid_branch, env_config.name)
    end
    @defined_tasks << :branch
  end
end
define_config_check() click to toggle source
# File lib/heroploy/tasks/check_task_lib.rb, line 79
def define_config_check
  desc "check all required config variables are defined"
  task :config => :load_remote_configs do
    check_config(deploy_config.shared_env, env_config)
  end
  @defined_tasks << :config
end
define_pushed_check() click to toggle source
# File lib/heroploy/tasks/check_task_lib.rb, line 47
def define_pushed_check
  if env_config.checks.pushed then
    desc "check changes have been pushed to origin"
    task :pushed do
      check_pushed(current_branch)
    end
    @defined_tasks << :pushed
  end
end
define_remote_check() click to toggle source
# File lib/heroploy/tasks/check_task_lib.rb, line 37
def define_remote_check
  desc "check remote exists for #{env_config.name}"
  task :remote do
    remote = env_config.remote
    check_remote(remote)
  end

  @defined_tasks << :remote
end
define_staged_check() click to toggle source
# File lib/heroploy/tasks/check_task_lib.rb, line 68
def define_staged_check
  if env_config.checks.staged then
    desc "check the changes have already been staged"
    task :staged do
      staging_env_config = deploy_config[env_config.checks.staged]
      check_staged(staging_env_config.remote, current_branch, staging_env_config.name)
    end
    @defined_tasks << :staged
  end
end
define_travis_check() click to toggle source
# File lib/heroploy/tasks/check_task_lib.rb, line 87
def define_travis_check
  if env_config.checks.travis then
    desc "check the travis build for the current branch"
    task :travis do
      check_travis(current_branch, deploy_config.travis_repo)
    end
    @defined_tasks << :travis
  end
end