Sha256: b279787edd5a76a9f3d2fa262a26ff8409c1a60401d328027ebcced87e92e794
Contents?: true
Size: 1.5 KB
Versions: 9
Compression:
Stored size: 1.5 KB
Contents
require "tinymce/rails/asset_manifest" require "tinymce/rails/asset_installer/copy" require "tinymce/rails/asset_installer/copy_no_preserve" require "tinymce/rails/asset_installer/compile" module TinyMCE module Rails class AssetInstaller attr_reader :assets, :target, :strategy attr_accessor :logger def initialize(assets, target, manifest_path) @assets = assets @target = target @manifest_path = manifest_path || target @logger = Logger.new($stderr) @logger.level = Logger::INFO end def install (strategy || Copy).new(self).call end def log_level @logger.level end def log_level=(level) if level.is_a?(Integer) @logger.level = level else @logger.level = Logger.const_get(level.to_s.upcase) end end def strategy=(strategy) if strategy.is_a?(Class) @strategy = strategy else @strategy = self.class.const_get(strategy.to_s.classify) end end def manifest @manifest ||= AssetManifest.load(@manifest_path) end def logical_path(file) file.relative_path_from(@assets.parent).to_s end def with_asset(src, dest) if src != dest src = File.join(@target, src) dest = File.join(@target, dest) yield src, dest if File.exists?(src) end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems