Attempt to require the custom export class.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -51,7 +51,7 @@ describe "Foreman::CLI", :fakefs do
|
||||
|
||||
describe "with an invalid formatter" do
|
||||
it "prints an error" do
|
||||
mock_error(subject, "Unknown export format: invalidformatter.") do
|
||||
mock_error(subject, "Unknown export format: invalidformatter (unable to load file 'foreman/export/invalidformatter').") do
|
||||
subject.export("invalidformatter")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user