plug 0.1.22 → 0.1.23

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: 26cd866545ec8b6b12dc3cd25ea7ec9b7cab3ed4fbb06ff083706e30d721f433
4
- data.tar.gz: 51d445dd19b35b5374e27a6624e2cb452eaef92e9cc91f69da21c80720e8b197
3
+ metadata.gz: eb469dfe189640aa012dfba0b1784b6b58af48ab0a72f43f86e18aa9557cf342
4
+ data.tar.gz: b0ecc6ea23fdbfc103e4b66fbd7ac98c6acbad94e580e2b9372cbc5aa4445607
5
5
  SHA512:
6
- metadata.gz: e5258d4baba38a6ae2bd2f7976b98d0fe283e0edf9bdd54c309d7e7c2063105520d454b6436e506b80dfaf13d8d59ad63e18d8f31d57247103a110c6ab86c29d
7
- data.tar.gz: 57f1a5ad4b52487c6aa734d1f318663d730dc74c0c54ee3ab81cc8d1e401947483327c502a765defe52cc02ce1790d13f18fd81bd166c713a9a1dd18217cafe4
6
+ metadata.gz: 88ed333f9efd4189debd2e8b892d3da8a33775a1d47919bab8819314b5b0860bb76f0892cb97dee6b93771a5dc543c6c528f3216d42872f5054f0313a5e9840a
7
+ data.tar.gz: ca7f17e98fc0902191b0734b61c6cb69a4adff7ca3ba7ba1eee7342b0d049793bc06c8022ebf421f1fab2b813ea847432d62f429f2518f44718a8aa41ae2847f
data/README.md CHANGED
@@ -1,16 +1,15 @@
1
- # Plug [![Maintainability](https://api.codeclimate.com/v1/badges/6246b1cd8e42603c42f6/maintainability)](https://codeclimate.com/github/DigitalNZ/plug/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/6246b1cd8e42603c42f6/test_coverage)](https://codeclimate.com/github/DigitalNZ/plug/test_coverage) [![Build Status](https://travis-ci.org/DigitalNZ/plug.svg?branch=master)](https://travis-ci.org/DigitalNZ/plug)
1
+ # Plug [![Maintainability](https://api.codeclimate.com/v1/badges/6246b1cd8e42603c42f6/maintainability)](https://codeclimate.com/github/DigitalNZ/plug/maintainability) [![Build Status](https://travis-ci.org/DigitalNZ/plug.svg?branch=master)](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
- - Supports Rails 3 and above
8
- - MySQL
9
- - Set notices
7
+ - Manage features with notices
8
+ - Manage site notices with themes
10
9
 
11
10
  ### Prerequisites
12
11
 
13
- - Rails version 3 and above
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
- rake plug:install:migrations # For Rails <= 3.x
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
@@ -0,0 +1,15 @@
1
+ module Plug
2
+ module Resources
3
+ class Feature < ActiveResource::Base
4
+ self.site = Plug.api_path
5
+
6
+ def enabled?
7
+ state == 'enabled'
8
+ end
9
+
10
+ def disabled?
11
+ state == 'disabled'
12
+ end
13
+ end
14
+ end
15
+ 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
@@ -1,4 +1,4 @@
1
- class CreatePlugFeatures < ActiveRecord::Migration
1
+ class CreatePlugFeatures < ActiveRecord::Migration[5.1]
2
2
  def change
3
3
  create_table :plug_features do |t|
4
4
  t.string :name
@@ -1,4 +1,4 @@
1
- class AddNoticeToPlugFeatures < ActiveRecord::Migration
1
+ class AddNoticeToPlugFeatures < ActiveRecord::Migration[5.1]
2
2
  def change
3
3
  add_column :plug_features, :notice, :text
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreatePlugSiteNotices < ActiveRecord::Migration
1
+ class CreatePlugSiteNotices < ActiveRecord::Migration[5.1]
2
2
  def change
3
3
  create_table :plug_site_notices do |t|
4
4
  t.string :name
data/lib/plug/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Plug
2
- VERSION = '0.1.22'
2
+ VERSION = '0.1.23'
3
3
  end
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.22
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: 2020-06-09 00:00:00.000000000 Z
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