sitepress-server 2.0.0.beta3 → 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: ea26c8a6dac2ad1635665d5dab3c521846c8c710beacc32c5c97733d3d7de3e2
4
- data.tar.gz: 2bb5be5ea2df1df9b11b196477971104dbe2834d99a3281205fb561e19ee1c25
3
+ metadata.gz: 46ba307678356c1c028cd219e4f97a0982141489156cebe7f7c079ddb88518f6
4
+ data.tar.gz: 8d30d6f0477ff64e396aabd53cab3d9c6ad3770481c3be1c25fd28c83222b4d5
5
5
  SHA512:
6
- metadata.gz: 4746f4e6a5a836e72aa6849ca570a7aaefd7cf427f5acd6e84388ed51ea7bb19dc82d545143a2a2708410300ccf4ebb40a7e6fc965ac6b1be23bf00545289c9e
7
- data.tar.gz: 4460514b785feccc4aba2993e6fa2157810bb6fefde60371f6e898ccb1c311ace0bc9b1f8b949427fce3a38c7037c664a2dea90f80559c96fcac04937f3f4bdc
6
+ metadata.gz: 37d64180dc1784a7d3608538e910fe9383c0d16c6bb485901a5cd3779b82f988627e2d61cf6175cb01da3518b59d4568623241d2cda779ab9b4affbc0ea8342d
7
+ data.tar.gz: e4c125e2c6289aaaf58d513d382036abb66db1bbd098fbea5ada5e96a6ea7c31d361c6f940020addfadc6e534e74caa6d0139f7a488e765cc20b7f1bc2f376bf
@@ -41,6 +41,9 @@ module Sitepress
41
41
  # Allow any host to connect to the development server. The actual binding is
42
42
  # controlled by server in the `sitepress-cli`; not by Rails.
43
43
  config.hosts << proc { true } if config.respond_to? :hosts
44
+
45
+ # Stand-alone boot locations
46
+ paths["config/initializers"] << File.expand_path("./config/initializers")
44
47
  end
45
48
  end
46
49
 
@@ -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.beta3
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-02-24 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.beta3
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.beta3
40
+ version: 2.0.0.beta8
41
41
  description:
42
42
  email:
43
43
  - bradgessler@gmail.com
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  - !ruby/object:Gem::Version
77
77
  version: 1.3.1
78
78
  requirements: []
79
- rubygems_version: 3.2.3
79
+ rubygems_version: 3.1.4
80
80
  signing_key:
81
81
  specification_version: 4
82
82
  summary: Sitepress rack app for stand-alone of embedded usage.