capistrano/capistrano — pull request #715 by ayanko (2013-10-18 00:20:35+00:00)
Title: Multiple level nested and shared stages support

## Multiple level nested and shared stages support

This commit extends stages functionality:

* support "classic" stages
* set custom stages configuration root (via set :stages_root)
* ability to have N-level nested and shared configurations for stages

### Example:

Layout:

config/
├── deploy
│ ├── api
│ │ ├── production.rb
│ │ ├── staging
│ │ │ ├── alpha.rb
│ │ │ └── beta.rb
│ │ └── staging.rb
│ ├── api.rb
│ └── core
│ └── production.rb
└── deploy.rb

It will generate stages:

* api:production
* api:staging:alpha
* api:staging:beta
* core:production

$ cap api:production

Loads:

* config/deploy.rb
* config/deploy/api.rb
* config/deploy/api/production.rb

$ cap api:staging:alpha

Loads:

* config/deploy.rb
* config/deploy/api.rb
* config/deploy/api/staging.rb
* config/deploy/api/staging/alpha.rb

$ cap api:staging:beta

Loads:

* config/deploy.rb
* config/deploy/api.rb
* config/deploy/api/staging.rb
* config/deploy/api/staging/beta.rb

$ cap core:production deploy

Loads:
* config/deploy.rb
* config/deploy/core/production.rb

Currently its implemented in separate gem [capistrano-multiconfig](https://github.com/railsware/capistrano-multiconfig/).

But I think that "nested" stages feature is rather small so it might be integrated in capistrano core.

Thx.