Radio, Web and Free Software

Changeset 0ead693cbae79e21f5c4828ffc14506af0279788

Show
Ignore:
Timestamp:
07/26/10 21:13:31 (6 weeks ago)
Author:
Alban Peignier <alban@…>
Parents:
fbc0c51a22a4646da07780df6d8e303e1c8026b4
Children:
4c2e420eff672f881710178e0488b6a07aebec4c
git-committer:
Alban Peignier <alban@tryphon.eu> / 2010-07-26T21:13:31Z+0200
Message:

Reload liquid templates when one of them have been updated. Refs #15

Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • app/models/template.rb

    r7781d86 r0ead693  
    3535    return unless self.class.supports_scm_url? 
    3636 
     37    update_success = false 
    3738    if has_resources? 
    3839      Dir.chdir(resources_dir) do 
    3940        logger.info "Update git template #{scm_url} in #{resources_dir}" 
    40         system "git pull origin master" 
     41        update_success = system "git pull origin master" 
    4142      end 
    4243    else 
    4344      logger.info "Clone git template #{scm_url} in #{resources_dir}" 
    44       system "git clone #{scm_url} #{resources_dir}" 
     45      update_success = system "git clone #{scm_url} #{resources_dir}" 
     46    end 
     47 
     48    if update_success 
     49      TemplateLiquidEngine.clear_cache!  
     50      true 
    4551    end 
    4652  end 
  • config/initializers/liquid.rb

    r439b576 r0ead693  
    1 require 'extras/liquid_view' 
    2  
    3 Liquid::Template.file_system = Liquid::LocalFileSystem.new("#{Rails.root}/templates") 
    4 ActionView::Template.register_template_handler :liquid, LiquidView 
     1TemplateLiquidEngine.init