plug 0.1.7 → 0.1.8
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 +53 -13
- data/lib/generators/plug/install_generator.rb +13 -0
- data/lib/generators/plug/templates/plug.rb +6 -0
- data/lib/plug/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19246ab9387032253ed9b13aac4fb10bd03cbf41
|
4
|
+
data.tar.gz: b63f935e9e157e70d1b98d9583c0d478ed541ce4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a48e1d5fbe882b65012799c3a18445c54fb8097bb61c7fd4ddc93b79798e0589228ffb099a224c7668e9c4490eaa7acb1eb69cd492121162dad48a602d9cb011
|
7
|
+
data.tar.gz: 50323022408bd5474cabbe4d3a18e154021a2a2a843841a6c848fb9b9559af1454d3d4438b93ffc6993777b58d7ae9f2d0cd7b1eae87152845bfba5c2a2e4308
|
data/README.md
CHANGED
@@ -1,28 +1,68 @@
|
|
1
|
-
# Plug
|
2
|
-
Short description and motivation.
|
1
|
+
# 🔌 Plug
|
3
2
|
|
4
|
-
|
5
|
-
|
3
|
+
A Rails engine to turn on/off features (Feature flipper).
|
4
|
+
|
5
|
+
### Features
|
6
|
+
|
7
|
+
- Supports Rails 3 and above
|
8
|
+
- MySQL
|
9
|
+
- Set notices (WIP)
|
10
|
+
|
11
|
+
### Prerequisites
|
12
|
+
|
13
|
+
- Rails version 3 and above
|
14
|
+
- MySQL
|
15
|
+
|
16
|
+
### Getting Started
|
6
17
|
|
7
|
-
## Installation
|
8
18
|
Add this line to your application's Gemfile:
|
9
19
|
|
10
20
|
```ruby
|
11
21
|
gem 'plug'
|
12
22
|
```
|
13
23
|
|
14
|
-
|
24
|
+
Execute:
|
25
|
+
|
15
26
|
```bash
|
16
|
-
|
27
|
+
→ bundle
|
17
28
|
```
|
18
29
|
|
19
|
-
|
30
|
+
And run the install generator:
|
31
|
+
|
20
32
|
```bash
|
21
|
-
|
33
|
+
→ rails g plug:install
|
34
|
+
→ rails g plug:install:migrations
|
35
|
+
→ rails db:migrate # Newer version of Rails
|
36
|
+
→ rake db:migrate # Older version of Rails
|
37
|
+
→ rails s
|
22
38
|
```
|
23
39
|
|
24
|
-
|
25
|
-
|
40
|
+
### Usage
|
41
|
+
|
42
|
+
Go to `localhost:3000/plug` and start creating features.
|
43
|
+
|
44
|
+
Use the provided method to check if the feature is enabled.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
Plug.enabled?('my-awesome-feature-slug')
|
48
|
+
```
|
49
|
+
|
50
|
+
If you wanted to restrict routes, you can use `Plug::Constraint` class
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
Rails.application.routes.draw do
|
54
|
+
resources :blog, constraint: Plug::Constraint.new('my-awesome-feature-slug')
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
### Questions/Issues?
|
59
|
+
|
60
|
+
File a new [issue](https://github.com/boost/plug/issues/new) if you have questions or issues.
|
61
|
+
|
62
|
+
### Contributing
|
26
63
|
|
27
|
-
|
28
|
-
|
64
|
+
1. Fork it ( https://github.com/boost/plug/fork )
|
65
|
+
2. Create your feature branch (`git checkout -b my-awesome-feature`)
|
66
|
+
3. Commit your changes (`git commit -am 'Add my awesome feature!'`)
|
67
|
+
4. Push to the branch (`git push origin my-awesome-feature`)
|
68
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Plug
|
2
|
+
class InstallGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path("../templates", __FILE__)
|
4
|
+
|
5
|
+
def copy_initializer_file
|
6
|
+
copy_file 'plug.rb', 'config/initializers/plug.rb'
|
7
|
+
end
|
8
|
+
|
9
|
+
def mount_engine
|
10
|
+
inject_into_file('config/routes.rb', "\n mount Plug::Engine => '/plug', as: 'plug'\n\n", :before => /^end/)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
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.8
|
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: 2017-12-
|
12
|
+
date: 2017-12-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -222,6 +222,8 @@ files:
|
|
222
222
|
- app/views/plug/shared/_nav.html.haml
|
223
223
|
- config/routes.rb
|
224
224
|
- db/migrate/20171207020316_create_plug_features.rb
|
225
|
+
- lib/generators/plug/install_generator.rb
|
226
|
+
- lib/generators/plug/templates/plug.rb
|
225
227
|
- lib/plug.rb
|
226
228
|
- lib/plug/configuration.rb
|
227
229
|
- lib/plug/constraint.rb
|