Module: BaseCommand
- Included in:
- IcoCommand, PngCommand
- Defined in:
- lib/favicon_maker/base_command.rb
Instance Method Summary collapse
- #on_windows? ⇒ Boolean
- #options_to_args(options) ⇒ Object
- #run_convert(template_file_path, output_file_path, convert_settings, options, format, &block) ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#on_windows? ⇒ Boolean
22 23 24 |
# File 'lib/favicon_maker/base_command.rb', line 22 def on_windows? (RbConfig::CONFIG['host_os'].match /mswin|mingw|cygwin/) end |
#options_to_args(options) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/favicon_maker/base_command.rb', line 11 def () return nil if .nil? .map { |k,v| if [ :xc, :null ].include?(k) "#{k}:#{v}" else "-#{k} #{v}".strip end }.join(' ') end |
#run_convert(template_file_path, output_file_path, convert_settings, options, format, &block) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/favicon_maker/base_command.rb', line 3 def run_convert(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 |
#to_s ⇒ Object
26 27 28 |
# File 'lib/favicon_maker/base_command.rb', line 26 def to_s @command end |