1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Allow cap -T to work when no Capfile is present

Previously, the `cap -T` command assumed the presence of the
`load:defaults` task. This task is only present if a proper Capfile is
loaded, and so `cap -T` wouldn't work in a new, not yet "capified"
project.

This commit fixes the bug by testing that `load:defaults` is defined
before calling it.
This commit is contained in:
Matt Brictson 2017-03-19 20:02:38 -07:00
parent 84407c63a7
commit 27a8fbe8ef
No known key found for this signature in database
GPG key ID: 2F279EAD1F2ACFAF
3 changed files with 7 additions and 1 deletions

View file

@ -13,6 +13,7 @@ gem "capistrano", :github => "capistrano/capistrano"
https://github.com/capistrano/capistrano/compare/v3.7.2...HEAD https://github.com/capistrano/capistrano/compare/v3.7.2...HEAD
* Your contribution here! * Your contribution here!
* [#1867](https://github.com/capistrano/capistrano/pull/1867): Allow `cap -T` to run without Capfile present - [@mattbrictson](https://github.com/mattbrictson)
## `3.8.0` (2017-03-10) ## `3.8.0` (2017-03-10)

View file

@ -3,6 +3,11 @@ Feature: Installation
Background: Background:
Given a test app without any configuration Given a test app without any configuration
Scenario: The "install" task documentation can be viewed
When I run "cap -T"
Then the task is successful
And contains "cap install" in the output
Scenario: With default stages Scenario: With default stages
When I run "cap install" When I run "cap install"
Then the deploy.rb file is created Then the deploy.rb file is created

View file

@ -96,7 +96,7 @@ module Capistrano
end end
def load_imports def load_imports
if options.show_tasks if options.show_tasks && Rake::Task.task_defined?("load:defaults")
invoke "load:defaults" invoke "load:defaults"
set(:stage, "") set(:stage, "")
Dir[deploy_config_path].each { |f| add_import f } Dir[deploy_config_path].each { |f| add_import f }