class IconBanner::IconBanner
Public Class Methods
available_options()
click to toggle source
# File lib/icon_banner.rb, line 60 def self.available_options [ FastlaneCore::ConfigItem.new(key: :label, description: 'Sets the text to display inside the banner', default_value: 'BETA', optional: true), FastlaneCore::ConfigItem.new(key: :color, description: 'Sets the text color (when not set, the script uses the dominant icon color)', optional: true), FastlaneCore::ConfigItem.new(key: :font, description: 'Sets the text font with a _direct link_ to a TTF file (when not set, the script uses the embedded LilitaOne font)', optional: true), FastlaneCore::ConfigItem.new(key: :backup, description: 'Creates a backup of icons before applying banners (only set to `false` if you are under source-control)', is_string: false, default_value: true, optional: true), FastlaneCore::ConfigItem.new(key: :platform, description: 'Selects the platform to process (`ios`, `android` or `all`). Auto-inferred by lane if available', default_value: 'all', optional: true) ] end
base_path()
click to toggle source
# File lib/icon_banner.rb, line 96 def self.base_path File.dirname __dir__ + '/../../' end
font_path()
click to toggle source
# File lib/icon_banner.rb, line 100 def self.font_path File.join base_path, 'assets', 'LilitaOne.ttf' end
generate(path, options)
click to toggle source
# File lib/icon_banner.rb, line 50 def self.generate(path, options) AppIconSet.new.generate(path, options) IcLauncher.new.generate(path, options) end
restore(path)
click to toggle source
# File lib/icon_banner.rb, line 55 def self.restore(path) AppIconSet.new.restore(path) IcLauncher.new.restore(path) end
start()
click to toggle source
# File lib/icon_banner.rb, line 14 def self.start self.new.run end
validate_libs!()
click to toggle source
# File lib/icon_banner.rb, line 88 def self.validate_libs! begin UI.error('ImageMagick was not found on your system. To install it, run the following command:') UI.command('brew install imagemagick') UI.user_error!('IconBanner is missing requirements.') end unless `which convert`.include?('convert') end
Public Instance Methods
run()
click to toggle source
# File lib/icon_banner.rb, line 18 def run program :name, 'IconBanner' program :version, VERSION program :description, DESCRIPTION global_option('--verbose', 'Shows a more verbose output') { FastlaneCore::Globals.verbose = true } command :generate do |c| c.syntax = 'icon-banner generate [path] [options]' c.description = 'Generates banners and adds them to app icons' FastlaneCore::CommanderGenerator.new.generate(IconBanner::available_options, command: c) c.action do |args, options| path = args[0] || '.' options = FastlaneCore::Configuration.create(IconBanner::available_options, options.__hash__) IconBanner.generate(path, options) end end command :restore do |c| c.syntax = 'icon-banner restore [path]' c.description = 'Restores app icons without banners (if backups are available)' c.action do |args| path = args[0] || '.' IconBanner.restore(path) end end run! end