rage-rb 1.13.0 → 1.14.0
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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +7 -4
- data/lib/rage/code_loader.rb +13 -2
- data/lib/rage/middleware/reloader.rb +19 -2
- data/lib/rage/tasks.rb +5 -0
- data/lib/rage/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b63589b942c187505390393db5ff827ad647a8ba22b2b6d544f47a0075f73701
|
4
|
+
data.tar.gz: 91cad1e502090ab52bb872ce9216f1deb2cfe150560bf328bb61267a719a5c1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0e44e8decbd7b68c8489e6559960585711ea1931ff5cff48622e5303b120bb5920567cf85610faaef7e25fa94d8289ceccaab82ba761ea8c28ded4b436624c6
|
7
|
+
data.tar.gz: 655432e0e793cfa07b744e0adc56f6dc4becd73c9e48d3eb1c4716055849e5c03f1927211d75400a3da97838846329a9520226122635781cbd0f5f6417319687
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [1.14.0] - 2025-03-10
|
4
|
+
|
5
|
+
### Added
|
6
|
+
|
7
|
+
- Detect file updates in development (#132).
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- Update app template to include all app rake tasks by [pjb3](https://github.com/pjb3) (#130).
|
12
|
+
|
3
13
|
## [1.13.0] - 2025-02-12
|
4
14
|
|
5
15
|
### Added
|
data/README.md
CHANGED
@@ -57,13 +57,16 @@ Check out in-depth API docs for more information:
|
|
57
57
|
- [Fiber API](https://rage-rb.pages.dev/Fiber)
|
58
58
|
- [Logger API](https://rage-rb.pages.dev/Rage/Logger)
|
59
59
|
- [Configuration API](https://rage-rb.pages.dev/Rage/Configuration)
|
60
|
-
|
60
|
+
|
61
|
+
Built-in middleware:
|
62
|
+
- [CORS](https://rage-rb.pages.dev/Rage/Cors)
|
63
|
+
- [RequestId](https://rage-rb.pages.dev/Rage/RequestId)
|
61
64
|
|
62
65
|
Also, see the following integration guides:
|
63
66
|
|
64
|
-
- [Rails
|
65
|
-
- [RSpec
|
66
|
-
- [WebSockets
|
67
|
+
- [Rails Integration](https://github.com/rage-rb/rage/wiki/Rails-integration)
|
68
|
+
- [RSpec Integration](https://github.com/rage-rb/rage/wiki/RSpec-integration)
|
69
|
+
- [WebSockets Guide](https://github.com/rage-rb/rage/wiki/WebSockets-guide)
|
67
70
|
|
68
71
|
If you are a first-time contributor, make sure to check the [overview doc](https://github.com/rage-rb/rage/blob/master/OVERVIEW.md) that shows how Rage's core components interact with each other.
|
69
72
|
|
data/lib/rage/code_loader.rb
CHANGED
@@ -5,16 +5,16 @@ require "zeitwerk"
|
|
5
5
|
class Rage::CodeLoader
|
6
6
|
def initialize
|
7
7
|
@reloading = false
|
8
|
+
@autoload_path = Rage.root.join("app")
|
8
9
|
end
|
9
10
|
|
10
11
|
def setup
|
11
12
|
@loader = Zeitwerk::Loader.new
|
12
13
|
|
13
|
-
autoload_path = "#{Rage.root}/app"
|
14
14
|
enable_reloading = Rage.env.development?
|
15
15
|
enable_eager_loading = !Rage.env.development? && !Rage.env.test?
|
16
16
|
|
17
|
-
@loader.push_dir(autoload_path)
|
17
|
+
@loader.push_dir(@autoload_path.to_s)
|
18
18
|
# The first level of directories in app directory won't be treated as modules
|
19
19
|
# e.g. app/controllers/pages_controller.rb will be linked to PagesController class
|
20
20
|
# instead of Controllers::PagesController
|
@@ -62,4 +62,15 @@ class Rage::CodeLoader
|
|
62
62
|
def reloading?
|
63
63
|
@reloading
|
64
64
|
end
|
65
|
+
|
66
|
+
def check_updated!
|
67
|
+
current_watched = @autoload_path.glob("**/*.rb") + Rage.root.glob("config/routes.rb") + Rage.root.glob("config/openapi_components.*")
|
68
|
+
current_update_at = current_watched.max_by { |path| path.exist? ? path.mtime.to_f : 0 }&.mtime.to_f
|
69
|
+
return false if !@last_watched && !@last_update_at
|
70
|
+
|
71
|
+
current_watched.size != @last_watched.size || current_update_at != @last_update_at
|
72
|
+
|
73
|
+
ensure
|
74
|
+
@last_watched, @last_update_at = current_watched, current_update_at
|
75
|
+
end
|
65
76
|
end
|
@@ -2,15 +2,32 @@
|
|
2
2
|
|
3
3
|
class Rage::Reloader
|
4
4
|
def initialize(app)
|
5
|
+
Iodine.on_state(:on_start) do
|
6
|
+
Rage.code_loader.check_updated!
|
7
|
+
end
|
5
8
|
@app = app
|
6
9
|
end
|
7
10
|
|
8
11
|
def call(env)
|
9
|
-
|
10
|
-
|
12
|
+
with_reload do
|
13
|
+
@app.call(env)
|
14
|
+
end
|
11
15
|
rescue Exception => e
|
12
16
|
exception_str = "#{e.class} (#{e.message}):\n#{e.backtrace.join("\n")}"
|
13
17
|
puts(exception_str)
|
14
18
|
[500, {}, [exception_str]]
|
15
19
|
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def with_reload
|
24
|
+
if Rage.code_loader.check_updated!
|
25
|
+
Fiber.new(blocking: true) {
|
26
|
+
Rage.code_loader.reload
|
27
|
+
yield
|
28
|
+
}.resume
|
29
|
+
else
|
30
|
+
yield
|
31
|
+
end
|
32
|
+
end
|
16
33
|
end
|
data/lib/rage/tasks.rb
CHANGED
@@ -7,6 +7,7 @@ class Rage::Tasks
|
|
7
7
|
class << self
|
8
8
|
def init
|
9
9
|
load_db_tasks if defined?(StandaloneMigrations)
|
10
|
+
load_app_tasks
|
10
11
|
end
|
11
12
|
|
12
13
|
private
|
@@ -29,5 +30,9 @@ class Rage::Tasks
|
|
29
30
|
|
30
31
|
StandaloneMigrations::Tasks.load_tasks
|
31
32
|
end
|
33
|
+
|
34
|
+
def load_app_tasks
|
35
|
+
Dir[Rage.root.join("lib/tasks/**/*.rake")].each { |file| load file }
|
36
|
+
end
|
32
37
|
end
|
33
38
|
end
|
data/lib/rage/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rage-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Samoilov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|