Sha256: d30d5fa8481989ad67f68d359e8940e388c2a2b8763b1ad7a8e3d0da50bfb9dc
Contents?: true
Size: 1.88 KB
Versions: 3
Compression:
Stored size: 1.88 KB
Contents
require 'digest/sha2' require 'condenser/context' require 'condenser/cache_store' require 'condenser/cache/null_store' require 'condenser/cache/memory_store' require 'condenser/cache/file_store' class Condenser module Environment attr_reader :path, :npm_path attr_accessor :cache def initialize(*args) @loaded_processors = Set.new @context_class = Class.new(Condenser::Context) super end def load_processors(*processors) processors.flatten! (Set.new(processors) - @loaded_processors).each do |processor| processor.setup(self) @loaded_processors << processor end end def prepend_path(*paths) paths.flatten.each do |path| path = File.expand_path(path) raise ArgumentError, "Path \"#{path}\" does not exists" if !File.directory?(path) @path.unshift(path) end end def append_path(*paths) paths.flatten.each do |path| path = File.expand_path(path) raise ArgumentError, "Path \"#{path}\" does not exists" if !File.directory?(path) @path.push(path) end end def npm_path=(path) path = File.expand_path(path) raise ArgumentError, "Path \"#{path}\" does not exists" if !File.directory?(path) @npm_path = path end # def npm_check # if app.root.join('package-lock.json') && npm ls != 0 # npm i # end # end def append_npm_path(*paths) paths.flatten.each do |path| self.npm_path = path end end def clear_path @path.clear end def new_context_class context_class.new(self) end # This class maybe mutated and mixed in with custom helpers. # # environment.context_class.instance_eval do # include MyHelpers # def asset_url; end # end # attr_reader :context_class end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
condenser-0.3 | lib/condenser/environment.rb |
condenser-0.0.12 | lib/condenser/environment.rb |
condenser-0.0.11 | lib/condenser/environment.rb |