Sha256: 95092ef2ecddbfc0f75514028f8de2f0c49e01e77b86253456addf053c26a017

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

namespace :cachetool do
  desc <<-DESC
    Installs cachetool.phar to the shared directory
    In order to use the .phar file, the cachetool command needs to be mapped:
      SSHKit.config.command_map[:cachetool] = "\#{shared_path.join("cachetool.phar")}"
    This is best used after deploy:starting:
      namespace :deploy do
        after :starting, 'cachetool:install_executable'
      end
  DESC
  task :install_executable do
    on release_roles(fetch(:cachetool_roles)) do
      within shared_path do
        unless test '[', '-e', 'cachetool.phar', ']'
          execute :curl, '-sO', fetch(:cachetool_download_url)
          execute :chmod, '+x', 'cachetool.phar'
        end
      end
    end
  end

  desc <<-DESC
    Access a cachetool command directly
    This tasks allows access to any cachetool command.
  DESC
  task :run, :command do |t, args|
    args.with_defaults(:command => :list)
    on release_roles(fetch(:cachetool_roles)) do
      within fetch(:cachetool_working_dir) do
        execute :cachetool, args[:command], *args.extras
      end
    end
  end
end

namespace :load do
  task :defaults do
    set :cachetool_roles, :all
    set :cachetool_download_url, 'https://gordalina.github.io/cachetool/downloads/cachetool.phar'
    set :cachetool_working_dir, -> { fetch(:release_path) }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-cachetool-1.0.4 lib/capistrano/tasks/cachetool.rake