Module: Borg::CLI::Applications

Included in:
Borg::CLI
Defined in:
lib/borg/cli/applications.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

:nodoc:



4
5
6
7
# File 'lib/borg/cli/applications.rb', line 4

def self.included(base) #:nodoc:
  base.send :alias_method, :execute_requested_actions_without_applications, :execute_requested_actions
  base.send :alias_method, :execute_requested_actions, :execute_requested_actions_with_applications
end

Instance Method Details

#execute_requested_actions_with_applications(config) ⇒ Object

TODO: documentation for ‘options`, where does it come from?



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/borg/cli/applications.rb', line 10

def execute_requested_actions_with_applications(config)
  load_applications(config)
  separate_actions_and_applications(config)
  if options[:applications].empty? or Thread.current[:borg_application]
    Thread.current[:borg_application].load_into config if Thread.current[:borg_application]
    execute_requested_actions_without_applications(config)
  else
    options[:applications].each do |app|
      puts "Executing commands in context of #{app.name}"
      Thread.current[:borg_application] = app
      execute!
    end
  end
end