bridgetown-routes 2.0.0.beta3 → 2.0.0.beta5

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: 182f550df75c1d2f198a658350022f3023c414064b438a63788f96d1ccc1f9c9
4
- data.tar.gz: 929495d80bd84106a7fdd5e03f26fe5e282724543c8bc4bc3b9d7caf37305ea7
3
+ metadata.gz: 951fb6f791f5b9954bb00deb0692835ed330696c28c7f44e578259fc1f23659c
4
+ data.tar.gz: 2b52416aaf832aefe1666a693e0b2c54591a8828543d5d148a19963a6a8812dc
5
5
  SHA512:
6
- metadata.gz: 815ebca3c626e89b7fda9dc4acef77ec76f571abbaaa6c469c795046166206f876b81b30551144d05731516402619f0646810179980e848ee7e7fc3e074ac9ac
7
- data.tar.gz: 7177468892e7d078a8e180e6ca757b1673b0855fc44ec93e6bac03ebf10f1f06b48d93f819414d737d21e972db83c1414e65fb0ab9285f4ddbe7ea9ef61a067c
6
+ metadata.gz: d59c950849ec1e42a778637295ac3741dd79e6ee5f2755d1ecdeeda97b5c712766e931d7b338a40f0ebdc146d5d7dde2521ebc668ace946af982f1e60237c3ba
7
+ data.tar.gz: 448a78419fc53cdd3d02e473ca73334d567249aa831f8ca7c0279681dbc6fe37b92ccb964b2284bd4c632e389c73e32713b148b5313cdfcbf3058316d5b486dc
@@ -1,14 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "flash_additions"
4
-
5
3
  module Bridgetown
6
4
  module Routes
7
5
  module ViewHelpers
8
6
  # This flash is only used as a stub for views in case there's no Roda flash
9
7
  # available in the rendering context
10
8
  class Flash < Hash
11
- include Bridgetown::Routes::FlashHashAdditions
9
+ def info
10
+ self["info"]
11
+ end
12
+
13
+ def info=(val)
14
+ self["info"] = val
15
+ end
16
+
17
+ def alert
18
+ self["alert"]
19
+ end
20
+
21
+ def alert=(val)
22
+ self["alert"] = val
23
+ end
12
24
 
13
25
  def now
14
26
  self
@@ -1,27 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "roda/plugins/flash"
4
- require_relative "../../bridgetown-routes/flash_additions"
5
-
6
- Roda::RodaPlugins::Flash::FlashHash.include Bridgetown::Routes::FlashHashAdditions,
7
- Bridgetown::Routes::FlashHashIndifferent
8
- Roda::RodaPlugins::Flash::FlashHash.class_eval do
9
- def initialize(hash = {})
10
- super(hash || {})
11
- now.singleton_class.include Bridgetown::Routes::FlashHashAdditions,
12
- Bridgetown::Routes::FlashNowHashIndifferent
13
- @next = {}
14
- end
15
- end
16
-
17
3
  class Roda
18
4
  module RodaPlugins
19
5
  module BridgetownRoutes
20
6
  def self.load_dependencies(app)
21
7
  app.plugin :slash_path_empty # now /hello and /hello/ are both matched
22
8
  app.plugin :placeholder_string_matchers
23
- app.plugin :flash
24
- app.plugin :route_csrf
25
9
  end
26
10
 
27
11
  def self.configure(app, _opts = {})
@@ -130,10 +114,14 @@ class Roda
130
114
  module RequestMethods
131
115
  # This runs through all of the routes in the manifest, setting up Roda blocks for execution
132
116
  def file_routes
117
+ base_path = Bridgetown::Current.preloaded_configuration.base_path.delete_prefix("/")
118
+
133
119
  scope.routes_manifest.routes.each do |route|
134
120
  file, localized_file_slugs, segment_keys = route
135
121
 
136
122
  localized_file_slugs.each do |slug|
123
+ on("") { scope.run_file_route(file, slug:) } if slug == "index" && !base_path.empty?
124
+
137
125
  # This sets up an initial Roda route block at the slug, and handles segments as params
138
126
  #
139
127
  # _routes/nested/[slug].erb -> "nested/:slug"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bridgetown-routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta3
4
+ version: 2.0.0.beta5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-16 00:00:00.000000000 Z
11
+ date: 2025-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bridgetown-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.0.beta3
19
+ version: 2.0.0.beta5
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.0.0.beta3
26
+ version: 2.0.0.beta5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: roda-route_list
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -49,7 +49,6 @@ files:
49
49
  - bridgetown-routes.gemspec
50
50
  - lib/bridgetown-routes.rb
51
51
  - lib/bridgetown-routes/code_blocks.rb
52
- - lib/bridgetown-routes/flash_additions.rb
53
52
  - lib/bridgetown-routes/manifest.rb
54
53
  - lib/bridgetown-routes/manifest_router.rb
55
54
  - lib/bridgetown-routes/view_helpers.rb
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Bridgetown
4
- module Routes
5
- module FlashHashAdditions
6
- def info
7
- self["info"]
8
- end
9
-
10
- def info=(val)
11
- self["info"] = val
12
- end
13
-
14
- def alert
15
- self["alert"]
16
- end
17
-
18
- def alert=(val)
19
- self["alert"] = val
20
- end
21
- end
22
-
23
- module FlashHashIndifferent
24
- def []=(key, val)
25
- @next[key.to_s] = val
26
- end
27
- end
28
-
29
- module FlashNowHashIndifferent
30
- def []=(key, val)
31
- super(key.to_s, val)
32
- end
33
-
34
- def [](key)
35
- super(key.to_s)
36
- end
37
- end
38
- end
39
- end