mirror of
https://github.com/capistrano/capistrano
synced 2023-03-27 23:21:18 -04:00
override default Rake application's name
since Rake now allows overriding application name, use `cap` instead of `rake` when outputting help
This commit is contained in:
parent
5e1dba2a23
commit
ea1e4775f8
3 changed files with 7 additions and 7 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -18,3 +18,4 @@ tmp
|
|||
.rspec-local
|
||||
.ruby-version
|
||||
_site
|
||||
.rspec
|
||||
|
|
|
@ -3,10 +3,13 @@ module Capistrano
|
|||
|
||||
def initialize
|
||||
super
|
||||
@name = "cap"
|
||||
@rakefiles = %w{capfile Capfile capfile.rb Capfile.rb} << capfile
|
||||
end
|
||||
|
||||
def name
|
||||
"cap"
|
||||
end
|
||||
|
||||
def run
|
||||
Rake.application = self
|
||||
super
|
||||
|
@ -18,7 +21,6 @@ module Capistrano
|
|||
end
|
||||
|
||||
def load_rakefile
|
||||
@name = 'cap'
|
||||
super
|
||||
end
|
||||
|
||||
|
|
|
@ -7,11 +7,10 @@ describe Capistrano::Application do
|
|||
it "provides a --format option which enables the choice of output formatting"
|
||||
|
||||
it "identifies itself as cap and not rake" do
|
||||
pending "Waiting for: https://github.com/jimweirich/rake/pull/204"
|
||||
out, _ = capture_io do
|
||||
flags '--help', '-h'
|
||||
end
|
||||
out.should match(/\bcap [ -f capfile ]\b/)
|
||||
out.lines.first.should match(/cap \[-f rakefile\]/)
|
||||
end
|
||||
|
||||
it "overrides the rake method, but still prints the rake version" do
|
||||
|
@ -37,9 +36,7 @@ describe Capistrano::Application do
|
|||
def subject.exit(*args)
|
||||
throw(:system_exit, :exit)
|
||||
end
|
||||
subject.instance_eval do
|
||||
handle_options
|
||||
end
|
||||
subject.run
|
||||
subject.options
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue