jugyo/rails-erb-check — Issue #1: put rescue in rails-erb-check-0.1.0/bin/rails-erb-check
Author: rubyconvict
Created: 2011-11-18 14:30:50+00:00
State: open

Hi, I have projects with different dir structures and I want to auto-run the script many times from another script on all directories with erb files, but when I run rails-erb-check app/**/**/**/**/*.erb I get rails-erb-check:6:in `read': No such file or directory - app/**/**/**/**/*.erb (Errno::ENOENT), if you rescue that read error we could add a default bunch of patchs for out projects instead of specifying only valid paths. Please try something like this: (note: the editor removed my asterisks in paths, but you get the idea)

#!/usr/bin/env ruby
$:.unshift(File.expand_path('../../lib', __FILE__)) if $0 == __FILE__
require 'rails-erb-check'

ARGV.each do |filepath|
begin
if RailsErbCheck.valid_syntax?(File.read(filepath))
puts "#{filepath}\e[34m => \e[32mvalid\e[0m"
else
puts "#{filepath}\e[34m => \e[31minvalid\e[0m"
end
rescue Errno::ENOENT
nil
end
end