Method: Inspec::Runner#write_lockfile

Defined in:
lib/inspec/runner.rb

#write_lockfile(profile) ⇒ Object



180
181
182
183
184
185
186
187
188
189
190
# File 'lib/inspec/runner.rb', line 180

def write_lockfile(profile)
  return false unless profile.writable?

  if profile.lockfile_exists?
    Inspec::Log.debug "Using existing lockfile #{profile.lockfile_path}"
  else
    Inspec::Log.debug "Creating lockfile: #{profile.lockfile_path}"
    lockfile = profile.generate_lockfile
    File.write(profile.lockfile_path, lockfile.to_yaml)
  end
end