lib/barista.rb in barista-1.1.0.pre1 vs lib/barista.rb in barista-1.1.0

- old
+ new

@@ -1,9 +1,14 @@ require 'pathname' - +require 'time' # Required for httpdate require 'coffee_script' +# Setup ExecJS extras if present +if defined?(ExecJS::ExternalRuntime) + ExecJS::ExternalRuntime.send :attr_accessor, :binary +end + module Barista Error = Class.new(StandardError) CompilationError = Class.new(Error) CompilerUnavailableError = Class.new(Error) @@ -52,10 +57,11 @@ # 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 configure yield self if block_given? end @@ -180,16 +186,25 @@ debug "Compiling all coffeescripts" Barista.invoke_hook :before_full_compilation Framework.exposed_coffeescripts.each do |coffeescript| Compiler.autocompile_file coffeescript, force, silence_error end + debug "Copying all javascripts" + Framework.exposed_javascripts.each do |javascript| + Compiler.autocompile_file javascript, force, silence_error + end Barista.invoke_hook :all_compiled 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 + end + + def change_output_root!(framework, root) + framework = Barista::Framework[framework] unless framework.is_a?(Barista::Framework) + framework.output_root = root if framework end def each_framework(include_default = false, &blk) Framework.all(include_default).each(&blk) end