lib/barista.rb in barista-1.0.0 vs lib/barista.rb in barista-1.1.0.pre1
- old
+ new
@@ -31,46 +31,46 @@
# For a full list of hooks, see the readme.
def hooks
@hooks ||= Hooks.new
end
-
+
def on_hook(name, *args, &blk)
hooks.on(name, *args, &blk)
end
-
+
def invoke_hook(name, *args)
hooks.invoke(name, *args)
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
+
+ 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_deprecated_methods :compiler, :compiler=, :compiler_klass, :compiler_klass=
-
+
def configure
yield self if block_given?
end
-
+
def env
@env ||= default_for_env
end
def env=(value)
@env = value.to_s.strip
@env = nil if @env == ''
end
-
+
def logger
@logger ||= default_for_logger
end
def logger=(value)
@@ -158,15 +158,20 @@
end
def default_for_exception_on_error
true
end
-
+
def default_for_embedded_interpreter
- local_env?
+ false
end
+ def default_for_auto_compile
+ true
+ end
+
+
# Actual tasks on the barista module.
def compile_file!(file, force = false, silence_error = false)
Compiler.autocompile_file file, force, silence_error
end
@@ -181,11 +186,11 @@
true
end
def change_output_prefix!(framework, prefix = nil)
framework = Barista::Framework[framework] unless framework.is_a?(Barista::Framework)
- framework.output_prefix = prefix if framework.present?
+ framework.output_prefix = prefix if framework
end
def each_framework(include_default = false, &blk)
Framework.all(include_default).each(&blk)
end
@@ -193,19 +198,19 @@
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}"
+ logger.debug "[Barista] #{message}" if logger
end
-
+
def setup_defaults
Barista::HamlFilter.setup
Barista::Compiler.setup_default_error_logger
end
end
-
+
# Setup integration by default.
Integration.setup
end