class LicenseAcceptance::Strategy::File
def persist_license(folder_path, product, parent, parent_version)
def persist_license(folder_path, product, parent, parent_version) path = ::File.join(folder_path, product.filename) logger.info("Persisting a license for #{product.pretty_name} at path #{path}") ::File.open(path, ::File::WRONLY | ::File::CREAT | ::File::EXCL) do |license_file| contents = { id: product.id, name: product.pretty_name, date_accepted: INVOCATION_TIME.iso8601, accepting_product: parent.id, accepting_product_version: parent_version, user: Etc.getlogin, file_format: 1, } contents = Hash[contents.map { |k, v| [k.to_s, v] }] license_file << YAML.dump(contents) end nil rescue StandardError => e msg = "Could not persist license to #{path}" logger.info "#{msg}\n\t#{e.message}\n\t#{e.backtrace.join("\n\t")}" e end