plug 0.1.22 → 0.1.23
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 +4 -4
- data/README.md +7 -10
- data/app/controllers/plug/api/features_controller.rb +21 -0
- data/app/models/plug/resources/feature.rb +15 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20171207020316_create_plug_features.rb +1 -1
- data/db/migrate/20180128202026_add_notice_to_plug_features.rb +1 -1
- data/db/migrate/20180403024712_create_plug_site_notices.rb +1 -1
- data/lib/plug/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb469dfe189640aa012dfba0b1784b6b58af48ab0a72f43f86e18aa9557cf342
|
4
|
+
data.tar.gz: b0ecc6ea23fdbfc103e4b66fbd7ac98c6acbad94e580e2b9372cbc5aa4445607
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88ed333f9efd4189debd2e8b892d3da8a33775a1d47919bab8819314b5b0860bb76f0892cb97dee6b93771a5dc543c6c528f3216d42872f5054f0313a5e9840a
|
7
|
+
data.tar.gz: ca7f17e98fc0902191b0734b61c6cb69a4adff7ca3ba7ba1eee7342b0d049793bc06c8022ebf421f1fab2b813ea847432d62f429f2518f44718a8aa41ae2847f
|
data/README.md
CHANGED
@@ -1,16 +1,15 @@
|
|
1
|
-
# Plug [](https://codeclimate.com/github/DigitalNZ/plug/maintainability) [](https://codeclimate.com/github/DigitalNZ/plug/maintainability) [](https://travis-ci.org/DigitalNZ/plug)
|
2
2
|
|
3
3
|
A Rails engine to turn on/off features (Feature flipper).
|
4
4
|
|
5
5
|
### Features
|
6
6
|
|
7
|
-
-
|
8
|
-
-
|
9
|
-
- Set notices
|
7
|
+
- Manage features with notices
|
8
|
+
- Manage site notices with themes
|
10
9
|
|
11
10
|
### Prerequisites
|
12
11
|
|
13
|
-
- Rails version
|
12
|
+
- Rails version 5 and above
|
14
13
|
- MySQL
|
15
14
|
|
16
15
|
### Getting Started
|
@@ -32,9 +31,7 @@ And run the install generator:
|
|
32
31
|
```bash
|
33
32
|
→ rails g plug:install
|
34
33
|
→ rails plug:install:migrations
|
35
|
-
→
|
36
|
-
→ rails db:migrate # Newer version of Rails
|
37
|
-
→ rake db:migrate # Older version of Rails
|
34
|
+
→ rails db:migrate
|
38
35
|
→ rails s
|
39
36
|
```
|
40
37
|
|
@@ -85,7 +82,7 @@ Add buttons to the config block to perform rake tasks from the plug dashboard
|
|
85
82
|
#### Themes
|
86
83
|
Themes can be added in Site Notices. Themes are just string stored in the database. You still need to style the theme.
|
87
84
|
|
88
|
-
By default, we have `default` and `dark` in `config/plug.rb
|
85
|
+
By default, we have `default` and `dark` in `config/plug.rb`. Below is an example on how you can utilise the theme string.
|
89
86
|
|
90
87
|
```haml
|
91
88
|
- theme_class = "site-notice--#{site_notice.theme}"
|
@@ -125,7 +122,7 @@ By default, we have `default` and `dark` in `config/plug.rb`
|
|
125
122
|
|
126
123
|
### Publishing to `rubygems.org`
|
127
124
|
|
128
|
-
Make sure to bump the version. Rubygems don't accept version overrides.
|
125
|
+
Make sure to **bump** the version. Rubygems don't accept version overrides.
|
129
126
|
|
130
127
|
```bash
|
131
128
|
→ gem build plug.gemspec
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require_dependency 'plug/application_controller'
|
2
|
+
|
3
|
+
module Plug
|
4
|
+
module Api
|
5
|
+
class FeaturesController < ApiController
|
6
|
+
# GET /features.json
|
7
|
+
def index
|
8
|
+
@features = Feature.all
|
9
|
+
|
10
|
+
render json: @features
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /features/slug.json
|
14
|
+
def show
|
15
|
+
@feature = Feature.slug_and_name(params[:slug]).first
|
16
|
+
|
17
|
+
render json: @feature
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/config/routes.rb
CHANGED
@@ -10,6 +10,8 @@ Plug::Engine.routes.draw do
|
|
10
10
|
namespace :api, defaults: { format: :json } do
|
11
11
|
get '/site_notices/:slug', to: 'site_notices#show'
|
12
12
|
get '/site_notices', to: 'site_notices#index'
|
13
|
+
get '/features/:slug', to: 'features#show'
|
14
|
+
get '/features', to: 'features#index'
|
13
15
|
end
|
14
16
|
|
15
17
|
post '/task', to: 'features#task_execution', as: :task_execution
|
data/lib/plug/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2021-02-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -228,6 +228,7 @@ files:
|
|
228
228
|
- app/assets/stylesheets/plug/variables/_colors.scss
|
229
229
|
- app/assets/stylesheets/plug/variables/_typography.scss
|
230
230
|
- app/controllers/plug/api/api_controller.rb
|
231
|
+
- app/controllers/plug/api/features_controller.rb
|
231
232
|
- app/controllers/plug/api/site_notices_controller.rb
|
232
233
|
- app/controllers/plug/application_controller.rb
|
233
234
|
- app/controllers/plug/features_controller.rb
|
@@ -237,6 +238,7 @@ files:
|
|
237
238
|
- app/models/plug/application_record.rb
|
238
239
|
- app/models/plug/concerns/model_helpers.rb
|
239
240
|
- app/models/plug/feature.rb
|
241
|
+
- app/models/plug/resources/feature.rb
|
240
242
|
- app/models/plug/resources/site_notice.rb
|
241
243
|
- app/models/plug/site_notice.rb
|
242
244
|
- app/services/plug/task_execution_service.rb
|