simple-maintenance-mode 0.0.2 → 0.0.3

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: 30305a8b24e502f3a5cd27850b4b502d404956938048ce83fbe032e870a141f6
4
- data.tar.gz: 7f3d7fbb8a872454dfacb16ee610d7984a6f98bbc8a782831074030579365040
3
+ metadata.gz: a078d20b7bf9b245d3a0ca0158f8cefcb7fba3cd61049ea3db4c2eb94b7d315d
4
+ data.tar.gz: 6b0b1a2fd65d2bdff317770de88cb85137ecfae3a7d80d817ba10dd57d8abc49
5
5
  SHA512:
6
- metadata.gz: 9961fcd7fc9b4d1526c2fa2b5c8df9bb4f443d70d2ea0ffeacd49b7b8b372e77acaac5e349ec37dfe53055e434afec9987eab8dfddba2b1e019168c62fae639d
7
- data.tar.gz: 047e7d7f832eac94d81bc2bb6b49e193d4c3747f750330c797f69a9c0f2d7281abef7a0837e0ef05f99898212abbfc4550f24b82aab3b27c9c0f8cd66cd0425a
6
+ metadata.gz: 415dda6ba31c6b8f91ad96bc480253fd9d429f76d60b4988b9cdf117679eee54a3c2a1345245011e46dea1a1b761b50628f7587e14e85f20943837d3c9c65c5d
7
+ data.tar.gz: e7653aacb426bba403fa3d5a0cea2fd4b3e98404f33e0358ee6d2c463c7b3025f531c81acda3d3e1fdc6e69c31a01a7789877cb6d7f2620d236a79fae11be6f2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,5 @@
1
+ 0.0.3 support for any content in app settings, i.e. for maintenance info
2
+
1
3
  0.0.2 introducing 'simple' name prefix for the gem
2
4
 
3
5
  0.0.1 initial maintenance mode implementation
data/README.md CHANGED
@@ -10,11 +10,16 @@ static maintenance mode page (**/maintenance** route). The maintenance mode sett
10
10
  will be stored in a app settings model. Additionally each user will get a cookie
11
11
  when the mode is active and a redirection to the maintenance page will happen.
12
12
 
13
+ ## Usage
14
+
15
+ ### Activating/deactivating the maintenance mode
13
16
  To activate the maintenance mode simply run the rails console and do this:
14
17
  **SimpleMaintenanceMode::Model::AppSettings.maintenance_mode = true**
15
18
 
16
- As a rails app administrator, you will be always able to access the page by using
17
- the **maintenance_mode_override=1** GET parameter.
19
+ ### Overriding maintenance mode for adminis
20
+ As a rails app administrator, you will be always able to access the page by using the **maintenance_mode_override=1** GET parameter. This will set a cookie and allow administrators to see the app without beeing redirected to the maintenance page. To activate the override access you webapp similar to this: `https://<you-app-domain>/?maintenance_mode_override=1`.
21
+
22
+ To remove the override, simply delete the `maintenance_mode_override` cookie.
18
23
 
19
24
 
20
25
  ## Installation
@@ -50,4 +55,11 @@ SimpleMaintenanceMode::Model::AppSettings.maintenance_mode
50
55
 
51
56
  # set maintenance mode
52
57
  SimpleMaintenanceMode::Model::AppSettings.maintenance_mode = true|false
58
+
59
+ # use content for custom contents, i.e.
60
+ SimpleMaintenanceMode::Model::AppSettings.content.maintenance_info = {
61
+ title: 'This website is in maintenance',
62
+ message: 'The maintenace will take 10min.'
63
+ }
64
+ # later you can use it in
53
65
  ````
@@ -3,6 +3,7 @@ class CreateAppSettings < ActiveRecord::Migration
3
3
  create_table :app_settings do |t|
4
4
  t.boolean :maintenance_mode, :default => false
5
5
  t.text :meta
6
+ t.text :content, limit: 1.megabyte
6
7
  t.timestamps
7
8
  end
8
9
  end
@@ -6,7 +6,9 @@ module SimpleMaintenanceMode
6
6
  class AppSettings < ActiveRecord::Base
7
7
 
8
8
  acts_as_singleton
9
-
9
+
10
+ store :content, accessors: [ :maintenance_message ], coder: JSON
11
+
10
12
  def self.maintenance_mode=(active=false)
11
13
  app_settings = SimpleMaintenanceMode::Model::AppSettings.instance
12
14
  app_settings.maintenance_mode = active
@@ -1,3 +1,3 @@
1
1
  module SimpleMaintenanceMode
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-maintenance-mode
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Musial-Bright
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-28 00:00:00.000000000 Z
11
+ date: 2023-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport