rivet_cms 0.1.0.pre → 0.1.1.pre
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/config/routes.rb +5 -3
- data/lib/rivet_cms/engine.rb +9 -27
- data/lib/rivet_cms/routes.rb +39 -0
- data/lib/rivet_cms/version.rb +1 -1
- data/lib/rivet_cms.rb +3 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4ab85871fd2fb7a01b149fb1d70b99e7683c87d22e028c337c3029257162dfa
|
4
|
+
data.tar.gz: 7854daa20f72debd1f2efc10bb9f0593b7d4912629dad6ae0accb8ee04e32b88
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73eedb4dbfb8dd8e456ac72c43cf7040965a0a2ce4418a4220ff54f60b6f054c203eeb3b5ffdd098812e836f707138006a47c349c30b36101a76f8646fad382e
|
7
|
+
data.tar.gz: 818fe99cd5bcc199bbcc53763bceb1c4f460dce246dedf0aad1636fd3add63c3627abd3ccc57f37722448bef7f1f17a156b5dc37d677b2470bb335ce63d0920e
|
data/config/routes.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
RivetCms::
|
2
|
-
get '/', to: "dashboard#index"
|
1
|
+
RivetCms::Routes.add_routes do
|
2
|
+
get '/', to: "dashboard#index"
|
3
3
|
|
4
4
|
# Content Type Management
|
5
5
|
resources :content_types, path: 'content-types' do
|
@@ -53,4 +53,6 @@ RivetCms::Engine.register_routes do
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
RivetCms::Engine.
|
56
|
+
RivetCms::Engine.routes.draw do
|
57
|
+
RivetCms::Routes.draw_routes
|
58
|
+
end
|
data/lib/rivet_cms/engine.rb
CHANGED
@@ -4,6 +4,7 @@ require "prefixed_ids"
|
|
4
4
|
require "kaminari"
|
5
5
|
require "turbo-rails"
|
6
6
|
require "stimulus-rails"
|
7
|
+
require "rivet_cms/routes"
|
7
8
|
|
8
9
|
module RivetCms
|
9
10
|
class Engine < ::Rails::Engine
|
@@ -21,35 +22,16 @@ module RivetCms
|
|
21
22
|
g.factory_bot dir: 'spec/factories'
|
22
23
|
end
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
# Use a class-level instance variable with a default empty array
|
28
|
-
@routes_storage ||= []
|
29
|
-
end
|
30
|
-
|
31
|
-
# Register route definitions to be drawn later
|
32
|
-
# @param block [Proc] A block containing route definitions
|
33
|
-
def register_routes(&block)
|
34
|
-
routes_storage << block # Add the block to the storage
|
35
|
-
end
|
36
|
-
|
37
|
-
# Draw all registered routes into the engine's RouteSet
|
38
|
-
def draw_routes
|
39
|
-
# Capture the routes in a local variable before entering the block
|
40
|
-
stored_routes = routes_storage
|
25
|
+
def self.add_routes(&block)
|
26
|
+
RivetCms::Routes.add_routes(&block)
|
27
|
+
end
|
41
28
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
stored_routes.each do |route_block|
|
46
|
-
instance_eval(&route_block)
|
47
|
-
end
|
48
|
-
end
|
29
|
+
def self.append_routes(&block)
|
30
|
+
RivetCms::Routes.append_routes(&block)
|
31
|
+
end
|
49
32
|
|
50
|
-
|
51
|
-
|
52
|
-
end
|
33
|
+
def self.draw_routes(&block)
|
34
|
+
RivetCms::Routes.draw_routes(&block)
|
53
35
|
end
|
54
36
|
end
|
55
37
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module RivetCms
|
2
|
+
module Routes
|
3
|
+
def self.draw_routes(&block)
|
4
|
+
@rivet_routes ||= []
|
5
|
+
@append_routes ||= []
|
6
|
+
|
7
|
+
# Evaluate the passed block first if given
|
8
|
+
eval_block(block) if block_given?
|
9
|
+
|
10
|
+
# Draw main routes
|
11
|
+
@rivet_routes.each { |r| eval_block(&r) }
|
12
|
+
|
13
|
+
# Draw appended routes
|
14
|
+
@append_routes.each { |r| eval_block(&r) }
|
15
|
+
|
16
|
+
# Clear routes to prevent drawing twice
|
17
|
+
@rivet_routes = []
|
18
|
+
@append_routes = []
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.add_routes(&block)
|
22
|
+
@rivet_routes ||= []
|
23
|
+
# Store the block unless it's already been added
|
24
|
+
@rivet_routes << block unless @rivet_routes.include?(block)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.append_routes(&block)
|
28
|
+
@append_routes ||= []
|
29
|
+
# Store the block unless it's already been added
|
30
|
+
@append_routes << block unless @append_routes.include?(block)
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def self.eval_block(&block)
|
36
|
+
RivetCms::Engine.routes.send(:eval_block, block)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/rivet_cms/version.rb
CHANGED
data/lib/rivet_cms.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rivet_cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -199,6 +199,7 @@ files:
|
|
199
199
|
- db/migrate/20250317194359_create_core_tables.rb
|
200
200
|
- lib/rivet_cms.rb
|
201
201
|
- lib/rivet_cms/engine.rb
|
202
|
+
- lib/rivet_cms/routes.rb
|
202
203
|
- lib/rivet_cms/version.rb
|
203
204
|
- lib/tasks/rivet_cms_tasks.rake
|
204
205
|
homepage: https://github.com/narch/rivet_cms
|