ru.Bee 2.7.1 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: caf6d0df294f7afd884d148b0949352686b23b82c4f9f870fbaddbfc50a57b8b
4
- data.tar.gz: 5d0de409af07b3f66fd88812834ff931fec088887d8072c7c941ed4a6faaa725
3
+ metadata.gz: 6dae50d53499025c3bb722a77239ffaf3c7ef566dbe58e665986b62148bcbf60
4
+ data.tar.gz: 012e74d3c4c3cb488462689bcd0ba0b5c56488cf77da19e3c98caf3682847b26
5
5
  SHA512:
6
- metadata.gz: caf1433926dc4c7e7f162fe62666dffcf543c13d72084c3a6c806ccb8c90eb797e8e5ea7cdb08f0c49da25c1d063f7f4bf8ab3a17fc47b46d001a27a0ca5910f
7
- data.tar.gz: 0026ae4837453567fc1c6b6d2a2bf4bbc1f24a4cbe08447597437929fbb326daf4c330f2ee6f1902f8add6e47caa76811e61e3409af97a8e35f646ffd5a4e6c2
6
+ metadata.gz: 7d22033e1be9a7583e872582bff2455715964d934905789b99065a702284b8bd8831f6bf4d2fc20c354c8a828e188cfa130b5396d443056bda1179cca9634e92
7
+ data.tar.gz: f7941cc128ac31cea3c98da487fdff20da3f01acfb14bfe3d1dcba4fa2a0a7fb6ade7404af5d5bca98746689cdb42f53b9ce7fec59540e74a745de35e27d2b7e
data/lib/config.ru CHANGED
@@ -1,3 +1,8 @@
1
1
  require_relative './rubee'
2
2
 
3
- run Rubee::Application.instance
3
+ rubee_app = Rubee::Application.instance
4
+ puts "Middlewares: #{rubee_app.middlewares}"
5
+ rubee_app.middlewares.each do |middleware|
6
+ use middleware
7
+ end
8
+ run rubee_app
data/lib/db/test.db CHANGED
Binary file
@@ -106,6 +106,16 @@ module Rubee
106
106
  @configuraiton[args[:app].to_sym][args[:env].to_sym][:pubsub_container] = args[:pubsub_container]
107
107
  end
108
108
 
109
+ def middlewares=(args)
110
+ args[:app] ||= :app
111
+ @configuraiton[args[:app].to_sym][args[:env].to_sym][:middlewares] = args[:middlewares]
112
+ end
113
+
114
+ def middlewares(**args)
115
+ args[:app] ||= :app
116
+ @configuraiton[args[:app].to_sym][ENV['RACK_ENV']&.to_sym || :development][:middlewares] || []
117
+ end
118
+
109
119
  def pubsub_container(**args)
110
120
  args[:app] ||= :app
111
121
  @configuraiton[args[:app].to_sym][ENV['RACK_ENV']&.to_sym || :development][:pubsub_container] || ::Rubee::PubSub::Redis.instance
data/lib/rubee.rb CHANGED
@@ -20,7 +20,7 @@ module Rubee
20
20
  RUBEE_SUPPORT = { "Rubee::Support::Hash" => Hash, "Rubee::Support::String" => String }
21
21
  end
22
22
 
23
- VERSION = '2.7.1'
23
+ VERSION = '2.7.3'
24
24
 
25
25
  require_relative 'rubee/router'
26
26
  require_relative 'rubee/logger'
@@ -33,9 +33,11 @@ module Rubee
33
33
  include Singleton
34
34
  using(ChargedString)
35
35
 
36
- def call(env)
37
- # autoload rb files
36
+ def initialize
38
37
  Autoload.call
38
+ end
39
+
40
+ def call(env)
39
41
  # init rack request
40
42
  request = Rack::Request.new(env)
41
43
  # Add default path for assets
@@ -63,6 +65,10 @@ module Rubee
63
65
  controller.send(action)
64
66
  end
65
67
 
68
+ def middlewares
69
+ Rubee::Configuration.middlewares
70
+ end
71
+
66
72
  private
67
73
 
68
74
  def register_assets_routes
data/readme.md CHANGED
@@ -5,7 +5,10 @@
5
5
  ![Gem](https://img.shields.io/gem/v/ru.Bee.svg)
6
6
  ![GitHub Repo stars](https://img.shields.io/github/stars/nucleom42/rubee?style=social)
7
7
 
8
- <img width="363" height="131" alt="ru.Bee logo" src="https://github.com/user-attachments/assets/f6f07b88-f58d-4f36-a857-a293e613269e" />
8
+ <img width="358" height="131" alt="Screen Shot 2026-03-10 at 6 26 04 PM" src="https://github.com/user-attachments/assets/9f156847-590d-43c2-b432-728e6cc2eacc" />
9
+ <br />
10
+ <img width="200" alt="Screenshot 2026-03-11 at 3 42 16 PM" src="https://github.com/user-attachments/assets/f2df9bc7-cda9-4d91-83d5-deedd499999b" />
11
+
9
12
 
10
13
  ru.Bee is a Ruby-based web framework designed to streamline the development of modular monolith web applications.
11
14
  Under the hood, it leverages the power of Ruby and Rack backed by Puma, offering a clean, efficient, and flexible architecture.
@@ -92,6 +95,8 @@ The comparison is based on generic and subjective information available on the i
92
95
  - [Logger](#logger)
93
96
  - [WebSocket](#websocket)
94
97
  - [Bee assistant](#bee-assistant)
98
+ - [Middleware integration](#middleware-integration)
99
+
95
100
 
96
101
  You can read the full docs on the demo site: [rubee.dedyn.io](https://rubee.dedyn.io/)
97
102
 
@@ -1247,7 +1252,7 @@ gem 'sidekiq'
1247
1252
  # config/base_configuration.rb
1248
1253
  Rubee::Configuration.setup(env = :development) do |config|
1249
1254
  config.database_url = { url: "sqlite://db/development.db", env: }
1250
- config.async_adapter = { async_adapter: SidekiqAsync, env: }
1255
+ config.async_adapter = { async_adapter: Rubee::SidekiqAsync, env: }
1251
1256
  end
1252
1257
  ```
1253
1258
 
@@ -1553,6 +1558,31 @@ If you are interested in contributing to ru.Bee, please read the [Contributing](
1553
1558
  Feel free to open an [issue](https://github.com/nucleom42/rubee/issues) if you spot one.
1554
1559
  Have an idea or want to discuss something? Open a [discussion](https://github.com/nucleom42/rubee/discussions).
1555
1560
 
1561
+ ## Middleware integration
1562
+
1563
+ ru.Bee is rack based framework, so you can use register and use middleware for your application.
1564
+ 1. Create a middleware
1565
+ ```ruby
1566
+ # app/inits/middlewares/my_middleware.rb
1567
+ class MyMiddleware
1568
+ def initialize(app)
1569
+ @app = app
1570
+ end
1571
+
1572
+ def call(env)
1573
+ Logger.info("Middleware called")
1574
+ @app.call(env)
1575
+ end
1576
+ end
1577
+ ```
1578
+ 2. Register the middleware in the `config/base_configuration.rb`
1579
+ ```ruby
1580
+ # config/base_configuration.rb
1581
+ require_relative 'inits/middlewares/my_middleware'
1582
+
1583
+ config.middlewares = { middlewares: [MyMiddleware], env: }
1584
+ ```
1585
+
1556
1586
  ## Roadmap
1557
1587
 
1558
1588
  Please refer to the [Roadmap](https://github.com/nucleom42/rubee/blob/main/roadmap.md).
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ru.Bee
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Saltykov