lib/barista.rb in barista-1.2.1 vs lib/barista.rb in barista-1.3.0

- old
+ new

@@ -44,26 +44,40 @@ end def invoke_hook(name, *args) hooks.invoke(name, *args) end + + def has_hook?(name) + hooks.has_hook?(name) + end has_hook_method :on_compilation_error => :compilation_failed, :on_compilation => :compiled, :on_compilation_complete => :all_compiled, :on_compilation_with_warning => :compiled_with_warning, :before_full_compilation => :before_full_compilation, :before_compilation => :before_compilation - # Configuration - Tweak how you use Barista. has_boolean_options :verbose, :bare, :add_filter, :add_preamble, :exception_on_error, :embedded_interpreter, :auto_compile has_delegate_methods Compiler, :bin_path, :bin_path=, :js_path, :js_path= has_delegate_methods Framework, :register has_deprecated_methods :compiler, :compiler=, :compiler_klass, :compiler_klass= + def add_preamble(&blk) + self.add_preamble = true + if block_given? + @preamble = blk + end + end + + def preamble + @preamble + end + def configure yield self if block_given? end def env @@ -157,14 +171,10 @@ def default_for_add_filter local_env? end - def default_for_add_preamble - local_env? - end - def default_for_exception_on_error true end def default_for_embedded_interpreter @@ -213,10 +223,10 @@ def output_path_for(file) output_root.join(file.to_s.gsub(/^\/+/, '')).to_s.gsub(/\.coffee$/, '.js') end def debug(message) - logger.debug "[Barista] #{message}" if logger + logger.debug "[Barista] #{message}" if logger && verbose? end def setup_defaults Barista::HamlFilter.setup Barista::Compiler.setup_default_error_logger