mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
Add a command line option to control role filtering
The functionality to filter the executing tasks by role (i.e. deploying only to servers that match the role you specify) already exists. It can specified either by using the following in your deployment config: set :filter, :roles => %w{app web} Or by setting `ENV['ROLES']`: ROLES=app,web cap production deploy This commit adds a command line switch to set the role filter, which avoids polluting ENV: cap --roles=app,web production deploy
This commit is contained in:
parent
9014346664
commit
5a82cdb434
2 changed files with 14 additions and 1 deletions
|
@ -2,6 +2,10 @@
|
|||
|
||||
Reverse Chronological Order:
|
||||
|
||||
## master
|
||||
|
||||
* Add a command line option to control role filter (`--roles`) (@andytinycat)
|
||||
|
||||
## `3.1.0` (not released)
|
||||
|
||||
* Tasks `deploy:linked_dirs`, `deploy:make_linked_dirs`, `deploy:linked_files`, `deploy:cleanup_rollback`,
|
||||
|
|
|
@ -13,7 +13,7 @@ module Capistrano
|
|||
end
|
||||
|
||||
def sort_options(options)
|
||||
options.push(version,dry_run)
|
||||
options.push(version,dry_run,roles)
|
||||
super
|
||||
end
|
||||
|
||||
|
@ -63,6 +63,15 @@ module Capistrano
|
|||
}
|
||||
]
|
||||
end
|
||||
|
||||
def roles
|
||||
['--roles ROLES', '-r',
|
||||
"Filter command to only apply to these roles (separate multiple roles with a comma)",
|
||||
lambda { |value|
|
||||
Configuration.env.set(:filter, :roles => value.split(","))
|
||||
}
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue