Attempt to require the custom export class.

This commit is contained in:
Chris Lowder
2012-01-24 14:36:38 +00:00
parent d54b46806c
commit 84c49ae2b8
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -47,10 +47,13 @@ class Foreman::CLI < Thor
check_procfile!
begin
require "foreman/export/#{ format.tr('-', '_') }"
classy_format = classify(format)
formatter = constantize("Foreman::Export::#{ classy_format }")
rescue NameError => ex
error "Unknown export format: #{format} (no class Foreman::Export::#{ classy_format })."
rescue LoadError => ex
error "Unknown export format: #{format} (unable to load file 'foreman/export/#{ format.tr('-', '_') }')."
end
formatter.new(engine, options).export(location)