class Heroploy::Tasks::EnvTaskLib

Attributes

deployment_config[RW]
env[RW]

Public Class Methods

new(deployment_config, env) click to toggle source
# File lib/heroploy/tasks/env_task_lib.rb, line 21
def initialize(deployment_config, env)
  @deployment_config = deployment_config
  @env = env
  define
end

Public Instance Methods

define() click to toggle source
# File lib/heroploy/tasks/env_task_lib.rb, line 27
def define
  namespace env.name do
    define_check_tasks
    define_git_tasks
    define_heroku_tasks
  end
end
define_check_tasks() click to toggle source
# File lib/heroploy/tasks/env_task_lib.rb, line 35
def define_check_tasks
  namespace :check do
    CheckTaskLib.new(deployment_config, env)
  end
end
define_git_tasks() click to toggle source
# File lib/heroploy/tasks/env_task_lib.rb, line 41
def define_git_tasks
  desc "push the current branch to master on #{env.name}"
  task :push do
    git_push_to_master(env.remote, current_branch)
  end

  desc "tag the deployment to #{env.name}"
  task :tag do
    if env.tag then
      tag = DateTime.now.strftime(env.tag)
      git_tag(tag, "Deployed #{current_branch} to #{env.name}")
      git_push_tag(tag)
    end
  end
end
define_heroku_tasks() click to toggle source
# File lib/heroploy/tasks/env_task_lib.rb, line 57
def define_heroku_tasks
  desc "run database migrations on #{env.name}"
  task :migrate do
    heroku_migrate(env.app)
  end
  
  desc "set config variables"
  task :config => :load_remote_configs do
    heroku_config_set(deployment_config.shared_env.variables, env.variables, env.app)
  end

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