Class: VagrantPlugins::ManagedServers::Action::InitDeploymentTracker

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-managed-servers/action/init_deployment_tracker.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, _env) ⇒ InitDeploymentTracker

Returns a new instance of InitDeploymentTracker.



16
17
18
19
# File 'lib/vagrant-managed-servers/action/init_deployment_tracker.rb', line 16

def initialize(app, _env)
  @app    = app
  @logger = Log4r::Logger.new("vagrant_managed_servers::action::init_deployment_tracker")
end

Instance Method Details

#call(env) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/vagrant-managed-servers/action/init_deployment_tracker.rb', line 21

def call(env)
  host = env[:tracker_host]
  return unless host
  SwaggerClient::Swagger.configure do |config|
    config.host = host
  end

  if env[:tracker_logging_enabled]
    ui = env[:ui]
    unless ui.logger.outputters.collect(&:name).include?("deployment-tracker")
      # Make sure that we've hooked the global ui logger as well. We should
      # see if we can do this earlier in the process to capture more of the output
      ui.logger.add Log4r::DeploymentTrackerOutputter.new("deployment-tracker")
    end
  end
  @app.call(env)
end