lib/deep_thought/deployer.rb in deep_thought-0.1.0 vs lib/deep_thought/deployer.rb in deep_thought-0.1.1
- old
+ new
@@ -2,10 +2,11 @@
require 'deep_thought/git'
module DeepThought
module Deployer
class DeployerNotFoundError < StandardError; end
+ class DeployerSetupFailedError < StandardError; end
class DeploymentFailedError < StandardError; end
class DeploymentInProgressError < StandardError; end
class << self
attr_accessor :adapters
@@ -82,11 +83,15 @@
deploy.in_progress = true
deploy.save!
klass = adapters[deploy_type]
deployer = klass.new
- deployer.setup(deploy.project, project_config)
- deploy_status = deployer.execute(deploy, project_config)
+
+ if !deployer.setup?(deploy.project, project_config)
+ raise DeployerSetupFailedError, "Deployer setup failed - check the deployer and project settings."
+ end
+
+ deploy_status = deployer.execute?(deploy, project_config)
unlock_deployer
deploy.finished_at = DateTime.now
deploy.in_progress = false