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
-
#find_rakefile_location ⇒ Object
allows the ‘cap install` task to load without a capfile.
- #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.
3 4 5 6 |
# File 'lib/capistrano/application.rb', line 3 def initialize super @rakefiles = %w{capfile Capfile capfile.rb Capfile.rb} end |
Instance Method Details
#display_error_message(ex) ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/capistrano/application.rb', line 62 def (ex) unless .backtrace Rake.application..suppress_backtrace_pattern = backtrace_pattern if backtrace_pattern trace "(Backtrace restricted to imported tasks)" end super end |
#exit_because_of_exception(ex) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/capistrano/application.rb', line 71 def exit_because_of_exception(ex) if respond_to?(:deploying?) && exit_deploy_because_of_exception(ex) else super end end |
#find_rakefile_location ⇒ Object
allows the ‘cap install` task to load without a capfile
80 81 82 83 84 85 86 |
# File 'lib/capistrano/application.rb', line 80 def find_rakefile_location if (location = super).nil? [capfile, Dir.pwd] else location end end |
#handle_options ⇒ Object
26 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 |
# File 'lib/capistrano/application.rb', line 26 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
8 9 10 |
# File 'lib/capistrano/application.rb', line 8 def name "cap" end |
#run ⇒ Object
12 13 14 15 |
# File 'lib/capistrano/application.rb', line 12 def run Rake.application = self super end |
#sort_options(options) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/capistrano/application.rb', line 17 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, print_config_variables) end |
#top_level_tasks ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/capistrano/application.rb', line 54 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 |