Class: GemsSnapshot::Exporter

Inherits:
Object
  • Object
show all
Defined in:
lib/gems_snapshot/exporter.rb

Class Method Summary collapse

Class Method Details

.export(filename, options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/gems_snapshot/exporter.rb', line 21

def self.export(filename, options = {})
  options = {:format => :tar}.merge(options)
  format = options.delete(:format)

  begin
    exporter = GemsSnapshot.const_get("#{format.to_s.capitalize}Exporter").send(:new)
    result = exporter.export(filename)
  rescue => ex
    raise Gem::Exception, "Ops! An unexpected error occurred: #{ex.message}"
  end

  result
end