Class: Chef::Deployment::Monitor::MarkerFileSink

Inherits:
Sink
  • Object
show all
Defined in:
lib/chef_deployment_monitor/sinks.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(outfile) ⇒ MarkerFileSink

Returns a new instance of MarkerFileSink.



14
15
16
# File 'lib/chef_deployment_monitor/sinks.rb', line 14

def initialize(outfile)
  @file    = outfile
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



12
13
14
# File 'lib/chef_deployment_monitor/sinks.rb', line 12

def file
  @file
end

Instance Method Details

#receive(data) ⇒ Object

will modify the marker file last write data of marker file will be within 5 seconds of last deployement



21
22
23
24
25
# File 'lib/chef_deployment_monitor/sinks.rb', line 21

def receive(data)
  File.open(file, 'w+') do |f|
    f.write(data.to_json)
  end
end