configurable_engine 1.0.0 → 2.0.0
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/CHANGELOG.md +7 -0
- data/README.md +7 -1
- data/app/controllers/configurable_engine/configurables_controller.rb +5 -0
- data/app/views/{admin → configurable_engine}/configurables/show.html.erb +1 -1
- data/config/routes.rb +3 -5
- data/lib/configurable_engine.rb +1 -1
- data/lib/configurable_engine/{configurables_controller.rb → configurables_controller_methods.rb} +4 -4
- data/lib/configurable_engine/engine.rb +4 -2
- data/lib/configurable_engine/version.rb +1 -1
- data/lib/generators/configurable_engine/install_generator.rb +5 -1
- data/lib/generators/configurable_engine/templates/migration.rb +2 -2
- metadata +4 -4
- data/app/controllers/admin/configurables_controller.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 541d4ad357b6438a52c6b017f67cd7d83a3f84069671c69952a55babc64afec9
|
4
|
+
data.tar.gz: 99acc47f826dedf5d0b6a6e35020864028e58977c8a6f072ac9a4152b62e29df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df600a1f9d9c6af12d826983027fd05bdd90f0879d0cfea87320fccfe4301df62296c5e05b552c3c75ed9f90059ea630e4dd927808a7a25ab0f0371dbbd75c35
|
7
|
+
data.tar.gz: b2e0e897399245a072d060d7e714baf3924a393cde664cd8449ea10c98dacee9e01cbba086d1b12fc4dd9688183f1793d6fbfcef5a4beb9a348632607aa99eaa
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
### v2.0.0 - August 20, 2020
|
2
|
+
**features**
|
3
|
+
Configurable_Engine is mountable. This allows folks to use it with a catch-all route
|
4
|
+
|
5
|
+
**breaking changes**
|
6
|
+
Existing users must add `mount ConfigurableEngine::Engine, at: "/admin/configurable"` to their routes.rb. Routing helpers may not work as they used to.
|
7
|
+
|
1
8
|
### v1.0.0 - August 20, 2020
|
2
9
|
**features**
|
3
10
|
Official rails 5.2 support
|
data/README.md
CHANGED
@@ -22,6 +22,12 @@ Then run the `configurable_engine:install` generator:
|
|
22
22
|
$ rails generate configurable_engine:install
|
23
23
|
```
|
24
24
|
|
25
|
+
this will
|
26
|
+
- add config/configurable.yml
|
27
|
+
- create a migration for your configurable table
|
28
|
+
- mount the UI in your routes (defaulting to admin/configurables)
|
29
|
+
|
30
|
+
|
25
31
|
## Usage ##
|
26
32
|
|
27
33
|
There are two parts to how configurable_engine works. First of all there is a config file, `config/configurable.yml`. This file controls the variables that are allowed to be set in the app.
|
@@ -58,7 +64,7 @@ and include `ConfigurableEngine::ConfigurablesController`, eg.
|
|
58
64
|
```ruby
|
59
65
|
class Admin::ConfigurablesController < ApplicationController
|
60
66
|
# include the engine controller actions
|
61
|
-
include ConfigurableEngine::
|
67
|
+
include ConfigurableEngine::ConfigurablesControllerMethods
|
62
68
|
|
63
69
|
# add your own filter(s) / layout
|
64
70
|
before_filter :protect_my_code
|
@@ -5,7 +5,7 @@
|
|
5
5
|
</div>
|
6
6
|
|
7
7
|
<div class="configurable-options">
|
8
|
-
<%= form_tag(
|
8
|
+
<%= form_tag(configurable_path, :method => :put) do -%>
|
9
9
|
<%- @keys.each do |key| -%>
|
10
10
|
<%- options = Configurable.defaults[key] -%>
|
11
11
|
<div class="configurable">
|
data/config/routes.rb
CHANGED
data/lib/configurable_engine.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'configurable_engine/engine'
|
2
|
-
require 'configurable_engine/
|
2
|
+
require 'configurable_engine/configurables_controller_methods'
|
data/lib/configurable_engine/{configurables_controller.rb → configurables_controller_methods.rb}
RENAMED
@@ -1,5 +1,5 @@
|
|
1
1
|
module ConfigurableEngine
|
2
|
-
module
|
2
|
+
module ConfigurablesControllerMethods
|
3
3
|
def show
|
4
4
|
@keys = Configurable.keys
|
5
5
|
end
|
@@ -15,11 +15,11 @@ module ConfigurableEngine
|
|
15
15
|
end
|
16
16
|
|
17
17
|
if failures.empty?
|
18
|
-
redirect_to
|
18
|
+
redirect_to configurable_path, :notice => "Changes successfully updated"
|
19
19
|
else
|
20
20
|
flash[:error] = failures.flat_map(&:errors).flat_map(&:full_messages).join(',')
|
21
|
-
redirect_to
|
21
|
+
redirect_to configurable_path
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module ConfigurableEngine
|
2
|
-
class Engine < Rails::Engine
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
engine_name "configurable"
|
4
|
+
isolate_namespace ConfigurableEngine
|
3
5
|
config.use_cache = false
|
4
6
|
config.generators do |g|
|
5
7
|
g.test_framework :rspec
|
6
8
|
end
|
7
9
|
end
|
8
|
-
end
|
10
|
+
end
|
@@ -20,5 +20,9 @@ class InstallGenerator < Rails::Generators::Base
|
|
20
20
|
copy_file 'configurable.yml', 'config/configurable.yml'
|
21
21
|
migration_template 'migration.rb', 'db/migrate/create_configurables.rb'
|
22
22
|
end
|
23
|
+
|
24
|
+
def mount_interface
|
25
|
+
route 'mount ConfigurableEngine::Engine, at: "/admin/configurable"'
|
26
|
+
end
|
23
27
|
end
|
24
|
-
end
|
28
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class CreateConfigurables < ActiveRecord::Migration
|
1
|
+
class CreateConfigurables < ActiveRecord::Migration[5.2]
|
2
2
|
def self.up
|
3
3
|
create_table :configurables do |t|
|
4
4
|
t.string :name
|
@@ -14,4 +14,4 @@ class CreateConfigurables < ActiveRecord::Migration
|
|
14
14
|
remove_index :configurables, :name
|
15
15
|
drop_table :configurables
|
16
16
|
end
|
17
|
-
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: configurable_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Campbell
|
@@ -38,12 +38,12 @@ files:
|
|
38
38
|
- CHANGELOG.md
|
39
39
|
- LICENSE.txt
|
40
40
|
- README.md
|
41
|
-
- app/controllers/
|
41
|
+
- app/controllers/configurable_engine/configurables_controller.rb
|
42
42
|
- app/models/configurable.rb
|
43
|
-
- app/views/
|
43
|
+
- app/views/configurable_engine/configurables/show.html.erb
|
44
44
|
- config/routes.rb
|
45
45
|
- lib/configurable_engine.rb
|
46
|
-
- lib/configurable_engine/
|
46
|
+
- lib/configurable_engine/configurables_controller_methods.rb
|
47
47
|
- lib/configurable_engine/engine.rb
|
48
48
|
- lib/configurable_engine/version.rb
|
49
49
|
- lib/generators/configurable_engine/install_generator.rb
|