capistrano/README.md

94 lines
1.4 KiB
Markdown
Raw Normal View History

# Capistrano [![Build Status](https://travis-ci.org/capistrano/capistrano.png?branch=v3)](https://travis-ci.org/capistrano/capistrano)
2013-02-01 09:19:14 +00:00
## Installation
Add this line to your application's Gemfile:
``` ruby
gem 'capistrano', github: 'capistrano/capistrano', branch: :v3
```
2013-02-01 09:19:14 +00:00
And then execute:
``` ruby
$ bundle --binstubs
```
2013-02-01 09:19:14 +00:00
Capify:
``` shell
$ cap install
```
2013-02-08 11:15:27 +00:00
This creates the following files:
```
├── Capfile
├── config
│ ├── deploy
│ │ ├── production.rb
│ │ └── staging.rb
│ └── deploy.rb
└── lib
└── capistrano
└── tasks
```
2013-02-08 11:15:27 +00:00
To create different stages:
``` shell
$ cap install STAGES=local,sandbox,qa,production
```
2013-02-01 09:19:14 +00:00
## Usage
2013-02-01 09:19:14 +00:00
``` shell
$ cap -vT
$ cap staging deploy
$ cap production deploy
$ cap production deploy --dry-run
$ cap production deploy --prereqs
$ cap production deploy --trace
```
## Tasks
2013-03-22 16:29:11 +00:00
2013-02-08 09:15:10 +00:00
## Before / After
Where calling on the same task name, executed in order of inclusion
``` ruby
# call an existing task
before :starting, :ensure_user
2013-02-08 09:15:10 +00:00
after :finishing, :notify
2013-02-08 09:15:10 +00:00
# or define in block
before :starting, :ensure_user do
#
end
2013-02-08 09:15:10 +00:00
after :finishing, :notify do
#
end
```
2013-02-08 09:15:10 +00:00
## Console
Execute arbitrary remote commands, to use this simply add
`require 'capistrano/console'` which will add the necessary tasks to your
environment:
``` shell
$ cap staging console
```
2013-02-08 11:15:27 +00:00
## Configuration
2013-02-08 09:15:10 +00:00
## SSHKit