Class: Heroploy::EnvTaskLib

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Commands::Checks, Commands::Git, Commands::Heroku, Rake::DSL
Defined in:
lib/heroploy/tasks/env_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) ⇒ EnvTaskLib

Returns a new instance of EnvTaskLib.



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
# File 'lib/heroploy/tasks/env_task_lib.rb', line 18

def initialize(deploy_config, env_config)
  namespace env_config.name do
    namespace :check do
      CheckTaskLib.new(deploy_config, env_config)
    end

    desc "push the current branch to master on #{env_config.name}"
    task :push do
      git_push_to_master(env_config.remote, current_branch)
    end

    desc "run database migrations on #{env_config.name}"
    task :migrate do
      heroku_migrate(env_config.heroku)
    end

    desc "tag the deployment to #{env_config.name}"
    task :tag do
      if env_config.tag then
        tag = DateTime.now.strftime(env_config.tag)
        git_tag(tag, "Deployed #{current_branch} to #{env_config.name}")
        git_push_tag(tag)
      end
    end

    desc "deploy to #{env_config.name}"
    task :deploy => ['check:all', :push, :migrate, :tag]
  end
end