19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/mdqt/cli/base.rb', line 19
def self.check_requirements(options)
unless options.service == :not_required
abort "No MDQ service URL has been specified. Please use --service, MDQT_SERVICE or MDQ_BASE_URL" unless service_url(options).to_s.start_with?("http")
end
if options.save_to
dir = options.save_to
begin
FileUtils.mkdir_p(dir) unless File.exist?(dir)
rescue
abort "Error: Directory #{dir} did not exist, and we can't create it"
end
abort "Error: '#{dir}' is not a writable directory!" if (File.directory?(dir) && !File.writable?(dir))
abort "Error: '#{dir}' is not a directory!" unless File.directory?(dir)
end
end
|