configurable_engine 1.0.0 → 2.0.0

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: 70df04df8400f52621c669ff912d9b648b4cac4a1107b3e5e0e102f2aeaabe51
4
- data.tar.gz: 3a32bee140f6e905ce74f5079ed034611055f46727645f8dbe39ff22e7e4d9a0
3
+ metadata.gz: 541d4ad357b6438a52c6b017f67cd7d83a3f84069671c69952a55babc64afec9
4
+ data.tar.gz: 99acc47f826dedf5d0b6a6e35020864028e58977c8a6f072ac9a4152b62e29df
5
5
  SHA512:
6
- metadata.gz: 9fe20672f98d7b4166c224d73bf1d10675a71418d3a32dcc7e952cba3a0dffa62c4e03635877fa097c21e592a970f8d952c8602c6fc7db91e39857b1710b0339
7
- data.tar.gz: c77bb417b1bf4cbe6f4d23b9875049fedd05fcbad8efb6db25f87f698ec7c70fa97eda580dd11da0e4b842caaf8d40fab1e76cd570fb6fcc85af9bb8a438f7f8
6
+ metadata.gz: df600a1f9d9c6af12d826983027fd05bdd90f0879d0cfea87320fccfe4301df62296c5e05b552c3c75ed9f90059ea630e4dd927808a7a25ab0f0371dbbd75c35
7
+ data.tar.gz: b2e0e897399245a072d060d7e714baf3924a393cde664cd8449ea10c98dacee9e01cbba086d1b12fc4dd9688183f1793d6fbfcef5a4beb9a348632607aa99eaa
@@ -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::ConfigurablesController
67
+ include ConfigurableEngine::ConfigurablesControllerMethods
62
68
 
63
69
  # add your own filter(s) / layout
64
70
  before_filter :protect_my_code
@@ -0,0 +1,5 @@
1
+ module ConfigurableEngine
2
+ class ConfigurablesController < ApplicationController
3
+ include ConfigurableEngine::ConfigurablesControllerMethods
4
+ end
5
+ end
@@ -5,7 +5,7 @@
5
5
  </div>
6
6
 
7
7
  <div class="configurable-options">
8
- <%= form_tag(admin_configurable_path, :method => :put) do -%>
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">
@@ -1,5 +1,3 @@
1
- Rails.application.routes.draw do
2
- namespace :admin do
3
- resource :configurable
4
- end
5
- end
1
+ ConfigurableEngine::Engine.routes.draw do
2
+ resource :configurable, path: '/'
3
+ end
@@ -1,2 +1,2 @@
1
1
  require 'configurable_engine/engine'
2
- require 'configurable_engine/configurables_controller'
2
+ require 'configurable_engine/configurables_controller_methods'
@@ -1,5 +1,5 @@
1
1
  module ConfigurableEngine
2
- module ConfigurablesController
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 admin_configurable_path, :notice => "Changes successfully updated"
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 admin_configurable_path
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
@@ -1,3 +1,3 @@
1
1
  module ConfigurableEngine
2
- VERSION = '1.0.0'
2
+ VERSION = '2.0.0'
3
3
  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: 1.0.0
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/admin/configurables_controller.rb
41
+ - app/controllers/configurable_engine/configurables_controller.rb
42
42
  - app/models/configurable.rb
43
- - app/views/admin/configurables/show.html.erb
43
+ - app/views/configurable_engine/configurables/show.html.erb
44
44
  - config/routes.rb
45
45
  - lib/configurable_engine.rb
46
- - lib/configurable_engine/configurables_controller.rb
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
@@ -1,3 +0,0 @@
1
- class Admin::ConfigurablesController < ApplicationController
2
- include ConfigurableEngine::ConfigurablesController
3
- end