bard-static 3.1.4 → 3.2.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: be71bc43817d131da7cacf68c01fd67fde1ff7030a5fd62bd985bf6f0a778b8b
4
- data.tar.gz: 305b7efe5fedb0d64be0ecf3bb4514eb5b0e2cd73b8f3e67a8659c50bafc0155
3
+ metadata.gz: 4a3b9f9931685d93b3d6bb8f125f3db67fbf163d079a6613ad1e0e85b91e3a8e
4
+ data.tar.gz: eedf16b063d490fa8056bff8334010cc1dce0d0f63e51a1b449f5599eac176b3
5
5
  SHA512:
6
- metadata.gz: 6873443d8f2150c420f1eae53084e354beec7684e07741c704b8c0e23688a4c6100bc9fe0185521700fd545650c72ad3d02aecdb4aa906b7a1bb880a1993ccb5
7
- data.tar.gz: 8386850d6546957242ef7b3041f5367951cd2700b70baeb8fdae446eb86eaf932ad099aa7613560c16a696dff521b82ee84fd4d7df6c3937ce080d3458935926
6
+ metadata.gz: 6986e4cc858f7bf32b0b3acc530d0274830fafb11e68907619bbae29cfe017efcd95eb617dcb3da0e269321430d950c18e444cab12b7614acf6228fcdd70213d
7
+ data.tar.gz: ff6c0fc341655efa41d26da5c9a196f59baa34fe5a65ed80b79c33b285737996341277b8bc17b4a0583964fbe2a195322bfb2818bca9c7abe473e3c9e64498b3
@@ -17,7 +17,7 @@ module Bard
17
17
  begin
18
18
  yield
19
19
  rescue ActionView::MissingTemplate
20
- render text: "Not Found", status: 404
20
+ render plain: "Not Found", status: 404
21
21
  end
22
22
  end
23
23
 
@@ -0,0 +1,25 @@
1
+ module Bard
2
+ module Static
3
+ class MockupInProductionError < StandardError
4
+ def initialize(path)
5
+ super("Mockup pages are not available in production: #{path}")
6
+ end
7
+ end
8
+
9
+ class BlockMockupsInProductionMiddleware
10
+ def initialize(app)
11
+ @app = app
12
+ end
13
+
14
+ def call(env)
15
+ request = Rack::Request.new(env)
16
+
17
+ if Rails.env.production? && request.path.start_with?("/mockups")
18
+ raise MockupInProductionError.new(request.path)
19
+ end
20
+
21
+ @app.call(env)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  module Bard
2
2
  module Static
3
- VERSION = "3.1.4"
3
+ VERSION = "3.2.0"
4
4
  end
5
5
  end
data/lib/bard/static.rb CHANGED
@@ -1,10 +1,12 @@
1
1
  require "bard/static/no_robots_middleware"
2
+ require "bard/static/block_mockups_in_production_middleware"
2
3
  require_relative "../../app/helpers/bard/static/mockup_helper"
3
4
 
4
5
  module Bard
5
6
  module Static
6
7
  class Engine < ::Rails::Engine
7
8
  config.app_middleware.use NoRobotsMiddleware
9
+ config.app_middleware.use BlockMockupsInProductionMiddleware
8
10
 
9
11
  initializer "nacelle integration" do
10
12
  Cell::Base.class_eval do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bard-static
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Micah Geisel
@@ -9,10 +9,10 @@ authors:
9
9
  - Vesa Vänskä
10
10
  - Matias Korhonen
11
11
  - Antti Salonen
12
- autorequire:
12
+ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2025-04-15 00:00:00.000000000 Z
15
+ date: 2025-11-24 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: ostruct
@@ -46,12 +46,13 @@ files:
46
46
  - config/routes.rb
47
47
  - lib/bard-static.rb
48
48
  - lib/bard/static.rb
49
+ - lib/bard/static/block_mockups_in_production_middleware.rb
49
50
  - lib/bard/static/no_robots_middleware.rb
50
51
  - lib/bard/static/version.rb
51
52
  homepage: https://github.com/botandrose/bard-static
52
53
  licenses: []
53
54
  metadata: {}
54
- post_install_message:
55
+ post_install_message:
55
56
  rdoc_options: []
56
57
  require_paths:
57
58
  - lib
@@ -67,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
68
  version: '0'
68
69
  requirements: []
69
70
  rubygems_version: 3.5.11
70
- signing_key:
71
+ signing_key:
71
72
  specification_version: 4
72
73
  summary: Protoyping engine for Rails.
73
74
  test_files: []