2014-06-07 13:44:15 -04:00
# Capistrano [![Build Status](https://travis-ci.org/capistrano/capistrano.svg?branch=master)](https://travis-ci.org/capistrano/capistrano) [![Code Climate](http://img.shields.io/codeclimate/github/capistrano/capistrano.svg)](https://codeclimate.com/github/capistrano/capistrano) <a href="http://codersclan.net/?repo_id=325&source=small"><img src="http://img.shields.io/badge/get-support-blue.svg"></a>
2013-02-01 04:19:14 -05:00
2015-01-18 09:41:22 -05:00
## Documentation
2013-06-07 11:45:39 -04:00
2015-01-18 09:41:22 -05:00
Check out the [online documentation ](http://capistranorb.com ) of Capistrano 3 hosted via this [repository ](https://github.com/capistrano/capistrano.github.io ).
2013-06-07 11:45:39 -04:00
2014-01-14 15:09:59 -05:00
## Support
2014-01-14 14:58:26 -05:00
2014-03-02 19:05:48 -05:00
Need help with getting Capistrano up and running? Got a code problem you want to get solved quickly?
2014-01-14 14:58:26 -05:00
2015-01-18 09:41:22 -05:00
Get < a href = "http://codersclan.net/?repo_id=325&source=link" > Capistrano support on CodersClan.< / a > < a href = "http://codersclan.net/?repo_id=325&source=big" > < img src = "http://www.codersclan.net/gs_button/?repo_id=325" width = "150" > < / a >
## Requirements
* Ruby >= 1.9.3 (JRuby and C-Ruby/YARV are supported)
Capistrano support these source code version control systems out of the box:
2014-01-14 14:58:26 -05:00
2015-01-18 09:41:22 -05:00
* Git 1.8 or higher
* Mercurial
* SVN
Binaries for these VCS might be required on the local and/or the remote systems.
2014-01-14 14:58:26 -05:00
2013-02-01 04:19:14 -05:00
## Installation
Add this line to your application's Gemfile:
2013-05-28 13:00:13 -04:00
``` ruby
2014-11-27 05:47:43 -05:00
gem 'capistrano', '~> 3.3.0'
2013-05-28 13:00:13 -04:00
```
2013-02-01 04:19:14 -05:00
And then execute:
2013-10-11 20:38:38 -04:00
``` sh
2013-10-22 02:50:45 -04:00
$ bundle install
2013-05-28 13:00:13 -04:00
```
2013-02-01 04:19:14 -05:00
2013-02-01 09:41:51 -05:00
Capify:
2013-10-08 04:37:25 -04:00
*make sure there's no "Capfile" or "capfile" present*
2013-10-11 20:38:38 -04:00
``` sh
2013-10-22 02:50:45 -04:00
$ bundle exec cap install
2013-05-28 13:00:13 -04:00
```
2013-02-08 06:15:27 -05:00
This creates the following files:
2013-05-28 13:00:13 -04:00
```
├── Capfile
├── config
│ ├── deploy
│ │ ├── production.rb
│ │ └── staging.rb
│ └── deploy.rb
└── lib
└── capistrano
└── tasks
```
2013-02-08 06:15:27 -05:00
To create different stages:
2013-10-11 20:38:38 -04:00
``` sh
2013-10-22 02:50:45 -04:00
$ bundle exec cap install STAGES=local,sandbox,qa,production
2013-05-28 13:00:13 -04:00
```
2013-02-01 04:19:14 -05:00
2013-02-01 09:41:51 -05:00
## Usage
2013-02-01 04:19:14 -05:00
2013-10-11 20:38:38 -04:00
``` sh
2015-01-18 09:41:22 -05:00
# list all available tasks
2014-04-21 18:47:32 -04:00
$ bundle exec cap -T
2013-03-10 16:43:39 -04:00
2015-01-18 09:41:22 -05:00
# deploy to the staging environment
2013-10-22 02:50:45 -04:00
$ bundle exec cap staging deploy
2015-01-18 09:41:22 -05:00
# deploy to the production environment
2013-10-22 02:50:45 -04:00
$ bundle exec cap production deploy
2013-03-15 07:35:49 -04:00
2015-01-18 09:41:22 -05:00
# simulate deploying to the production environment
# does not actually do anything
2013-10-22 02:50:45 -04:00
$ bundle exec cap production deploy --dry-run
2013-03-08 10:55:29 -05:00
2015-01-18 09:41:22 -05:00
# list task dependencies
$ bundle exec cap production deploy --prereqs
2013-06-13 11:23:34 -04:00
2015-01-18 09:41:22 -05:00
# trace through task invocations
$ bundle exec cap production deploy --trace
2013-06-13 11:23:34 -04:00
```
2014-04-22 11:36:44 -04:00
## Testing
Capistrano has two test suites: an RSpec suite and a Cucumber suite. The
RSpec suite handles quick feedback unit specs. The Cucumber features are
an integration suite that uses Vagrant to deploy to a real virtual
server. In order to run the Cucumber suite you will need to install
[Vagrant ](http://www.vagrantup.com/ ) and Vagrant supported
virtualization software like
[VirtualBox ](https://www.virtualbox.org/wiki/Downloads ).
```
# To run the RSpec suite
$ rake spec
# To run the Cucumber suite
$ rake features
# To run the Cucumber suite and leave the VM running (faster for subsequent runs)
$ rake features KEEP_RUNNING=1
```
2015-01-18 09:41:22 -05:00
## SSHKit
[SSHKit ](https://github.com/leehambley/sshkit ) is the driver for SSH
connections behind the scenes in Capistrano. Depending on how deep you dig, you
might run into interfaces that come directly from SSHKit (the configuration is
a good example).
2014-03-03 21:18:49 -05:00
## License
2013-06-30 11:33:59 -04:00
2014-03-03 21:18:49 -05:00
MIT License (MIT)
2013-10-16 04:16:06 -04:00
2014-11-27 06:00:14 -05:00
Copyright (c) 2012-2015 Tom Clements, Lee Hambley
2013-10-16 04:16:06 -04:00
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.