class SparkleAppcast::Appcast

Constants

PARAMS_EXCLUDED_FROM_TEMPLATE

Attributes

archive[R]
params[R]
release_note[R]
signer[R]
url[R]

Public Class Methods

new(archive, signer, url, release_note, params = {}) click to toggle source
# File lib/sparkle_appcast/appcast.rb, line 7
def initialize(archive, signer, url, release_note, params = {})
  @archive = archive
  @signer = signer
  @url = url
  @release_note = release_note
  @params = params
end

Public Instance Methods

rss() click to toggle source
# File lib/sparkle_appcast/appcast.rb, line 15
def rss
  Rss.new(rss_params)
end

Private Instance Methods

base_params() click to toggle source
# File lib/sparkle_appcast/appcast.rb, line 40
def base_params
  {
    # channel
    channel_link: "{{feed_url}}",

    # item
    description: release_note.html(context),
    publish_date: archive.created_at,

    # enclosure
    url: url,
    length: archive.size,
    version: "{{bundle_version}}",
    short_version_string: "{{bundle_short_version_string}}",
    minimum_system_version: "{{minimum_system_version}}",
    dsa_signature: dsa_signature
  }.merge(params)
end
context() click to toggle source
# File lib/sparkle_appcast/appcast.rb, line 63
def context
  @context ||= archive.bundle_info
end
dsa_signature() click to toggle source
# File lib/sparkle_appcast/appcast.rb, line 59
def dsa_signature
  @dsa_signature ||= signer.sign(archive.data)
end
rss_params() click to toggle source
# File lib/sparkle_appcast/appcast.rb, line 27
def rss_params
  @rss_params ||= base_params.inject({}) do |params, (key, value)|
    unless PARAMS_EXCLUDED_FROM_TEMPLATE.include?(key)
      case value
      when String
        value = Mustache.render(value, context)
      end
    end
    params[key] = value
    params
  end
end