Help me to improve the code

Hi guys
I’m working on a utility which is executable from the command line (i.e.: ‘ruby ./app.rb’).
With no parameters, the utility should default to scanning from the current directory.
or It can take an optional parameter that allows any other directory to be passed in.
user can pass parameter as output either CSV or HTML,CSV is default.
app should recursively reads all of the images from the supplied directory of images, extracts their EXIF GPS data (longitude and latitude), and then writes the name of that image and any GPS co-ordinates it finds
I wrote this now i need someone to help me to improve it

require 'exifr/jpeg'
require 'csv'
require 'optparse'
require 'ostruct'
require 'pp'
require 'builder'
require "crafty"

include Crafty::HTML::Basic
$fileList = []
def self.headers
  ['Name', 'Path', 'Latitude', 'Longitude']
end

def self.parse(args)
  options = OpenStruct.new
  options.result_type = :csv
  opt_parser = OptionParser.new do |opts|
    opts.banner = "Usage: app.rb [options]"
    opts.separator ""
    opts.separator "Specific options:"

    opts.on("-p", "--path PATH", "The Path of Image files to executing.") do |v|
      options.path = v
    end

    opts.on("--type [TYPE]", [:csv, :html],
              "Select result type (csv ->Defult, html)") do |t|
        options.result_type = t
    end

    opts.separator ""
    opts.separator "Common options:"

    opts.on_tail("-h", "--help", "Show this message") do
      puts opts
      exit
    end

  end

  opt_parser.parse!(args)
  options
end

def self.generateCsvFile
  CSV.open("result.csv", "w") do |csv|
     $fileList.each do |file|
        next if File.directory? file
        fileExif = EXIFR::JPEG.new(file)
        fileName = File.basename file
        csv << headers if csv.lineno.eql? 0
        csv << [fileName , file] if fileExif.gps.nil?
        csv << [fileName, file , fileExif.exif.gps.latitude , fileExif.exif.gps.longitude] if !fileExif.gps.nil?
     end
  end
end

def self.generateHtmlFile
  pp generateHtml
  File.open('result.html', 'w') do |file|
    file.write(generateHtml)
  end
end

def generateHtml
  table do
    tr do
      headers.each do |header|
        th header
      end
    end
      $fileList.each do |file|
        tr do
          next if File.directory? file
          fileExif = EXIFR::JPEG.new(file)
          fileName = File.basename file
          td fileName
          td file
          td fileExif.exif.gps.latitude if !fileExif.gps.nil?
          td fileExif.exif.gps.longitude if !fileExif.gps.nil?
        end
      end
  end
end

options = parse(ARGV)
librbfiles = options.path.nil? ?  File.join("**", "*.jpg") : File.join(options.path,"**", "*.jpg")
$fileList = Dir.glob(librbfiles)
pp options.result_type

case options.result_type
  when :csv
    generateCsvFile
  else
    generateHtmlFile
end