thecore_settings 1.1.12 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +5 -5
  2. data/.devcontainer/Dockerfile +20 -0
  3. data/.devcontainer/devcontainer.json +33 -0
  4. data/.github/workflows/gempush.yml +34 -0
  5. data/.gitignore +542 -0
  6. data/.rakeTasks +7 -0
  7. data/.rspec +1 -0
  8. data/.ruby-version +1 -0
  9. data/.travis.yml +31 -0
  10. data/CHANGELOG.md +81 -0
  11. data/Gemfile +4 -0
  12. data/Gemfile.lock +275 -0
  13. data/LICENSE.txt +22 -0
  14. data/README.md +169 -0
  15. data/README.rdoc +68 -0
  16. data/Rakefile +6 -34
  17. data/app/assets/images/thecore_settings/.keep +0 -0
  18. data/app/assets/javascripts/thecore_settings/.keep +0 -0
  19. data/app/assets/stylesheets/thecore_settings/.keep +0 -0
  20. data/app/controllers/.keep +0 -0
  21. data/app/helpers/.keep +0 -0
  22. data/app/mailers/.keep +0 -0
  23. data/app/models/.keep +0 -0
  24. data/app/models/rails_admin_settings/setting.rb +77 -0
  25. data/app/views/.keep +0 -0
  26. data/app/views/rails_admin/main/_setting_value.html.haml +41 -0
  27. data/assets/javascripts/rails_admin/custom/thecore_settings.rb +2 -0
  28. data/bin/rails +13 -0
  29. data/{lib → config/initializers}/rails_admin_requirements.rb +0 -2
  30. data/config/initializers/thecore_settings_abilities.rb +22 -0
  31. data/config/initializers/thecore_settings_post_init.rb +4 -4
  32. data/config/locales/en.yml +29 -0
  33. data/config/locales/pt-BR.yml +28 -0
  34. data/config/locales/ru.yml +29 -0
  35. data/gemfiles/mongoid-6.0.gemfile +5 -0
  36. data/gemfiles/mongoid-6.3.gemfile +5 -0
  37. data/lib/generators/rails_admin_settings/migration_generator.rb +15 -0
  38. data/lib/generators/rails_admin_settings/templates/db/migrate/20161227101954_create_thecore_settings.rb +29 -0
  39. data/lib/generators/rails_admin_settings/templates/migration.rb +29 -0
  40. data/lib/thecore_settings/determine_mime_type.rb +193 -0
  41. data/lib/thecore_settings/dumper.rb +12 -0
  42. data/lib/thecore_settings/engine.rb +18 -4
  43. data/lib/thecore_settings/fallback.rb +21 -0
  44. data/lib/thecore_settings/hex_color_validator.rb +11 -0
  45. data/lib/thecore_settings/kinds.rb +34 -0
  46. data/lib/thecore_settings/mongoid.rb +19 -0
  47. data/lib/thecore_settings/namespaced.rb +210 -0
  48. data/lib/thecore_settings/processing.rb +217 -0
  49. data/lib/thecore_settings/rails_admin_config.rb +71 -0
  50. data/lib/thecore_settings/require_helpers.rb +86 -0
  51. data/lib/thecore_settings/settings.rb +95 -0
  52. data/lib/thecore_settings/storage/carrier_wave_uploader.rb +9 -0
  53. data/lib/thecore_settings/storage/shrine_uploader.rb +14 -0
  54. data/lib/thecore_settings/tasks.rb +35 -0
  55. data/lib/thecore_settings/uploads.rb +57 -0
  56. data/lib/thecore_settings/validation.rb +126 -0
  57. data/lib/thecore_settings/version.rb +1 -1
  58. data/lib/thecore_settings.rb +115 -123
  59. data/log/development.log +0 -0
  60. data/spec/advanced_usage_spec.rb +11 -0
  61. data/spec/carrierwave_spec.rb +41 -0
  62. data/spec/database_trickery_spec.rb +48 -0
  63. data/spec/defaults_spec.rb +87 -0
  64. data/spec/enabling_spec.rb +29 -0
  65. data/spec/factories/setting.rb +8 -0
  66. data/spec/label_spec.rb +16 -0
  67. data/spec/migration_spec.rb +20 -0
  68. data/spec/model_spec.rb +105 -0
  69. data/spec/namespaced_spec.rb +67 -0
  70. data/spec/paperclip_spec.rb +38 -0
  71. data/spec/settings_spec.rb +75 -0
  72. data/spec/shrine_spec.rb +34 -0
  73. data/spec/spec_helper.rb +85 -0
  74. data/spec/support/1024x768.gif +0 -0
  75. data/spec/support/database_cleaner.rb +10 -0
  76. data/spec/support/defaults.yml +23 -0
  77. data/spec/support/defaults_w_file.yml +19 -0
  78. data/spec/support/mongoid.rb +6 -0
  79. data/spec/support/mongoid.yml +6 -0
  80. data/spec/types_spec.rb +101 -0
  81. data/test/dummy/Rakefile +6 -0
  82. data/test/dummy/app/assets/config/manifest.js +4 -0
  83. data/test/dummy/app/assets/images/.keep +0 -0
  84. data/test/dummy/app/assets/javascripts/application.js +13 -0
  85. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  86. data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
  87. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  88. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  89. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  90. data/test/dummy/app/controllers/application_controller.rb +3 -0
  91. data/test/dummy/app/controllers/concerns/.keep +0 -0
  92. data/test/dummy/app/helpers/application_helper.rb +2 -0
  93. data/test/dummy/app/jobs/application_job.rb +2 -0
  94. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  95. data/test/dummy/app/models/application_record.rb +3 -0
  96. data/test/dummy/app/models/concerns/.keep +0 -0
  97. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  98. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  99. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  100. data/test/dummy/bin/bundle +3 -0
  101. data/test/dummy/bin/rails +4 -0
  102. data/test/dummy/bin/rake +4 -0
  103. data/test/dummy/bin/setup +34 -0
  104. data/test/dummy/bin/update +29 -0
  105. data/test/dummy/config/application.rb +15 -0
  106. data/test/dummy/config/boot.rb +5 -0
  107. data/test/dummy/config/cable.yml +9 -0
  108. data/test/dummy/config/database.yml +25 -0
  109. data/test/dummy/config/environment.rb +5 -0
  110. data/test/dummy/config/environments/development.rb +54 -0
  111. data/test/dummy/config/environments/production.rb +86 -0
  112. data/test/dummy/config/environments/test.rb +42 -0
  113. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  114. data/test/dummy/config/initializers/assets.rb +11 -0
  115. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  116. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  117. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  118. data/test/dummy/config/initializers/inflections.rb +16 -0
  119. data/test/dummy/config/initializers/mime_types.rb +4 -0
  120. data/test/dummy/config/initializers/new_framework_defaults.rb +24 -0
  121. data/test/dummy/config/initializers/session_store.rb +3 -0
  122. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  123. data/test/dummy/config/locales/en.yml +23 -0
  124. data/test/dummy/config/puma.rb +47 -0
  125. data/test/dummy/config/routes.rb +3 -0
  126. data/test/dummy/config/secrets.yml +22 -0
  127. data/test/dummy/config/spring.rb +6 -0
  128. data/test/dummy/config.ru +5 -0
  129. data/test/dummy/db/development.sqlite3 +0 -0
  130. data/test/dummy/lib/assets/.keep +0 -0
  131. data/test/dummy/log/.keep +0 -0
  132. data/test/dummy/log/development.log +16 -0
  133. data/test/dummy/public/404.html +67 -0
  134. data/test/dummy/public/422.html +67 -0
  135. data/test/dummy/public/500.html +66 -0
  136. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  137. data/test/dummy/public/apple-touch-icon.png +0 -0
  138. data/test/dummy/public/favicon.ico +0 -0
  139. data/test/dummy/tmp/.keep +0 -0
  140. data/test/integration/navigation_test.rb +8 -0
  141. data/test/test_helper.rb +19 -0
  142. data/test/thecore_settings_test.rb +7 -0
  143. data/thecore_settings.gemspec +44 -0
  144. metadata +459 -57
  145. data/lib/thecore_settings_abilities.rb +0 -21
@@ -1,21 +0,0 @@
1
- require 'active_support/concern'
2
-
3
- require 'rails_admin_settings'
4
-
5
- module TheCoreSettingsAbilitiesConcern
6
- extend ActiveSupport::Concern
7
- included do
8
- def thecore_settings_abilities user
9
- cannot :manage, [RailsAdminSettings::Setting]
10
- # Pay attention to this errorTypeError (can't convert Class to Array (Class#to_ary gives String)):
11
- if user && user.admin?
12
- can [:index, :update], [RailsAdminSettings::Setting]
13
- cannot [:show, :destroy, :create], [RailsAdminSettings::Setting]
14
- end
15
-
16
- end
17
- end
18
- end
19
-
20
- # include the extension
21
- TheCoreAbilities.send(:include, TheCoreSettingsAbilitiesConcern)