Sha256: b4aab8d50c4a38f1825f81dabbf3fed8309d95c14b0ebf8e630ad8ee3392b8af

Contents?: true

Size: 946 Bytes

Versions: 2

Compression:

Stored size: 946 Bytes

Contents

module SpreePrintInvoice
  class Engine < Rails::Engine
    require 'spree/core'
    isolate_namespace Spree
    engine_name 'spree_print_invoice'

    config.autoload_paths += %W(#{config.root}/lib)

    initializer 'spree.print_invoice.mimetypes' do |app|
      Mime::Type.register('application/pdf', :pdf) unless Mime::Type.lookup_by_extension(:pdf)
    end

    initializer 'spree.print_invoice.environment', before: :load_config_initializers do |app|
      Spree::PrintInvoice::Config = Spree::PrintInvoiceSetting.new
    end

    def self.activate
      Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
        Rails.configuration.cache_classes ? require(c) : load(c)
      end

      Dir.glob(File.join(File.dirname(__FILE__), '../../app/overrides/*.rb')) do |c|
        Rails.configuration.cache_classes ? require(c) : load(c)
      end
    end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree-print-invoice-2.2.0 lib/spree_print_invoice/engine.rb
spree-print-invoice-2.1.0 lib/spree_print_invoice/engine.rb