def fetch_guardfile_contents
if @@options[:guardfile_contents]
UI.info 'Using inline Guardfile.'
@@options[:guardfile_path] = 'Inline Guardfile'
elsif @@options[:guardfile]
if File.exist?(@@options[:guardfile])
read_guardfile(@@options[:guardfile])
UI.info "Using Guardfile at #{ @@options[:guardfile] }."
else
UI.error "No Guardfile exists at #{ @@options[:guardfile] }."
exit 1
end
else
if File.exist?(guardfile_default_path)
read_guardfile(guardfile_default_path)
else
UI.error 'No Guardfile found, please create one with `guard init`.'
exit 1
end
end
unless guardfile_contents_usable?
UI.error "The command file(#{ @@options[:guardfile] }) seems to be empty."
exit 1
end
end