Class: Heroploy::CheckTaskLib

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Commands::Checks, Commands::Git, Commands::Heroku, Rake::DSL
Defined in:
lib/heroploy/tasks/check_task_lib.rb

Instance Method Summary collapse

Methods included from Commands::Checks

#check_branch, #check_pushed, #check_remote, #check_staged

Methods included from Commands::Heroku

#heroku_exec, #heroku_migrate, #heroku_run

Methods included from Commands::Git

#current_branch, #git_fetch, #git_push_tag, #git_push_to_master, #git_remote_behind?, #git_remote_exists?, #git_remote_has_branch?, #git_staged?, #git_tag

Constructor Details

#initialize(deploy_config, env_config) ⇒ CheckTaskLib

Returns a new instance of CheckTaskLib.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/heroploy/tasks/check_task_lib.rb', line 17

def initialize(deploy_config, env_config)
  desc "check remote exists for #{env_config.name}"
  task :remote do
    remote = env_config.remote
    check_remote(remote)
  end
  
  all_tasks = [:remote]

  if env_config.checks.pushed then
    desc "check changes have been pushed to origin"
    task :pushed do
      check_pushed(current_branch)
    end
    all_tasks << :pushed
  end

  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
    all_tasks << :branch
  end

  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
    all_tasks << :staged
  end

  desc "do all the checks for #{env_config.name}"
  task :all => all_tasks
end