Sha256: 9966fef2d1648733759bdbdf00e6666d9fceeb48b7f088121197785dde145b1a

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

# rubocop:disable BlockLength
namespace :deadpull do
  def deadpull_environment
    environment = fetch(:deadpull_environment) || fetch(:stage)
    Deadpull::Values::Environment.concretize(environment)
  end

  def deadpull_path
    fetch(:deadpull_path)
  end

  def deadpull_config
    config = deadpull_path ? { path: deadpull_path } : {}
    Deadpull::Values::Configuration.concretize(config)
  end

  def deadpull_roles
    fetch(:deadpull_roles)
  end

  desc 'Fetch files locally and upload them to server'
  task :upload do
    Dir.mktmpdir do |dir|
      Deadpull::Commands::Pull.call(dir, deadpull_config, deadpull_environment)
      on roles(deadpull_roles) do
        within release_path do
          upload! File.join(dir, '.'), release_path, recursive: true
        end
      end
    end
  end

  after('deploy:updating', 'deadpull:upload') if Rake::Task.task_defined?('deploy:updating')
end
# rubocop:enable BlockLength

namespace :load do
  task :defaults do
    set :deadpull_roles, :app
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
deadpull-0.1.1 lib/capistrano/tasks/deadpull.rake