Class: SiteFuel::External::JPEGTran

Inherits:
AbstractExternalProgram show all
Defined in:
lib/sitefuel/external/JPEGTran.rb

Constant Summary

Constant Summary

Constants inherited from AbstractExternalProgram

AbstractExternalProgram::VERSION_SEPARATOR

Instance Attribute Summary

Attributes inherited from AbstractExternalProgram

#options

Class Method Summary (collapse)

Methods inherited from AbstractExternalProgram

#add_option, allowed_option_name?, #apply_value, #build_command_line, call_option, capture_output, compatible_version?, compatible_version_number?, create_tmp_directory, #ensure_option_validity, ensure_valid_option, excluded_option_names, #execute, execute, extract_program_version, #has_default?, #initialize, option, option?, option_default, option_template, #option_template, options, organize_options, output_handling, program_binary, program_found?, program_version, random_string, #requires_value?, #takes_value?, #valid_option?, verify_compatible_version, verify_program_exists, version_older?

Methods included from Logging

#debug, #error, #fatal, #info, #logger=, #warn

Constructor Details

This class inherits a constructor from SiteFuel::External::AbstractExternalProgram

Class Method Details

+ (Object) capture_stderr

since jpegtran by default writes jpeg files to stdout it's a little obsessed about writing everything that isn't a jpeg to stderr.

this is to circumvent that.



33
34
35
# File 'lib/sitefuel/external/JPEGTran.rb', line 33

def self.capture_stderr
  true
end

+ (Object) compatible_versions

the versioning scheme for jpegtran is a little weir and not all versions of jpegtran actually give a version number. So the best we can do is check if the program exists and hope for the best.



24
25
26
# File 'lib/sitefuel/external/JPEGTran.rb', line 24

def self.compatible_versions
  ['6']
end

+ (Object) compress_losslessly(in_file, out_file)



57
58
59
60
61
62
63
# File 'lib/sitefuel/external/JPEGTran.rb', line 57

def self.compress_losslessly(in_file, out_file)
  self.execute :copy,
               :optimize,
               :perfect,
               :output, out_file,
               :input, in_file
end

+ (Object) option_version

this rarely actually gives the option...



43
44
45
# File 'lib/sitefuel/external/JPEGTran.rb', line 43

def self.option_version
  '--help'
end

+ (Object) program_name



17
18
19
# File 'lib/sitefuel/external/JPEGTran.rb', line 17

def self.program_name
  'jpegtran'
end

+ (Object) test_version_number(compatible, version_number)

if the program exists... hope for the best.



38
39
40
# File 'lib/sitefuel/external/JPEGTran.rb', line 38

def self.test_version_number(compatible, version_number)
  true
end