class IOSIconGenerator::CLI::Commands::Stub
Public Instance Methods
call(text:, xcasset_folder:, type:, **options)
click to toggle source
# File lib/ios_icon_generator/cli/commands/stub.rb, line 44 def call(text:, xcasset_folder:, type:, **options) types = type.map(&:to_sym) progress_bar = ProgressBar.create(total: nil) parallel_processes = options.fetch(:parallel_processes).to_i parallel_processes = nil if parallel_processes == -1 Helpers.generate_icon( icon_path: nil, output_folder: xcasset_folder, types: types, parallel_processes: parallel_processes, generate_icon: lambda do |_base_path, target_path, width, height| system( 'magick', '-size', "#{width}x#{height}", "xc:#{options.fetch(:background_color)}", '-strokewidth', (options.fetch(:stroke_width_offset).to_f * [width, height].min).to_s, '-stroke', (options.fetch(:stroke_width_offset).to_f.zero? ? 'none' : options.fetch(:stroke_color)).to_s, '-fill', options.fetch(:symbol_color), '-gravity', 'center', '-font', options.fetch(:font), '-pointsize', (height * options.fetch(:size_offset).to_f).to_s, '-annotate', "+#{width * options.fetch(:x_offset).to_f}+#{height * -options.fetch(:y_offset).to_f}", text, target_path ) end, progress: lambda do |progress, total| progress_bar.total = total unless progress_bar.total progress_bar.increment if progress end ) puts 'Completed!'.green end