def define_resource_requirements
requirements.assert(:rollback) do |a|
a.assertion { all_releases[-2] }
a.failure_message(RuntimeError, "There is no release to rollback to!")
end
[ @new_resource.before_migrate, @new_resource.before_symlink,
@new_resource.before_restart, @new_resource.after_restart ].each do |script|
requirements.assert(:deploy, :force_deploy) do |a|
callback_file = "#{release_path}/#{script}"
a.assertion do
if script && script.class == String
::File.exist?(callback_file)
else
true
end
end
a.failure_message(RuntimeError, "Can't find your callback file #{callback_file}")
a.whyrun("Would assume callback file #{callback_file} included in release")
end
end
end