Module: FaviconMaker::BaseCommand
- Included in:
- IcoCommand, PngCommand
- Defined in:
- lib/favicon_maker/commands/base_command.rb
Instance Method Summary collapse
- #compose(template_file_path, output_file_path, convert_settings, options, format, &block) ⇒ Object
- #on_windows? ⇒ Boolean
- #options_to_args(options) ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#compose(template_file_path, output_file_path, convert_settings, options, format, &block) ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/favicon_maker/commands/base_command.rb', line 4 def compose(template_file_path, output_file_path, convert_settings, , format, &block) ico_cmd = [ "convert -background none #{}".strip ] ico_cmd += [ "\"#{template_file_path}\" #{(convert_settings)}" ] ico_cmd += yield([]) if block_given? ico_cmd += [ " #{format}:\"#{output_file_path}\"" ] @command = ico_cmd.join(' ') end |
#on_windows? ⇒ Boolean
23 24 25 |
# File 'lib/favicon_maker/commands/base_command.rb', line 23 def on_windows? (RbConfig::CONFIG['host_os'].match /mswin|mingw|cygwin/) end |
#options_to_args(options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/favicon_maker/commands/base_command.rb', line 12 def () return nil if .nil? .map { |k,v| if [ :xc, :null ].include?(k) "#{k}:#{v}" else "-#{k} #{v}".strip end }.join(' ') end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/favicon_maker/commands/base_command.rb', line 27 def to_s @command end |