Sha256: 2d2bb2edf47f7f4f054b2da04f6edd9598b2a0e91d1f16ef82b0224210c7b4bf

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 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 #{shared_path}/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

2 entries across 2 versions & 1 rubygems

Version Path
capistrano-cachetool-1.0.6 lib/capistrano/tasks/cachetool.rake
capistrano-cachetool-1.0.5 lib/capistrano/tasks/cachetool.rake