Class: Baptize::Application
- Inherits:
-
Rake::Application
- Object
- Rake::Application
- Baptize::Application
- Defined in:
- lib/baptize/application.rb
Instance Method Summary collapse
- #display_error_message(ex) ⇒ Object
- #handle_options ⇒ Object
-
#initialize ⇒ Application
constructor
A new instance of Application.
- #name ⇒ Object
- #sort_options(options) ⇒ Object
Constructor Details
#initialize ⇒ Application
Returns a new instance of Application.
4 5 6 7 8 9 |
# File 'lib/baptize/application.rb', line 4 def initialize super @rakefiles = %w(bapfile Bapfile bapfile.rb Bapfile.rb) Rake.application = self require 'baptize/rake' end |
Instance Method Details
#display_error_message(ex) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/baptize/application.rb', line 45 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 |
#handle_options ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/baptize/application.rb', line 19 def .rakelib = ['rakelib'] .trace_output = $stderr OptionParser.new do |opts| opts. = "Baptize prepares your servers" opts.separator "" opts.separator "Show available tasks:" opts.separator " bundle exec baptize -T" opts.separator "" opts.separator "Invoke (or simulate invoking) a task:" opts.separator " bundle exec baptize [--dry-run] 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
11 12 13 |
# File 'lib/baptize/application.rb', line 11 def name "baptize" end |
#sort_options(options) ⇒ Object
15 16 17 |
# File 'lib/baptize/application.rb', line 15 def () super.push(version, dry_run, roles, hostfilter) end |