class RailsKarmaSprockets::AssetsManager

Constants

COMPILED_ASSETS_DIR
COMPILED_ASSET_PATH

Public Instance Methods

compile!() click to toggle source
# File lib/rails_karma_sprockets/assets_manager.rb, line 11
def compile!
  @manifests ||= RailsKarmaSprockets.config.manifests
  compile_manifests
end
destroy!() click to toggle source
# File lib/rails_karma_sprockets/assets_manager.rb, line 16
def destroy!
  FileUtils.rm_r(COMPILED_ASSETS_DIR) if Dir.exists?(COMPILED_ASSETS_DIR)
end
exist?() click to toggle source
# File lib/rails_karma_sprockets/assets_manager.rb, line 20
def exist?
  File.exists? COMPILED_ASSET_PATH
end

Private Instance Methods

compile_manifests() click to toggle source
# File lib/rails_karma_sprockets/assets_manager.rb, line 30
def compile_manifests
  create_compiled_dir
  assets = []

  @manifests.each do |manifest|
    assets << Rails.application.assets.find_asset(manifest.to_s).to_s
  end

  File.write(COMPILED_ASSET_PATH, assets.join)
end
create_compiled_dir() click to toggle source
# File lib/rails_karma_sprockets/assets_manager.rb, line 26
def create_compiled_dir
  Dir.mkdir(COMPILED_ASSETS_DIR) unless Dir.exists?(COMPILED_ASSETS_DIR)
end