sitepress-server 2.0.0.beta7 → 2.0.0.beta8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc0c1f24f54f4797115a16af31397d5750fb19de776212d9ab99c08fbafd8e0b
4
- data.tar.gz: 5667b176d593ec57745d95208dcc0dfedfdef1ef7e61d91663b22b55da11a92b
3
+ metadata.gz: 46ba307678356c1c028cd219e4f97a0982141489156cebe7f7c079ddb88518f6
4
+ data.tar.gz: 8d30d6f0477ff64e396aabd53cab3d9c6ad3770481c3be1c25fd28c83222b4d5
5
5
  SHA512:
6
- metadata.gz: 369492dcce5982ec631a3739cacfef6dc628a76a0c51c2dc495983a42a16ee78c6aa215da17e4e75792ec1730e71dc40e89b63e2d2e73cd74c3381af4372f363
7
- data.tar.gz: 375b6d7748d9e14ec3b7940695cf41d6695eb44abfb54019b2e84c40266e1a1fdaf0d3309b2d5e19a35e3e097cf2f6a8a381064cbf6c8ae84e3e5bcb46fc9315
6
+ metadata.gz: 37d64180dc1784a7d3608538e910fe9383c0d16c6bb485901a5cd3779b82f988627e2d61cf6175cb01da3518b59d4568623241d2cda779ab9b4affbc0ea8342d
7
+ data.tar.gz: e4c125e2c6289aaaf58d513d382036abb66db1bbd098fbea5ada5e96a6ea7c31d361c6f940020addfadc6e534e74caa6d0139f7a488e765cc20b7f1bc2f376bf
@@ -1,6 +1,16 @@
1
1
  class SiteController < ApplicationController
2
2
  DEFAULT_SITE_LAYOUT = "layouts/layout".freeze
3
3
 
4
+ # Control whether or not to display friendly error reporting messages
5
+ # in Sitepress. The development server turns this on an handles exception,
6
+ # while the compile and other environments would likely have this disabled.
7
+ class_attribute :enable_sitepress_error_reporting, default: false
8
+
9
+ # When in a development environment, we'll want to reload the site between
10
+ # requests so we can see the latest changes; otherwise, load the site once
11
+ # and we're done.
12
+ class_attribute :enable_site_reloading, default: false
13
+
4
14
  # This `rescue_from` order is important; it must come before the
5
15
  # `include Sitepress::SitePages` statement; otherwise exceptions
6
16
  # won't be properly handled.
@@ -16,13 +26,25 @@ class SiteController < ApplicationController
16
26
  end
17
27
 
18
28
  def sitepress_error(exception)
29
+ raise exception unless has_error_reporting_enabled?
30
+
19
31
  @title = "Sitepress error in #{current_page.asset.path}".html_safe
20
32
  @exception = exception
21
33
  render "error", layout: "sitepress", status: :internal_server_error
22
34
  end
23
35
 
24
36
  def page_not_found(exception)
37
+ raise exception unless has_error_reporting_enabled?
38
+
25
39
  @title = "Sitepress page #{params[:resource_path].inspect} not found"
26
40
  render "page_not_found", layout: "sitepress", status: :not_found
27
41
  end
42
+
43
+ def has_error_reporting_enabled?
44
+ self.class.enable_sitepress_error_reporting
45
+ end
46
+
47
+ def reload_site?
48
+ self.class.enable_site_reloading
49
+ end
28
50
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitepress-server
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta7
4
+ version: 2.0.0.beta8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack-test
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 2.0.0.beta7
33
+ version: 2.0.0.beta8
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 2.0.0.beta7
40
+ version: 2.0.0.beta8
41
41
  description:
42
42
  email:
43
43
  - bradgessler@gmail.com