Improve the output of RailsInspect::Cli
Give the developer some direction on how to resolve the error so they don't need to read the code to figure it out.
This commit is contained in:
parent
979c6b0366
commit
010600d3fe
@ -25,7 +25,7 @@ def configuration(rails_path)
|
||||
checker = Configuring.new(rails_path)
|
||||
checker.check
|
||||
|
||||
puts checker.errors unless checker.errors.empty?
|
||||
puts checker.error_message if checker.errors.any?
|
||||
exit checker.errors.empty? unless options[:autocorrect]
|
||||
|
||||
checker.write!
|
||||
|
@ -83,6 +83,14 @@ def write!
|
||||
File.write(doc_path, doc.to_s)
|
||||
end
|
||||
|
||||
def error_message
|
||||
return unless errors.any?
|
||||
|
||||
errors.join("\n") + "\n" +
|
||||
"Make sure new configurations are added to configuring.md#rails-general-configuration in alphabetical order.\n" +
|
||||
"Errors may be autocorrectable with the --autocorrect flag"
|
||||
end
|
||||
|
||||
private
|
||||
def doc_path
|
||||
@rails_path.join(DOC_PATH)
|
||||
|
Loading…
Reference in New Issue
Block a user