No commit activity in last 3 years
No release in over 3 years
n98-magerun support for Capistrano 3.x
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme

Capistrano::Magerun

n98-magerun support for Capistrano 3.x

Installation

Add this line to your application's Gemfile:

gem 'capistrano', '~> 3.1.0'
gem 'capistrano-magerun'

And then execute:

$ bundle

Or install it yourself as:

$ gem install capistrano-magerun

Usage

Require the module in your Capfile:

require 'capistrano-magerun'

capistrano-magerun comes with 3 tasks:

  • magerun:install
  • magerun:self_update
  • magerun:run

By default it is assumed that you have the n98-magerun.phar executable installed and in your $PATH on all target hosts.

Configuration

Configurable options, shown here with defaults:

set :magerun_roles, :all
set :magerun_download_url, 'http://files.magerun.net/n98-magerun-latest.phar'
set :magerun_rootdir, release_path

Installing magerun as part of a deployment

Add the following to deploy.rb to manage the installation of magerun during deployment (n98-magerun.phar is install in the shared path).

SSHKit.config.command_map[:'n98-magerun.phar'] = "#{shared_path.join('n98-magerun.phar')}"

namespace :deploy do
  after :starting, 'magerun:install'
end

Accessing magerun commands directly

This library also provides a magerun:run task which allows access to any magerun command.

From the command line you can run

$ cap production magerun:run['sys:maintenance', '--off']

Or from within a rake task using capistrano's invoke

task :my_custom_magerun_task do
  Rake::Task['magerun:run'].invoke('sys:maintenance --off')
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Thanks

This code is heavily inspired by https://github.com/capistrano/composer