Sha256: 0e8fc033e8ee772977077794a2c7cbf7edb3885aae0cfb7d8e901628eaa15161

Contents?: true

Size: 938 Bytes

Versions: 1

Compression:

Stored size: 938 Bytes

Contents

require 'spree_essentials'

module SpreeEssentialCms

  def self.tab
    [ :pages ]
  end
  
  def self.sub_tab
    [ :pages, { :match_path => '/pages' }]
  end
  
  def self.independent?
    return true unless defined?(SpreeEssentials)
    !SpreeEssentials.respond_to?(:register)
  end
  
  class Engine < Rails::Engine
    config.autoload_paths += %W(#{config.root}/lib)    
    
    initializer "static assets" do |app|
      app.middleware.insert_before ::Rack::Lock, ::ActionDispatch::Static, "#{config.root}/public"
    end
    
    def self.activate
      
      Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator.rb")) do |c|
        Rails.env.production? ? require(c) : load(c)
      end
      
    end

    config.to_prepare &method(:activate).to_proc
    
  end
  
end

if SpreeEssentialCms.independent?
  require 'spree_essential_press/custom_hooks'
else 
  SpreeEssentials.register :cms, SpreeEssentialCms
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_essential_cms-0.1.2 lib/spree_essential_cms.rb