module Fastlane::PageGenerator

Constants

PLACEHOLDER_URL

Public Class Methods

installation_page(config) click to toggle source
# File lib/fastlane/plugin/polidea/helper/page_generator.rb, line 30
def self.installation_page(config)
  UI.message("Generating public installation page...")
  eth = Fastlane::ErbTemplateHelper
  html_template = eth.load_from_path(
    File.expand_path("templates/install.erb", Polidea.root)
  )
  eth.render(html_template, {
    url: config[:url],
    app_version: config[:app_version],
    build_number: config[:build_number],
    app_name: config[:app_name],
    app_icon: app_icon_or_placholder(config[:app_icon]),
    release_notes: parse_release_notes(config[:release_notes])
  })
end
mail(config) click to toggle source
# File lib/fastlane/plugin/polidea/helper/page_generator.rb, line 7
def self.mail(config)
  UI.message("Generating e-mail...")
  eth = Fastlane::ErbTemplateHelper
  html_template = eth.load_from_path(
    File.expand_path("templates/mail.erb", Polidea.root)
  )
  eth.render(html_template, {
    author: config[:author],
    last_commit: config[:last_commit],
    is_android: config[:is_android],
    app_icon: mail_app_icon_or_placholder(config[:app_icon]),
    app_name: config[:app_name],
    app_version: config[:app_version],
    build_number: config[:build_number],
    installation_link: config[:installation_link],
    release_notes: parse_release_notes(config[:release_notes]),
    platform: config[:platform],
    release_date: config[:release_date],
    binary_size: config[:binary_size],
    qr_code: "cid:#{config[:qr_code]}"
  })
end

Private Class Methods

app_icon_or_placholder(app_icon) click to toggle source
# File lib/fastlane/plugin/polidea/helper/page_generator.rb, line 70
def self.app_icon_or_placholder(app_icon)
  if app_icon.nil?
    PLACEHOLDER_URL
  else
    app_icon
  end
end
mail_app_icon_or_placholder(app_icon) click to toggle source
# File lib/fastlane/plugin/polidea/helper/page_generator.rb, line 61
def self.mail_app_icon_or_placholder(app_icon)
  if app_icon.nil?
    PLACEHOLDER_URL
  else
    "cid:#{app_icon}"
  end
end
parse_release_notes(release_notes) click to toggle source
# File lib/fastlane/plugin/polidea/helper/page_generator.rb, line 46
def self.parse_release_notes(release_notes)
  renderer = Redcarpet::Render::HTML.new({
    filter_html: true,
    no_styles: true
  })
  markdown = Redcarpet::Markdown.new(
    renderer,
    fenced_code_blocks: true,
    autolink: false,
    tables: false
  )
  markdown.render(release_notes || "No release notes.")
end