Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Fix #12, use ruby standard library to check if executable exists
Browse files Browse the repository at this point in the history
  • Loading branch information
mrowa44 committed Jul 14, 2015
1 parent 8560a9d commit fc2699c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/erb2haml/railties/erb2haml.rake
@@ -1,4 +1,5 @@
require 'find'
require 'mkmf'

RED_FG ="\033[31m"
GREEN_FG = "\033[32m"
Expand All @@ -13,7 +14,7 @@ namespace :haml do
desc "Perform bulk conversion of all html.erb files to Haml in views folder."
task :convert_erbs do

if `which html2haml`.empty?
unless find_executable('html2haml')
puts "#{color "ERROR: ", RED_FG} Could not find " +
"#{color "html2haml", GREEN_FG} in your PATH. Aborting."
exit(false)
Expand Down Expand Up @@ -41,7 +42,7 @@ namespace :haml do

desc "Perform bulk conversion of all html.erb files to Haml in views folder, then remove the converted html.erb files."
task :replace_erbs do
if `which html2haml`.empty?
unless find_executable('html2haml')
puts "#{color "ERROR: ", RED_FG} Could not find " +
"#{color "html2haml", GREEN_FG} in your PATH. Aborting."
exit(false)
Expand Down

0 comments on commit fc2699c

Please sign in to comment.