class Fastlane::Actions::BrandingAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/branding/actions/branding_action.rb, line 22
def self.authors
  ["Stefan Natchev"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/branding/actions/branding_action.rb, line 26
def self.available_options
  [
    # FastlaneCore::ConfigItem.new(key: :your_option,
    #                         env_name: "BRANDING_YOUR_OPTION",
    #                      description: "A description of your option",
    #                         optional: false,
    #                             type: String)
  ]
end
best_icon(ideal_width) click to toggle source
# File lib/fastlane/plugin/branding/actions/branding_action.rb, line 42
def self.best_icon(ideal_width)
  icon_paths = Dir.glob("**/AppIcon.appiconset/*.png").map(&File.method(:realpath))

  paths = icon_paths.sort_by do |path|
    png = ::Branding::PNG.from_file(path)
    (ideal_width - png.width).abs
  end

  if paths.empty?
    nil
  else
    paths.first
  end
end
description() click to toggle source
# File lib/fastlane/plugin/branding/actions/branding_action.rb, line 18
def self.description
  "Add some branding to your fastlane output"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/branding/actions/branding_action.rb, line 36
def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
  [:ios, :mac].include?(platform)
end
run(params) click to toggle source
# File lib/fastlane/plugin/branding/actions/branding_action.rb, line 6
def self.run(params)
  rows, cols = ::Branding::Canvas.terminal_size
  ideal_width = cols / 3

  if path = best_icon(ideal_width)
    logo = ::Branding::Logo.new(path)
    logo.algo = :normal
    logo.print
    puts
  end
end