Sha256: 0c3f8834d4f6e5bf0928296218545bd838022d840825d63b77870971df9a25cd

Contents?: true

Size: 684 Bytes

Versions: 3

Compression:

Stored size: 684 Bytes

Contents

namespace :fs_skin do
  desc 'rebuild fs_skin index'
  task :index => :environment do
    # Make sure all bricks are loaded before executing the index rebuild
    Zena::Use.upgrade_class('Site')
  
    include Zena::Acts::Secure
    if ENV['HOST']
      sites = [Site.find_by_host(ENV['HOST'])]
    else
      sites = Site.all
    end
    
    sites.each do |site|
      Thread.current[:visitor] = site.any_admin
      if ENV['WORKER'] == 'false' || RAILS_ENV == 'test'
        # We avoid SiteWorker.
        site.rebuild_fs_skin_index
      else
        # We try to use the site worker.
        Zena::SiteWorker.perform(site, :rebuild_fs_skin_index, nil)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zena-1.2.4 bricks/fs_skin/zena/tasks.rb
zena-1.2.3 bricks/fs_skin/zena/tasks.rb
zena-1.2.2 bricks/fs_skin/zena/tasks.rb