Sha256: 8d58e7ca5c56d97886a2a56deb43ed0df4ef3a50549162ed79a816f3b12627a8

Contents?: true

Size: 954 Bytes

Versions: 22

Compression:

Stored size: 954 Bytes

Contents

require 'rails/engine'

require_relative 'dependencies'
require_relative 'configuration'

module Spree
  module Api
    class Engine < Rails::Engine
      isolate_namespace Spree
      engine_name 'spree_api'

      initializer 'spree.api.environment', before: :load_config_initializers do |_app|
        Spree::Api::Config = Spree::Api::Configuration.new
        Spree::Api::Dependencies = Spree::Api::ApiDependencies.new
      end

      initializer 'spree.api.checking_migrations' do
        Migrations.new(config, engine_name).check
      end

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

      def self.root
        @root ||= Pathname.new(File.expand_path('../../..', __dir__))
      end

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

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
spree_api-4.8.3 lib/spree/api/engine.rb
spree_api-4.8.2 lib/spree/api/engine.rb
spree_api-4.7.3 lib/spree/api/engine.rb
spree_api-4.6.6 lib/spree/api/engine.rb
spree_api-4.5.5 lib/spree/api/engine.rb
spree_api-4.5.4 lib/spree/api/engine.rb
spree_api-4.6.5 lib/spree/api/engine.rb
spree_api-4.7.2 lib/spree/api/engine.rb
spree_api-4.7.1 lib/spree/api/engine.rb
spree_api-4.6.4 lib/spree/api/engine.rb
spree_api-4.7.0 lib/spree/api/engine.rb
spree_api-4.6.3 lib/spree/api/engine.rb
spree_api-4.6.2 lib/spree/api/engine.rb
spree_api-4.6.1 lib/spree/api/engine.rb
spree_api-4.6.0 lib/spree/api/engine.rb
spree_api-4.5.3 lib/spree/api/engine.rb
atkhayar-dev-spree-api-0.0.1 lib/spree/api/engine.rb
atkhayar-dev-spree-api-0.0.0 lib/spree/api/engine.rb
atkhayar-spree-dev-api-0.0.0 lib/spree/api/engine.rb
spree_api-4.5.2 lib/spree/api/engine.rb