thecore_settings 2.0.5 → 2.0.6

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: b80a5227b7b718b9f7c3f4c2059b189b3fba50cb4e15e844e43d01f0516147ff
4
- data.tar.gz: 44c8de8d6df9de9dae5221a5bee718302eb447151b107e8de469049e9b076115
3
+ metadata.gz: b65e652f01e41f30c470e5a736cc790bb6e250b087761aedb73275637d72a81c
4
+ data.tar.gz: a57e03cab15a19487331af09c402e07fde8a7adcb8119234ab71d4ceea0cdea6
5
5
  SHA512:
6
- metadata.gz: bba739928691ce2e85a2cfae56b3d6f7d055c68bc7d5eb9f44653e68b1b3cf4768dcc4181c3deb6ad90f410d1baff5342d868d9b04cc558622f6a788ae0eaa48
7
- data.tar.gz: a41bdfaef30dd124fe97b28803922ed61f95d0107d059243f6a9807da041cd2b29613e0c7146388d59e5485249a6555cd3bb46d64b9769c5de1aae2288b760ce
6
+ metadata.gz: 0f2c04dc99afda466f11270c7e7b66756e058ad93a6fcc940ab4d5ae181d2f4bec89cb6fbee12abfc236e9a4fed603504e78950b725ea6128e3f65f39268c852
7
+ data.tar.gz: c2fa3113fa63219cae718ddb22dd7c7c0c724ced7fce14746293e70149fcd8982e913bcf2d0bb979ef8ff94bdbaacfb80c1901afedc778faada5396a8ad65789
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- thecore_settings (2.0.0)
4
+ thecore_settings (2.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,4 +1,4 @@
1
- class CreateThecoreSettings < ActiveRecord::Migration[5.0]
1
+ class CreateThecoreSettings < ActiveRecord::Migration[5.2]
2
2
  def change
3
3
  create_table :thecore_settings do |t|
4
4
  t.boolean :enabled, default: true
@@ -0,0 +1,22 @@
1
+ class MigrateFromRailsAdminSettingsToThecoreSettings < ActiveRecord::Migration[5.2]
2
+
3
+ module RailsAdminSettings
4
+ class Setting < ActiveRecord::Base
5
+ self.table_name = "rails_admin_settings"
6
+ end
7
+ end
8
+
9
+ def change
10
+ if RailsAdminSettings::Setting.table_exists?
11
+ puts "Table Exists, trying to migrate older values to new ThecoreSettings::Setting Table"
12
+ RailsAdminSettings::Setting.all.each do |old_setting|
13
+ new_setting = ThecoreSettings::Setting.find_or_initialize_by old_setting.attributes.except("id", "created_at", "updated_at")
14
+ unless new_setting.save
15
+ puts new_setting.errors.full_messages.join("\n")
16
+ end
17
+ end
18
+ else
19
+ puts "Table Does not Exists, nothing to do! Yay"
20
+ end
21
+ end
22
+ end
@@ -1,9 +1,19 @@
1
1
  module ThecoreSettings
2
2
  class Engine < ::Rails::Engine
3
+
4
+ initializer 'ThecoreSettings.add_to_migrations' do |app|
5
+ unless app.root.to_s.match root.to_s
6
+ # APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
7
+ config.paths['db/migrate'].expanded.each do |expanded_path|
8
+ app.config.paths['db/migrate'] << expanded_path
9
+ end
10
+ end
11
+ end
12
+
3
13
  rake_tasks do
4
14
  require File.expand_path('../tasks', __FILE__)
5
15
  end
6
-
16
+
7
17
  initializer 'ThecoreSettings.install_after_action' do |app|
8
18
  require File.dirname(__FILE__) + '/../../app/models/thecore_settings/setting.rb'
9
19
 
@@ -13,14 +23,5 @@ module ThecoreSettings
13
23
  end
14
24
  end
15
25
  end
16
-
17
- initializer 'ThecoreSettings.add_to_migrations' do |app|
18
- unless app.root.to_s.match root.to_s
19
- # APPEND TO MAIN APP MIGRATIONS FROM THIS GEM
20
- config.paths['db/migrate'].expanded.each do |expanded_path|
21
- app.config.paths['db/migrate'] << expanded_path
22
- end
23
- end
24
- end
25
26
  end
26
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thecore_settings
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriele Tassoni
@@ -353,11 +353,11 @@ files:
353
353
  - config/locales/it.yml
354
354
  - config/locales/pt-BR.yml
355
355
  - config/locales/ru.yml
356
- - db/migrate/20161227101954_create_rails_admin_settings.rb
356
+ - db/migrate/20161227101955_create_thecore_settings.rb
357
+ - db/migrate/20210825113515_migrate_from_rails_admin_settings_to_thecore_settings.rb
357
358
  - gemfiles/mongoid-6.0.gemfile
358
359
  - gemfiles/mongoid-6.3.gemfile
359
360
  - lib/generators/thecore_settings/migration_generator.rb
360
- - lib/generators/thecore_settings/templates/db/migrate/20161227101954_create_thecore_settings.rb
361
361
  - lib/generators/thecore_settings/templates/migration.rb
362
362
  - lib/thecore_settings.rb
363
363
  - lib/thecore_settings/determine_mime_type.rb
@@ -1,29 +0,0 @@
1
- class CreateThecoreSettings < ActiveRecord::Migration[5.0]
2
- def change
3
- create_table :thecore_settings do |t|
4
- t.boolean :enabled, default: true
5
- t.string :kind, null: false, default: 'string'
6
- t.string :ns, default: 'main'
7
- t.string :key, null: false
8
- if Object.const_defined?('Geocoder')
9
- t.float :latitude
10
- t.float :longitude
11
- end
12
- t.text :raw
13
- t.string :label
14
- if defined?(Paperclip)
15
- t.attachment :file
16
- elsif defined?(CarrierWave)
17
- t.string :file
18
- elsif defined?(Shrine)
19
- t.text :file_data
20
-
21
- end
22
- t.timestamps
23
- end
24
-
25
- add_index :thecore_settings, :key
26
- add_index :thecore_settings, [:ns, :key], unique: true
27
- end
28
- end
29
-