Check the result of external `html2haml` command and output a proper message

This commit is contained in:
Akira Matsuda 2022-10-07 11:43:56 +09:00
parent 8bbe246a9c
commit 175d472bea
No known key found for this signature in database
1 changed files with 6 additions and 2 deletions

View File

@ -17,8 +17,12 @@ module Haml
if File.exist?(app_layout_from)
if !File.exist?(app_layout_to)
`html2haml #{app_layout_from.shellescape} #{app_layout_to.shellescape}`
puts "Success! app/views/layouts/application.html.haml is created.\n" \
"Please remove the erb file: app/views/layouts/application.html.erb"
if $?.success?
puts "Success! app/views/layouts/application.html.haml is created.\n" \
"Please remove the erb file: app/views/layouts/application.html.erb"
else
puts "Error! Failed to execute html2haml command."
end
else
puts "Error! There is a file named app/views/layouts/application.html.haml already."
end