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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
Thanks
This code is heavily inspired by https://github.com/capistrano/composer