Class: Capistrano::Application
- Inherits:
-
Rake::Application
- Object
- Rake::Application
- Capistrano::Application
- Defined in:
- lib/capistrano/application.rb
Instance Method Summary collapse
- #display_error_message(ex) ⇒ Object
- #exit_because_of_exception(ex) ⇒ Object
- #handle_options ⇒ Object
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #name ⇒ Object
- #run ⇒ Object
- #sort_options(options) ⇒ Object
- #top_level_tasks ⇒ Object
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
4 5 6 7 |
# File 'lib/capistrano/application.rb', line 4 def initialize super @rakefiles = %w{capfile Capfile capfile.rb Capfile.rb} << capfile end |
Instance Method Details
#display_error_message(ex) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/capistrano/application.rb', line 64 def (ex) unless .backtrace if loc = Rake.application.find_rakefile_location whitelist = (@imported.dup << loc[0]).map{|f| File.absolute_path(f, loc[1])} pattern = %r@^(?!#{whitelist.map{|p| Regexp.quote(p)}.join('|')})@ Rake.application..suppress_backtrace_pattern = pattern end trace "(Backtrace restricted to imported tasks)" end super end |
#exit_because_of_exception(ex) ⇒ Object
76 77 78 79 80 81 82 |
# File 'lib/capistrano/application.rb', line 76 def exit_because_of_exception(ex) if respond_to?(:deploying?) && exit_deploy_because_of_exception(ex) else super end end |
#handle_options ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/capistrano/application.rb', line 27 def .rakelib = ['rakelib'] .trace_output = $stderr OptionParser.new do |opts| opts. = "See full documentation at http://capistranorb.com/." opts.separator "" opts.separator "Install capistrano in a project:" opts.separator " bundle exec cap install [STAGES=qa,staging,production,...]" opts.separator "" opts.separator "Show available tasks:" opts.separator " bundle exec cap -T" opts.separator "" opts.separator "Invoke (or simulate invoking) a task:" opts.separator " bundle exec cap [--dry-run] STAGE TASK" opts.separator "" opts.separator "Advanced options:" opts.on_tail("-h", "--help", "-H", "Display this help message.") do puts opts exit end .each { |args| opts.on(*args) } opts.environment('RAKEOPT') end.parse! end |
#name ⇒ Object
9 10 11 |
# File 'lib/capistrano/application.rb', line 9 def name "cap" end |
#run ⇒ Object
13 14 15 16 |
# File 'lib/capistrano/application.rb', line 13 def run Rake.application = self super end |
#sort_options(options) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/capistrano/application.rb', line 18 def () not_applicable_to_capistrano = %w(quiet silent verbose) .reject! do |(switch, *)| switch =~ /--#{Regexp.union(not_applicable_to_capistrano)}/ end super.push(version, dry_run, roles, hostfilter) end |
#top_level_tasks ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/capistrano/application.rb', line 56 def top_level_tasks if tasks_without_stage_dependency.include?(@top_level_tasks.first) @top_level_tasks else @top_level_tasks.unshift(ensure_stage.to_s) end end |