class IOSIconGenerator::CLI::Commands::Build::Icon

Public Instance Methods

call(appiconset_path:, output_path:, **options) click to toggle source
# File lib/ios_icon_generator/cli/commands/mask.rb, line 51
def call(appiconset_path:, output_path:, **options)
  raise 'There is no App icon set at the path specified.' unless Dir.exist?(appiconset_path)

  progress_bar = ProgressBar.create(total: nil)
  parallel_processes = options.fetch(:parallel_processes).to_i
  parallel_processes = nil if parallel_processes == -1
  Helpers.mask_icon(
    appiconset_path: appiconset_path,
    output_folder: output_path,
    mask: {
      background_color: options.fetch(:background_color),
      stroke_color: options.fetch(:stroke_color),
      stroke_width_offset: options.fetch(:stroke_width_offset)&.to_f,
      suffix: options.fetch(:suffix),
      symbol: options.fetch(:symbol),
      symbol_color: options.fetch(:symbol_color),
      font: options.fetch(:font),
      file: options[:file],
      x_size_ratio: options.fetch(:x_size_ratio)&.to_f,
      y_size_ratio: options.fetch(:y_size_ratio)&.to_f,
      size_offset: options.fetch(:size_offset)&.to_f,
      x_offset: options.fetch(:x_offset)&.to_f,
      y_offset: options.fetch(:y_offset)&.to_f,
      shape: options.fetch(:mask_shape)&.to_sym,
    },
    parallel_processes: parallel_processes,
    progress: lambda do |progress, total|
      progress_bar.total = total unless progress_bar.total
      progress_bar.increment if progress
    end
  )
  puts 'Completed!'.green
end