one-for-all-framework 5.0.0 → 5.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 189b80a3eb7da358bd91a56cb6ffb17997f94433ee00fdd0366762320bea5f1e
4
- data.tar.gz: 5693b52708caad36aa969c58ac3f25ae3b17a1d2e964de44ab7761577050aa5e
3
+ metadata.gz: 83f47c6b59832741e01a871cc5ac3fec945fb3fa7cb24fe2affd9f43a31681c8
4
+ data.tar.gz: 7f88e95af0f77ad1bec895c54ecbf2e159ca11514e7ee3e9e5253289a400abd6
5
5
  SHA512:
6
- metadata.gz: 5f1bff39a001463536a39c0ee436438cb8579287cbbc4d1846b439a2172df848cead0a4dbc87ef0046cf0bc359833c47dca33e3347e2cfb94ac3c1108231f26c
7
- data.tar.gz: 8375e210da774b3fd0f6db508c5a44df418c1d395cd71d742aa10bec261f3429b65b904a9cc07c36d906d35edfa9e1fdd00d6e0916e17143410520ee2ebd44f8
6
+ metadata.gz: 2e7ca416aca6c7413e62300f96a6c4c9b3f0898e1133bbb21ea89e288d851b4d3355ab905922fc79c05fb855e0e2903d90e8713f5b495a1de3f1349d8c381edf
7
+ data.tar.gz: 196f8e7254a3880b3e346b8754fa2403eb65c2c810873529437a99923fa88f003b83683b6e782772e0a55d393265c5efa2f90cb64c75a30e4f25ffd1f25f79ab
@@ -0,0 +1,35 @@
1
+ module OFA
2
+ @hooks = {
3
+ on_boot: [],
4
+ after_request: []
5
+ }
6
+
7
+ def self.on_boot(&block)
8
+ @hooks[:on_boot] << block
9
+ end
10
+
11
+ def self.run_boot_hooks
12
+ @hooks[:on_boot].each(&:call)
13
+ end
14
+
15
+ # Helper for plugins to add routes easily
16
+ def self.add_route(method, path, &block)
17
+ # This assumes ROUTES is available globally (defined in config.ru)
18
+ # If not, we might need a different registration mechanism
19
+ if defined?(ROUTES)
20
+ ROUTES.send(method, path, &block)
21
+ else
22
+ # Delay registration if ROUTES not yet defined
23
+ @pending_routes ||= []
24
+ @pending_routes << { method: method, path: path, block: block }
25
+ end
26
+ end
27
+
28
+ def self.apply_pending_routes(router)
29
+ return unless @pending_routes
30
+ @pending_routes.each do |r|
31
+ router.send(r[:method], r[:path], &r[:block])
32
+ end
33
+ @pending_routes = []
34
+ end
35
+ end
@@ -0,0 +1,30 @@
1
+ # Simple Task DSL for One-For-All
2
+ @tasks = {}
3
+ @last_desc = nil
4
+
5
+ def desc(text)
6
+ @last_desc = text
7
+ end
8
+
9
+ def task(name, &block)
10
+ @tasks[name.to_sym] = {
11
+ desc: @last_desc,
12
+ block: block
13
+ }
14
+ @last_desc = nil
15
+ end
16
+
17
+ def run_task(name)
18
+ task_data = @tasks[name.to_sym]
19
+ if task_data
20
+ puts "=> Running task: #{name}"
21
+ task_data[:block].call
22
+ puts "=> Completed task: #{name}"
23
+ else
24
+ puts "❌ Error: Task '#{name}' not found."
25
+ puts "Available tasks:"
26
+ @tasks.each do |n, data|
27
+ puts " #{n.to_s.ljust(15)} # #{data[:desc]}"
28
+ end
29
+ end
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: one-for-all-framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ishikawa Uta
@@ -262,6 +262,8 @@ files:
262
262
  - db/migrations/20260502000000_create_products.rb
263
263
  - db/migrations/20260507000000_create_activity_logs.rb
264
264
  - db/migrations/20260507000001_fix_activity_logs_user_id.rb
265
+ - lib/plugin_helper.rb
266
+ - lib/task_helper.rb
265
267
  - ofa
266
268
  - public/css/cms.css
267
269
  - public/images/logo.jpg