Class: Chef::Provider::Deploy

Inherits:
Chef::Provider show all
Defined in:
lib/chef-deploy.rb

Instance Method Summary collapse

Instance Method Details

#action_deployObject



212
213
214
215
216
217
218
219
# File 'lib/chef-deploy.rb', line 212

def action_deploy
  Dir.chdir(@new_resource.name) do
    Chef::Log.level(:debug)
    Chef::Log.info "Running a new deploy\nto: #{@new_resource.name}\nrepo: #{@new_resource.repo}"
    @dep.deploy
    Chef::Log.level(Chef::Config[:log_level])
  end
end

#action_rollbackObject



221
222
223
224
225
226
227
228
# File 'lib/chef-deploy.rb', line 221

def action_rollback
  Dir.chdir(@new_resource.name) do
    Chef::Log.level(:debug)
    Chef::Log.info "Rolling back deploy\nto: #{@new_resource.name}\nrepo: #{@new_resource.repo}"
    @dep.rollback
    Chef::Log.level(Chef::Config[:log_level])
  end
end

#load_current_resourceObject



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/chef-deploy.rb', line 186

def load_current_resource
  FileUtils.mkdir_p "#{@new_resource.name}/shared"
  FileUtils.mkdir_p "#{@new_resource.name}/releases"
  @dep = CachedDeploy.new :user                  => @new_resource.user,
                          :group                 => @new_resource.group,
                          :role                  => @new_resource.role,
                          :branch                => (@new_resource.branch || 'HEAD'),
                          :restart_command       => (@new_resource.restart_command || ""),
                          :repository            => @new_resource.repo,
                          :environment           => @new_resource.environment,
                          :migration_command     => @new_resource.migration_command,
                          :migrate               => @new_resource.migrate,
                          :deploy_to             => @new_resource.name,
                          :repository_cache      => @new_resource.repository_cache,
                          :copy_exclude          => @new_resource.copy_exclude,
                          :revision              => (@new_resource.revision || ''),
                          :git_enable_submodules => @new_resource.enable_submodules,
                          :git_shallow_clone     => @new_resource.shallow_clone,
                          :svn_username          => @new_resource.svn_username,
                          :svn_password          => @new_resource.svn_password,
                          :scm                   => @new_resource.scm || 'git',
                          :node                  => @node,
                          :new_resource          => @new_resource,
                          :git_ssh_wrapper       => @git_ssh_wrapper
end