blob: 37c34e5497e4ee73b7c7f97898f8ceb7b0de8713 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
module SolidusSubscriptions
class Engine < Rails::Engine
require 'spree/core'
require 'solidus_subscriptions/permitted_attributes'
require 'solidus_subscriptions/config'
require 'solidus_subscriptions/processor'
isolate_namespace SolidusSubscriptions
engine_name 'solidus_subscriptions'
# use rspec for tests
config.generators do |g|
g.test_framework :rspec
end
config.autoload_paths << config.root.join('app', 'jobs')
initializer 'configure spree subcription permitted attributes', after: 'require subscription lib helpers' do
PermittedAttributes.update_spree_permiteed_attributes
end
initializer 'solidus_subscriptions.configs', before: "require subscription lib helpers" do
end
initializer 'register_subscription_promotion_rule', after: 'spree.promo.register.promotion.rules' do |app|
app.config.spree.promotions.rules << 'SolidusSubscriptions::SubscriptionPromotionRule'
app.config.spree.promotions.rules << 'SolidusSubscriptions::SubscriptionOrderPromotionRule'
end
initializer 'subscriptions_backend' do
next unless Spree::Backend::Config.respond_to?(:menu_items)
Spree::Backend::Config.configure do |config|
config.menu_items << config.class::MenuItem.new(
[:subscriptions],
'repeat',
url: :admin_subscriptions_path
)
end
end
def self.activate
Dir.glob(File.join(File.dirname(__FILE__), '../../app/decorators/**/*.rb')) do |c|
Rails.configuration.cache_classes ? require(c) : load(c)
end
Spree::Ability.register_ability(SolidusSubscriptions::Ability)
end
config.to_prepare(&method(:activate).to_proc)
end
def self.table_name_prefix
'solidus_subscriptions_'
end
end
|