Skip to content

Commit

Permalink
refactor methods in deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Valodzka committed May 5, 2011
1 parent 1e59ad7 commit 08937e6
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions chef/lib/chef/provider/deploy.rb
Expand Up @@ -59,8 +59,8 @@ def run(command, &block)
end

def action_deploy
if all_releases.include?(release_path)
if all_releases[-1] == release_path
if deployed?(release_path)
if current_release?(release_path)
Chef::Log.debug("#{@new_resource} is the latest version")
else
action_rollback
Expand All @@ -72,7 +72,8 @@ def action_deploy
end

def action_force_deploy
if all_releases.include?(release_path)
if deployed?(release_path)
Chef::Log.info("Already deployed app at #{release_path}, forcing.")
FileUtils.rm_rf(release_path)
Chef::Log.info("#{@new_resource} forcing deploy of already deployed app at #{release_path}")
end
Expand Down Expand Up @@ -338,6 +339,13 @@ def run_callback_from_file(callback_file)
end
end

def deployed?(release)
all_releases.include?(release)
end

def current_release?(release)
all_releases[-1] == release
end
end
end
end

0 comments on commit 08937e6

Please sign in to comment.