[Haml] [html2haml] Properly report errors loading the Erubis and ruby_parser dependencies for processing ERB.
This commit is contained in:
parent
57303f1c5e
commit
a28e694154
|
@ -362,17 +362,7 @@ END
|
||||||
# @param args [Array<String>] The command-line arguments
|
# @param args [Array<String>] The command-line arguments
|
||||||
def initialize(args)
|
def initialize(args)
|
||||||
super
|
super
|
||||||
|
|
||||||
@module_opts = {}
|
@module_opts = {}
|
||||||
|
|
||||||
begin
|
|
||||||
require 'haml/html'
|
|
||||||
rescue LoadError => err
|
|
||||||
dep = err.message.scan(/^no such file to load -- (.*)/)[0]
|
|
||||||
raise err if @options[:trace] || dep.nil? || dep.empty?
|
|
||||||
$stderr.puts "Required dependency #{dep} not found!\n Use --trace for backtrace."
|
|
||||||
exit 1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tells optparse how to parse the arguments.
|
# Tells optparse how to parse the arguments.
|
||||||
|
@ -415,6 +405,8 @@ END
|
||||||
def process_result
|
def process_result
|
||||||
super
|
super
|
||||||
|
|
||||||
|
require 'haml/html'
|
||||||
|
|
||||||
input = @options[:input]
|
input = @options[:input]
|
||||||
output = @options[:output]
|
output = @options[:output]
|
||||||
|
|
||||||
|
@ -425,6 +417,11 @@ END
|
||||||
rescue ::Haml::Error => e
|
rescue ::Haml::Error => e
|
||||||
raise "#{e.is_a?(::Haml::SyntaxError) ? "Syntax error" : "Error"} on line " +
|
raise "#{e.is_a?(::Haml::SyntaxError) ? "Syntax error" : "Error"} on line " +
|
||||||
"#{get_line e}: #{e.message}"
|
"#{get_line e}: #{e.message}"
|
||||||
|
rescue LoadError => err
|
||||||
|
dep = err.message.scan(/^no such file to load -- (.*)/)[0]
|
||||||
|
raise err if @options[:trace] || dep.nil? || dep.empty?
|
||||||
|
$stderr.puts "Required dependency #{dep} not found!\n Use --trace for backtrace."
|
||||||
|
exit 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -433,10 +430,7 @@ END
|
||||||
# @param args [Array<String>] The command-line arguments
|
# @param args [Array<String>] The command-line arguments
|
||||||
def initialize(args)
|
def initialize(args)
|
||||||
super
|
super
|
||||||
|
|
||||||
@module_opts = {}
|
@module_opts = {}
|
||||||
|
|
||||||
require 'sass/css'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Tells optparse how to parse the arguments.
|
# Tells optparse how to parse the arguments.
|
||||||
|
@ -465,6 +459,8 @@ END
|
||||||
def process_result
|
def process_result
|
||||||
super
|
super
|
||||||
|
|
||||||
|
require 'sass/css'
|
||||||
|
|
||||||
input = @options[:input]
|
input = @options[:input]
|
||||||
output = @options[:output]
|
output = @options[:output]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue