|
11 | 11 | require "interactify/wiring"
|
12 | 12 | require "interactify/configuration"
|
13 | 13 | require "interactify/interactify_callable"
|
14 |
| - |
15 |
| -module Interactify |
16 |
| - class << self |
17 |
| - delegate :on_definition_error, :trigger_definition_error, to: :configuration |
18 |
| - |
19 |
| - def railties_missing? |
20 |
| - @railties_missing |
21 |
| - end |
22 |
| - |
23 |
| - def railties_missing! |
24 |
| - @railties_missing = true |
25 |
| - end |
26 |
| - |
27 |
| - def railties |
28 |
| - railties? |
29 |
| - end |
30 |
| - |
31 |
| - def railties? |
32 |
| - !railties_missing? |
33 |
| - end |
34 |
| - |
35 |
| - def sidekiq_missing? |
36 |
| - @sidekiq_missing |
37 |
| - end |
38 |
| - |
39 |
| - def sidekiq_missing! |
40 |
| - @sidekiq_missing = true |
41 |
| - end |
42 |
| - |
43 |
| - def sidekiq |
44 |
| - sidekiq? |
45 |
| - end |
46 |
| - |
47 |
| - def sidekiq? |
48 |
| - !sidekiq_missing? |
49 |
| - end |
50 |
| - end |
51 |
| -end |
52 |
| - |
53 |
| -Interactify.instance_eval do |
54 |
| - @sidekiq_missing = nil |
55 |
| - @railties_missing = nil |
56 |
| -end |
57 |
| - |
58 |
| -begin |
59 |
| - require "sidekiq" |
60 |
| -rescue LoadError |
61 |
| - Interactify.sidekiq_missing! |
62 |
| -end |
63 |
| - |
64 |
| -begin |
65 |
| - require "rails/railtie" |
66 |
| -rescue LoadError |
67 |
| - Interactify.railties_missing! |
68 |
| -end |
| 14 | +require "interactify/dependency_inference" |
| 15 | +require "interactify/hooks" |
| 16 | +require "interactify/configure" |
69 | 17 |
|
70 | 18 | module Interactify
|
71 | 19 | extend ActiveSupport::Concern
|
| 20 | + extend Hooks |
| 21 | + extend Configure |
72 | 22 |
|
73 | 23 | class << self
|
74 |
| - def validate_app(ignore: []) |
75 |
| - Interactify::Wiring.new(root: Interactify.configuration.root, ignore:).validate_app |
76 |
| - end |
77 |
| - |
78 |
| - def reset |
79 |
| - @on_contract_breach = nil |
80 |
| - @before_raise_hook = nil |
81 |
| - @configuration = nil |
82 |
| - end |
83 |
| - |
84 |
| - def trigger_contract_breach_hook(...) |
85 |
| - @on_contract_breach&.call(...) |
86 |
| - end |
87 |
| - |
88 |
| - def on_contract_breach(&block) |
89 |
| - @on_contract_breach = block |
90 |
| - end |
91 |
| - |
92 |
| - def trigger_before_raise_hook(...) |
93 |
| - @before_raise_hook&.call(...) |
94 |
| - end |
95 |
| - |
96 |
| - def before_raise(&block) |
97 |
| - @before_raise_hook = block |
98 |
| - end |
99 |
| - |
100 |
| - def configure |
101 |
| - yield configuration |
102 |
| - end |
103 |
| - |
104 |
| - def configuration |
105 |
| - @configuration ||= Configuration.new |
106 |
| - end |
107 |
| - |
108 | 24 | delegate :root, to: :configuration
|
109 | 25 | end
|
110 | 26 |
|
|
0 commit comments