lib/zammad/szpm.rb
# Creates an ZPM string out of the SZPM file.
#
# @return [String] ZPM JSON content with Base64 encoded files.
Creates an ZPM string out of the SZPM file.
Creates an ZPM string out of the SZPM file .
def zpm
      zpm = parse
      folder = File.dirname(@szpm_file)
      zpm['files'].collect! { |file|
        file_location = file['location']
        file_handle   = File.open("#{folder}/#{file_location}", 'r')
        file_content  = file_handle.read
        file_handle.close
        file['encode']  = 'base64'
        file['content'] = Base64.strict_encode64( file_content )
        file
      }
      JSON.pretty_generate(zpm)
    end
def zpm zpm = parse folder = File . dirname ( @szpm_file ) zpm [ 'files' ] . collect! { | file | file_location = file [ 'location' ] file_handle = File . open ( "#{folder}/#{file_location}" , 'r' ) file_content = file_handle . read file_handle . close file [ 'encode' ] = 'base64' file [ 'content' ] = Base64 . strict_encode64 ( file_content ) file } JSON . pretty_generate ( zpm ) end
Creates an ZPM string out of the SZPM file.
Creates an ZPM string out of the SZPM file .
ZPM JSON content with Base64 encoded files.
ZPM JSON content with Base64 encoded files .
String