activekit 0.2.2 → 0.2.3.dev1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2a8a1118c555e7d450d530a4d844e43d718acf3c879c5e21616e2607c46bd7e
4
- data.tar.gz: 838dd18ff937255d7f860ad0279f886123de8367ae9182cd3f93d1bf6dcbd829
3
+ metadata.gz: fdfebffac9f65f7b8e393240aebefc53bb56d46a1eaff8070837735adf269e99
4
+ data.tar.gz: 331f0bef2a0675a603bf462885b7bf0c47a5acca2efcc8a59db8150555183bdd
5
5
  SHA512:
6
- metadata.gz: 9f5946fd34c134e6b0b11e70a3c5f307dc4c83d77bcfd11003e6d7aeddce7772202ba96d13e3638060d313231ee7390c6dd80a0d9d23de11ed2e10e54ba97b96
7
- data.tar.gz: 171003ab2c3b2c8e4f9c8f098c5b5811cf2e3e6dd9d2315658bbdfaa1beaea0b7ce3551d60bad7bd9425b39783d570236f43cd25cb5e67c0084e9ed5b7ffc5cb
6
+ metadata.gz: f814ff88427a48347b5272a7cec69997fed42d5910a9fa708fdd45b7e19957ebd6df5b1d0a12d025bcd7bf65d99e630aa2ed879ac7b3e5c50ddbf043c7bcdf55
7
+ data.tar.gz: b79dc6fa0fd3d62e7f03fe0e69426969d77380614e4c3b64a1fec5c21162ae7440a4fc23d2af922370474ad8dc4a6b38ed615c0dc2f3425349ef7138a426e03f
@@ -3,6 +3,10 @@ module ActiveKit
3
3
  isolate_namespace ActiveKit
4
4
  config.eager_load_namespaces << ActiveKit
5
5
 
6
+ initializer "active_kit.add_middleware" do |app|
7
+ app.middleware.use ActiveKit::Middleware
8
+ end
9
+
6
10
  initializer "active_kit.activekitable" do
7
11
  require "active_kit/activekitable"
8
12
 
@@ -1,5 +1,8 @@
1
1
  module ActiveKit
2
2
  module Loader
3
+ def self.ensure_middleware_for!(request:)
4
+ end
5
+
3
6
  def self.ensure_setup_for!(current_class:)
4
7
  current_class.class_eval do
5
8
  unless self.reflect_on_association :activekit_association
@@ -0,0 +1,24 @@
1
+ module ActiveKit
2
+ class Middleware
3
+ def initialize(app)
4
+ @app = app
5
+ end
6
+
7
+ # Middleware that determines which ActiveKit schedules to run.
8
+ def call(env)
9
+ request = ActionDispatch::Request.new(env)
10
+
11
+ activekit_runner(request) do
12
+ @app.call(env)
13
+ end
14
+ end
15
+
16
+ private
17
+
18
+ def activekit_runner(request, &blk)
19
+ ActiveKit::Loader.ensure_middleware_for!(request: request)
20
+
21
+ yield
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module ActiveKit
2
- VERSION = '0.2.2'
2
+ VERSION = '0.2.3.dev1'
3
3
  end
data/lib/active_kit.rb CHANGED
@@ -6,6 +6,7 @@ module ActiveKit
6
6
 
7
7
  autoload :Activekiter
8
8
  autoload :Loader
9
+ autoload :Middleware
9
10
  autoload :Relation
10
11
  autoload :Sequence
11
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activekit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3.dev1
5
5
  platform: ruby
6
6
  authors:
7
7
  - plainsource
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-17 00:00:00.000000000 Z
11
+ date: 2023-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -56,6 +56,7 @@ files:
56
56
  - lib/active_kit/activekiter.rb
57
57
  - lib/active_kit/engine.rb
58
58
  - lib/active_kit/loader.rb
59
+ - lib/active_kit/middleware.rb
59
60
  - lib/active_kit/relation.rb
60
61
  - lib/active_kit/sequence.rb
61
62
  - lib/active_kit/sequence/sequence.rb
@@ -80,9 +81,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
80
81
  version: '0'
81
82
  required_rubygems_version: !ruby/object:Gem::Requirement
82
83
  requirements:
83
- - - ">="
84
+ - - ">"
84
85
  - !ruby/object:Gem::Version
85
- version: '0'
86
+ version: 1.3.1
86
87
  requirements: []
87
88
  rubygems_version: 3.1.2
88
89
  signing_key: