1
0
Fork 0
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:
Hrvoje Šimić 2013-11-17 13:08:17 +01:00
parent 5e1dba2a23
commit ea1e4775f8
3 changed files with 7 additions and 7 deletions

1
.gitignore vendored
View file

@ -18,3 +18,4 @@ tmp
.rspec-local .rspec-local
.ruby-version .ruby-version
_site _site
.rspec

View file

@ -3,10 +3,13 @@ module Capistrano
def initialize def initialize
super super
@name = "cap"
@rakefiles = %w{capfile Capfile capfile.rb Capfile.rb} << capfile @rakefiles = %w{capfile Capfile capfile.rb Capfile.rb} << capfile
end end
def name
"cap"
end
def run def run
Rake.application = self Rake.application = self
super super
@ -18,7 +21,6 @@ module Capistrano
end end
def load_rakefile def load_rakefile
@name = 'cap'
super super
end end

View file

@ -7,11 +7,10 @@ describe Capistrano::Application do
it "provides a --format option which enables the choice of output formatting" it "provides a --format option which enables the choice of output formatting"
it "identifies itself as cap and not rake" do it "identifies itself as cap and not rake" do
pending "Waiting for: https://github.com/jimweirich/rake/pull/204"
out, _ = capture_io do out, _ = capture_io do
flags '--help', '-h' flags '--help', '-h'
end end
out.should match(/\bcap [ -f capfile ]\b/) out.lines.first.should match(/cap \[-f rakefile\]/)
end end
it "overrides the rake method, but still prints the rake version" do it "overrides the rake method, but still prints the rake version" do
@ -37,9 +36,7 @@ describe Capistrano::Application do
def subject.exit(*args) def subject.exit(*args)
throw(:system_exit, :exit) throw(:system_exit, :exit)
end end
subject.instance_eval do subject.run
handle_options
end
subject.options subject.options
end end