Module: Distribution
- Defined in:
- lib/autosparkle/distribution.rb
Overview
Distribution module to sign the update and upload it to the server
Class Method Summary collapse
- .sign_update(pkg_path) ⇒ Object
- .upload_update(pkg_path) ⇒ Object
- .upload_update_to_server(pkg_path, appcast_xml) ⇒ Object
Class Method Details
.sign_update(pkg_path) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/autosparkle/distribution.rb', line 26 def self.sign_update(pkg_path) puts_if_verbose 'Signing the update...' sign_update_path = File.join(__dir__, 'sparkle', 'sign_update') sign_command = "echo \"#{Env.variables.sparkle_private_key}\" | " sign_command += "#{sign_update_path} \"#{pkg_path}\" --ed-key-file -" execute_command(sign_command, contains_sensitive_data: true) end |
.upload_update(pkg_path) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/autosparkle/distribution.rb', line 13 def self.upload_update(pkg_path) puts_title 'Uploading the update to the server' ed_signature_fragment = sign_update(pkg_path) appcast_xml = AppcastXML.generate_appcast_xml(ed_signature_fragment, Env.storage.deployed_appcast_xml) upload_update_to_server(pkg_path, appcast_xml) app_display_name = Env.variables.app_display_name version = Env.variables.marketing_version build_version = Env.variables.current_project_version puts "#{app_display_name} version #{version} (#{build_version}) has been uploaded successfully. ✅ 🚀".green end |
.upload_update_to_server(pkg_path, appcast_xml) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/autosparkle/distribution.rb', line 34 def self.upload_update_to_server(pkg_path, appcast_xml) puts_if_verbose 'Uploading the update to the server...' appcast_file = BuildDirectory.new_file('appcast.xml') appcast_file.write(appcast_xml) appcast_file.close Env.storage.upload(pkg_path, appcast_file.path) end |