class TinyMCE::Rails::AssetInstaller

Attributes

assets[R]
logger[RW]
strategy[R]
target[R]

Public Class Methods

new(assets, target, manifest_path) click to toggle source
# File lib/tinymce/rails/asset_installer.rb, line 13
def initialize(assets, target, manifest_path)
  @assets = assets
  @target = target
  @manifest_path = manifest_path || target

  @logger       = Logger.new($stderr)
  @logger.level = Logger::INFO
end

Public Instance Methods

install() click to toggle source
# File lib/tinymce/rails/asset_installer.rb, line 22
def install
  (strategy || Copy).new(self).call
end
log_level() click to toggle source
# File lib/tinymce/rails/asset_installer.rb, line 26
def log_level
  @logger.level
end
log_level=(level) click to toggle source
# File lib/tinymce/rails/asset_installer.rb, line 30
def log_level=(level)
  if level.is_a?(Integer)
    @logger.level = level
  else
    @logger.level = Logger.const_get(level.to_s.upcase)
  end
end
logical_path(file) click to toggle source
# File lib/tinymce/rails/asset_installer.rb, line 50
def logical_path(file)
  file.relative_path_from(@assets.parent).to_s
end
manifest() click to toggle source
# File lib/tinymce/rails/asset_installer.rb, line 46
def manifest
  @manifest ||= AssetManifest.load(@manifest_path)
end
strategy=(strategy) click to toggle source
# File lib/tinymce/rails/asset_installer.rb, line 38
def strategy=(strategy)
  if strategy.is_a?(Class)
    @strategy = strategy
  else
    @strategy = self.class.const_get(strategy.to_s.classify)
  end
end
with_asset(src, dest) { |src, dest| ... } click to toggle source
# File lib/tinymce/rails/asset_installer.rb, line 54
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