This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Inspired by Rails memoizable, but use Rails.cache for storing informations | |
# core object must have id, if memoizible method not static (designed for ActiveRecord) | |
# each params must have method 'to_s' or be ActiveRecord | |
# params lenght.to_s might be less then 120 symbols - hasing is big black hole! | |
module CacheMemoizable | |
def self.included(base) | |
base.extend ClassMethods | |
end | |
module ClassMethods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VIEW_PATH = 'lib/assets' | |
namespace :static do | |
desc 'Render all resources' | |
task :publicate => :environment do | |
resources(VIEW_PATH).each do |src, dest| | |
html= controller.render_to_string(file:src, layout:'application') | |
dirname = File.dirname(dest) | |
unless File.directory?(dirname) | |
FileUtils.mkdir_p(dirname) |