occams 1.0.4 → 1.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aca6dd86629db61b2c905c1e54bf45dc6d4153659bf46868ed4a4c8ee70f9ad0
4
- data.tar.gz: 151a8b8aab7bcc69405e530a1100f18796515fc1e00fec3131c4cf68736f6778
3
+ metadata.gz: efb5d94cf738164a3e046fa7cfb156622bd2bc0e9b8204b4b8351528e071d125
4
+ data.tar.gz: 1a258f13ab0e8f4d2bee5389fc35b9aaae9d1e8d21b9cbf785c4c87d4bdf64e5
5
5
  SHA512:
6
- metadata.gz: 67407dbc43513ff16a74bef095001a7c4f6bf544a0ab07bbf1c51388478ebd3e6d078bc82714ecd1f9899079d6832ab326a779ec2addad117d36708279337ca3
7
- data.tar.gz: 807c7bd56f6684c6aca8c189bded644f843da7badac3beb883b3471c60ce45252a94486051d08468fc3fa778eff4808b01ff5c497a7c1c0b23586569c5c76242
6
+ metadata.gz: 9efc2ff6514d9232b567c2db268f2db505662f13c6de0393f4cb263f69883a73514b24bf528316eaadc08d7d077de08b1df806697dc727784291119040f70f05
7
+ data.tar.gz: 5599e31e8c182f8ce24cc8c23c1be933b0c84e3044d120d1e4ff3378a24aada88b509e2ac97ea94e1d7de48d6d1b7bcebc7477be6aca804630b0377cd596cf5e
data/.travis.yml CHANGED
@@ -10,18 +10,19 @@ addons:
10
10
 
11
11
  language: ruby
12
12
  rvm:
13
- - 2.3.8
14
- - 2.4.9
15
- - 2.5.7
16
- - 2.6.5
13
+ - 2.7.8
14
+ - 3.1.4
15
+ - 3.2.2
17
16
  gemfile:
18
- - test/gemfiles/5.2.gemfile
17
+ - test/gemfiles/6.1.gemfile
19
18
  jobs:
20
19
  include:
21
- - rvm: 2.5.7
22
- gemfile: test/gemfiles/6.0.gemfile
23
- - rvm: 2.6.5
24
- gemfile: test/gemfiles/6.0.gemfile
20
+ - rvm: 2.7.8
21
+ gemfile: test/gemfiles/6.1.gemfile
22
+ - rvm: 3.1.4
23
+ gemfile: test/gemfiles/6.1.gemfile
24
+ - rvm: 3.2.2
25
+ gemfile: test/gemfiles/7.0.gemfile
25
26
  branches:
26
27
  only:
27
28
  - master
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.0.5 - 8/31/2023
4
+
5
+ - All tests now green on Rails 6.1 and 7.0, each tested with rubies 2.7.8, 3.1.4 and 3.2.2.
6
+ - Tests added for new tags
7
+ - TODO: set up CI pipeline
8
+
3
9
  ## v1.0.4 - 8/26/2023
4
10
 
5
11
  - Added [cms:breadcrumbs Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#breadcrumbs)
data/README.md CHANGED
@@ -21,7 +21,7 @@ ocCaM'S, pronounced "AH-kums" is a nod to [Occam's Razor](https://en.wikipedia.o
21
21
 
22
22
  ## Features
23
23
 
24
- * Simple drop-in integration with Rails 6.0+ apps with minimal configuration
24
+ * Simple drop-in integration with Rails 6.1+ apps with minimal configuration
25
25
  * CMS stays away from the rest of your application
26
26
 
27
27
  Referring to the [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) documentation, substituting 'Occams' for 'ComfortableMexicanSofa' where appropriate.
@@ -41,8 +41,8 @@ Referring to the [ComfortableMexicanSofa](https://github.com/comfy/comfortable-m
41
41
 
42
42
  ## Compatibility
43
43
 
44
- - Install and basic functionality validated on Ruby 3.2.2. with Rails 6.1.7.4 and 7.0.6+
45
- - Rails 7 is recommended, since performance is noticably better
44
+ - Test suite passing on Ruby 2.7.8, 3.1.4 and 3.2.2 with Rails 6.1 and 7.0+
45
+ - Rails 7+ is recommended, since performance is noticably better than 6
46
46
 
47
47
  ## Installation
48
48
 
@@ -103,13 +103,13 @@ For more detail see [CONTRIBUTING](CONTRIBUTING.md)
103
103
 
104
104
  #### Testing
105
105
 
106
- - `bin/rails db:migrate`
106
+ - `bin/rails db:migrate RAILS_ENV=test`
107
107
  - `rake db:test:prepare`
108
108
  - `rake test`
109
109
 
110
110
  #### Acknowledgements
111
111
 
112
- - Obviously to Oleg Khabarov, the creator of [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa). This is his work, with just a few updates and additions.
112
+ - Obviously to [Oleg Khabarov](https://github.com/GBH), the creator of [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa). This is his work, with a few updates and additions.
113
113
  - Thanks to [Roman Almeida](https://github.com/nasmorn) for contributing OEM License for [Redactor Text Editor](http://imperavi.com/redactor)
114
114
 
115
115
  ---
data/TODOS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # ToDos
2
2
 
3
+ - set up CI
3
4
  - add admin content search to list layouts, pages and snippets - see https://blog.robertsj.com/search/
4
5
  - add application console for testing
5
6
  - add feature to resize file_link'd images
6
- - get the original [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa) tests working with Rails 7 and Ruby 3
data/bin/setup CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'fileutils'
3
- include FileUtils
4
3
 
5
4
  # path to your application root.
6
5
  APP_ROOT = File.expand_path('..', __dir__)
@@ -9,20 +8,18 @@ def system!(*args)
9
8
  system(*args) || abort("\n== Command #{args} failed ==")
10
9
  end
11
10
 
12
- chdir APP_ROOT do
13
- # This script is a starting point to setup your application.
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to set up or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14
14
  # Add necessary setup steps to this file.
15
15
 
16
16
  puts '== Installing dependencies =='
17
17
  system! 'gem install bundler --conservative'
18
18
  system('bundle check') || system!('bundle install')
19
19
 
20
- # Install JavaScript dependencies if using Yarn
21
- # system('bin/yarn')
22
-
23
20
  # puts "\n== Copying sample files =="
24
21
  # unless File.exist?('config/database.yml')
25
- # cp 'config/database.yml.sample', 'config/database.yml'
22
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
26
23
  # end
27
24
 
28
25
  puts "\n== Preparing database =="
@@ -12,20 +12,16 @@ module Occams
12
12
  class Application < Rails::Application
13
13
  require_relative '../lib/occams'
14
14
 
15
- config.load_defaults 5.2
16
-
17
- # Settings in config/environments/* take precedence over those specified here.
18
- # Application configuration should go into files in config/initializers
19
- # -- all .rb files in that directory are automatically loaded.
20
-
21
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
22
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
23
- # config.time_zone = 'Central Time (US & Canada)'
24
-
25
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
26
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
27
- # config.i18n.default_locale = :de
28
-
15
+ # Initialize configuration defaults for originally generated Rails version.
16
+ config.load_defaults 6.1
17
+
18
+ # Configuration for the application, engines, and railties goes here.
19
+ #
20
+ # These settings can be overridden in specific environments using the files
21
+ # in config/environments, which are processed later.
22
+ #
23
+ # config.time_zone = "Central Time (US & Canada)"
24
+ # config.eager_load_paths << Rails.root.join("extras")
29
25
  # Ensuring that all ActiveStorage routes are loaded before out globbing route.
30
26
  config.railties_order = [ActiveStorage::Engine, :main_app, :all]
31
27
 
@@ -33,5 +29,7 @@ module Occams
33
29
  config.paths['config/routes.rb'] << 'config/cms_routes.rb'
34
30
 
35
31
  config.i18n.enforce_available_locales = true
32
+
33
+ config.active_record.yaml_column_permitted_classes = [Symbol, Date, Time, ActiveSupport::TimeWithZone, ActiveSupport::TimeZone]
36
34
  end
37
35
  end
data/config/cable.yml ADDED
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: test
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: occams_production
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Load the rails application
4
- require File.expand_path('application', __dir__)
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
5
 
6
- # Initialize the rails application
6
+ # Initialize the Rails application.
7
7
  Occams::Application.initialize!
@@ -1,10 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/integer/time'
4
+
3
5
  defined?(Occams::Application) && Occams::Application.configure do
4
6
  # Settings specified here will take precedence over those in config/application.rb.
5
7
 
6
- # In the development environment your application's code is reloaded on
7
- # every request. This slows down response time but is perfect for development
8
+ # In the development environment your application's code is reloaded any time
9
+ # it changes. This slows down response time but is perfect for development
8
10
  # since you don't have to restart the web server when you make code changes.
9
11
  config.cache_classes = false
10
12
 
@@ -14,10 +16,14 @@ defined?(Occams::Application) && Occams::Application.configure do
14
16
  # Show full error reports.
15
17
  config.consider_all_requests_local = true
16
18
 
19
+ # Enable server timing
20
+ config.server_timing = true
21
+
17
22
  # Enable/disable caching. By default caching is disabled.
18
23
  # Run rails dev:cache to toggle caching.
19
24
  if Rails.root.join('tmp/caching-dev.txt').exist?
20
25
  config.action_controller.perform_caching = true
26
+ config.action_controller.enable_fragment_cache_logging = true
21
27
 
22
28
  config.cache_store = :memory_store
23
29
  config.public_file_server.headers = {
@@ -29,7 +35,7 @@ defined?(Occams::Application) && Occams::Application.configure do
29
35
  config.cache_store = :null_store
30
36
  end
31
37
 
32
- # Store uploaded files on the local file system (see config/storage.yml for options)
38
+ # Store uploaded files on the local file system (see config/storage.yml for options).
33
39
  config.active_storage.service = :local
34
40
 
35
41
  # Don't care if the mailer can't send.
@@ -40,6 +46,12 @@ defined?(Occams::Application) && Occams::Application.configure do
40
46
  # Print deprecation notices to the Rails logger.
41
47
  config.active_support.deprecation = :log
42
48
 
49
+ # Raise exceptions for disallowed deprecations.
50
+ config.active_support.disallowed_deprecation = :raise
51
+
52
+ # Tell Active Support which deprecation messages to disallow.
53
+ config.active_support.disallowed_deprecation_warnings = []
54
+
43
55
  # Raise an error on page load if there are pending migrations.
44
56
  config.active_record.migration_error = :page_load
45
57
 
@@ -48,6 +60,9 @@ defined?(Occams::Application) && Occams::Application.configure do
48
60
  # number of complex assets.
49
61
  config.assets.debug = true
50
62
 
63
+ # Highlight code that triggered database queries in logs.
64
+ config.active_record.verbose_query_logs = true
65
+
51
66
  # Suppress logger output for asset requests.
52
67
  config.assets.quiet = true
53
68
 
@@ -56,4 +71,12 @@ defined?(Occams::Application) && Occams::Application.configure do
56
71
  config.file_watcher = ActiveSupport::EventedFileUpdateChecker
57
72
 
58
73
  config.active_job.queue_adapter = :inline
74
+ # Raises error for missing translations.
75
+ # config.i18n.raise_on_missing_translations = true
76
+
77
+ # Annotate rendered view with file names.
78
+ # config.action_view.annotate_rendered_view_with_filenames = true
79
+
80
+ # Uncomment if you wish to allow Action Cable access from any origin.
81
+ # config.action_cable.disable_request_forgery_protection = true
59
82
  end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ defined?(Occams::Application) && Occams::Application.configure do
6
+ # Settings specified here will take precedence over those in config/application.rb.
7
+
8
+ # Code is not reloaded between requests.
9
+ config.cache_classes = true
10
+
11
+ # Eager load code on boot. This eager loads most of Rails and
12
+ # your application in memory, allowing both threaded web servers
13
+ # and those relying on copy on write to perform better.
14
+ # Rake tasks automatically ignore this option for performance.
15
+ config.eager_load = true
16
+
17
+ # Full error reports are disabled and caching is turned on.
18
+ config.consider_all_requests_local = false
19
+ config.action_controller.perform_caching = true
20
+
21
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
22
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
23
+ # config.require_master_key = true
24
+
25
+ # Disable serving static files from the `/public` folder by default since
26
+ # Apache or NGINX already handles this.
27
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
28
+
29
+ # Compress CSS using a preprocessor.
30
+ # config.assets.css_compressor = :sass
31
+
32
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
33
+ config.assets.compile = false
34
+
35
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
36
+ # config.asset_host = "http://assets.example.com"
37
+
38
+ # Specifies the header that your server uses for sending files.
39
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
40
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
41
+
42
+ # Store uploaded files on the local file system (see config/storage.yml for options).
43
+ config.active_storage.service = :local
44
+
45
+ # Mount Action Cable outside main process or domain.
46
+ # config.action_cable.mount_path = nil
47
+ # config.action_cable.url = "wss://example.com/cable"
48
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
49
+
50
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
51
+ # config.force_ssl = true
52
+
53
+ # Include generic and useful information about system operation, but avoid logging too much
54
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
55
+ config.log_level = :info
56
+
57
+ # Prepend all log lines with the following tags.
58
+ config.log_tags = [:request_id]
59
+
60
+ # Use a different cache store in production.
61
+ # config.cache_store = :mem_cache_store
62
+
63
+ # Use a real queuing backend for Active Job (and separate queues per environment).
64
+ # config.active_job.queue_adapter = :resque
65
+ # config.active_job.queue_name_prefix = "occams_production"
66
+
67
+ config.action_mailer.perform_caching = false
68
+
69
+ # Ignore bad email addresses and do not raise email delivery errors.
70
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
71
+ # config.action_mailer.raise_delivery_errors = false
72
+
73
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
74
+ # the I18n.default_locale when a translation cannot be found).
75
+ config.i18n.fallbacks = true
76
+
77
+ # Don't log any deprecations.
78
+ config.active_support.report_deprecations = false
79
+
80
+ # Use default logging formatter so that PID and timestamp are not suppressed.
81
+ config.log_formatter = Logger::Formatter.new
82
+
83
+ # Use a different logger for distributed setups.
84
+ # require "syslog/logger"
85
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
86
+
87
+ if ENV['RAILS_LOG_TO_STDOUT'].present?
88
+ logger = ActiveSupport::Logger.new($stdout)
89
+ logger.formatter = config.log_formatter
90
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
91
+ end
92
+
93
+ # Do not dump schema after migrations.
94
+ config.active_record.dump_schema_after_migration = false
95
+ end
@@ -1,18 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ # The test environment is used exclusively to run your application's
6
+ # test suite. You never need to work with it otherwise. Remember that
7
+ # your test database is "scratch space" for the test suite and is wiped
8
+ # and recreated between test runs. Don't rely on the data there!
9
+
3
10
  defined?(Occams::Application) && Occams::Application.configure do
4
11
  # Settings specified here will take precedence over those in config/application.rb.
5
12
 
6
- # The test environment is used exclusively to run your application's
7
- # test suite. You never need to work with it otherwise. Remember that
8
- # your test database is "scratch space" for the test suite and is wiped
9
- # and recreated between test runs. Don't rely on the data there!
13
+ # Turn false under Spring and add config.action_view.cache_template_loading = true.
10
14
  config.cache_classes = true
11
15
 
12
- # Do not eager load code on boot. This avoids loading your whole application
13
- # just for the purpose of running a single test. If you are using a tool that
14
- # preloads Rails for running tests, you may have to set it to true.
15
- config.eager_load = false
16
+ # Eager loading loads your whole application. When running a single test locally,
17
+ # this probably isn't necessary. It's a good idea to do in a continuous integration
18
+ # system, or in some way before deploying your code.
19
+ config.eager_load = ENV['CI'].present?
16
20
 
17
21
  # Configure public file server for tests with Cache-Control for performance.
18
22
  config.public_file_server.enabled = true
@@ -23,6 +27,7 @@ defined?(Occams::Application) && Occams::Application.configure do
23
27
  # Show full error reports and disable caching.
24
28
  config.consider_all_requests_local = true
25
29
  config.action_controller.perform_caching = false
30
+ config.cache_store = :null_store
26
31
 
27
32
  # Raise exceptions instead of rendering exception templates.
28
33
  config.action_dispatch.show_exceptions = false
@@ -30,8 +35,9 @@ defined?(Occams::Application) && Occams::Application.configure do
30
35
  # Disable request forgery protection in test environment.
31
36
  config.action_controller.allow_forgery_protection = false
32
37
 
33
- # Store uploaded files on the local file system in a temporary directory
38
+ # Store uploaded files on the local file system in a temporary directory.
34
39
  config.active_storage.service = :test
40
+
35
41
  config.action_mailer.perform_caching = false
36
42
 
37
43
  # Tell Action Mailer not to deliver emails to the real world.
@@ -43,8 +49,15 @@ defined?(Occams::Application) && Occams::Application.configure do
43
49
  config.active_support.deprecation = :stderr
44
50
 
45
51
  config.active_job.queue_adapter = :inline
52
+ # Raise exceptions for disallowed deprecations.
53
+ config.active_support.disallowed_deprecation = :raise
54
+
55
+ # Tell Active Support which deprecation messages to disallow.
56
+ config.active_support.disallowed_deprecation_warnings = []
57
+
58
+ # Raises error for missing translations.
59
+ # config.i18n.raise_on_missing_translations = true
46
60
 
47
- # TODO: This is temporary fix so TravisCI runs until Rails 5.2.3 is out.
48
- # See: https://github.com/rails/rails/pull/35607
49
- config.secret_key_base = SecureRandom.hex(64)
61
+ # Annotate rendered view with file names.
62
+ # config.action_view.annotate_rendered_view_with_filenames = true
50
63
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Version of your assets, change this if you want to expire all your assets.
6
+ Rails.application.config.assets.version = '1.0'
7
+
8
+ # Add additional assets to the asset load path.
9
+ # Rails.application.config.assets.paths << Emoji.images_path
10
+
11
+ # Precompile additional assets.
12
+ # application.js, application.css, and all non-JS/CSS in the app/assets
13
+ # folder are already added.
14
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Define an application-wide content security policy.
6
+ # See the Securing Rails Applications Guide for more information:
7
+ # https://guides.rubyonrails.org/security.html#content-security-policy-header
8
+
9
+ # Rails.application.configure do
10
+ # config.content_security_policy do |policy|
11
+ # policy.default_src :self, :https
12
+ # policy.font_src :self, :https, :data
13
+ # policy.img_src :self, :https, :data
14
+ # policy.object_src :none
15
+ # policy.script_src :self, :https
16
+ # policy.style_src :self, :https
17
+ # # Specify URI for violation reports
18
+ # # policy.report_uri "/csp-violation-report-endpoint"
19
+ # end
20
+ #
21
+ # # Generate session nonces for permitted importmap and inline scripts
22
+ # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
23
+ # config.content_security_policy_nonce_directives = %w(script-src)
24
+ #
25
+ # # Report violations without enforcing the policy.
26
+ # # config.content_security_policy_report_only = true
27
+ # end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Configure parameters to be filtered from the log file. Use this to limit dissemination of
6
+ # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
7
+ # notations and behaviors.
8
+ Rails.application.config.filter_parameters += %i[
9
+ passw secret token _key crypt salt certificate otp ssn
10
+ ]
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Add new inflection rules using the following format. Inflections
6
+ # are locale specific, and you may define rules for as many different
7
+ # locales as you wish. All of these examples are active by default:
8
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
9
+ # inflect.plural /^(ox)$/i, "\\1en"
10
+ # inflect.singular /^(ox)en/i, "\\1"
11
+ # inflect.irregular "person", "people"
12
+ # inflect.uncountable %w( fish sheep )
13
+ # end
14
+
15
+ # These inflection rules are supported but not enabled by default:
16
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
17
+ # inflect.acronym "RESTful"
18
+ # end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module JSON
4
+ module_function
5
+
6
+ def parse(source, opts = {})
7
+ Parser.new(source, **opts).parse
8
+ end
9
+ end
@@ -0,0 +1,144 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+ #
5
+ # This file eases your Rails 7.0 framework defaults upgrade.
6
+ #
7
+ # Uncomment each configuration one by one to switch to the new default.
8
+ # Once your application is ready to run with all new defaults, you can remove
9
+ # this file and set the `config.load_defaults` to `7.0`.
10
+ #
11
+ # Read the Guide for Upgrading Ruby on Rails for more info on each option.
12
+ # https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
13
+
14
+ # `button_to` view helper will render `<button>` element, regardless of whether
15
+ # or not the content is passed as the first argument or as a block.
16
+ # Rails.application.config.action_view.button_to_generates_button_tag = true
17
+
18
+ # `stylesheet_link_tag` view helper will not render the media attribute by default.
19
+ # Rails.application.config.action_view.apply_stylesheet_media_default = false
20
+
21
+ # Change the digest class for the key generators to `OpenSSL::Digest::SHA256`.
22
+ # Changing this default means invalidate all encrypted messages generated by
23
+ # your application and, all the encrypted cookies. Only change this after you
24
+ # rotated all the messages using the key rotator.
25
+ #
26
+ # See upgrading guide for more information on how to build a rotator.
27
+ # https://guides.rubyonrails.org/v7.0/upgrading_ruby_on_rails.html
28
+ # Rails.application.config.active_support.key_generator_hash_digest_class = OpenSSL::Digest::SHA256
29
+
30
+ # Change the digest class for ActiveSupport::Digest.
31
+ # Changing this default means that for example Etags change and
32
+ # various cache keys leading to cache invalidation.
33
+ # Rails.application.config.active_support.hash_digest_class = OpenSSL::Digest::SHA256
34
+
35
+ # Don't override ActiveSupport::TimeWithZone.name and use the default Ruby
36
+ # implementation.
37
+ # Rails.application.config.active_support.remove_deprecated_time_with_zone_name = true
38
+
39
+ # Calls `Rails.application.executor.wrap` around test cases.
40
+ # This makes test cases behave closer to an actual request or job.
41
+ # Several features that are normally disabled in test, such as Active Record query cache
42
+ # and asynchronous queries will then be enabled.
43
+ # Rails.application.config.active_support.executor_around_test_case = true
44
+
45
+ # Set both the `:open_timeout` and `:read_timeout` values for `:smtp` delivery method.
46
+ # Rails.application.config.action_mailer.smtp_timeout = 5
47
+
48
+ # The ActiveStorage video previewer will now use scene change detection to generate
49
+ # better preview images (rather than the previous default of using the first frame
50
+ # of the video).
51
+ # Rails.application.config.active_storage.video_preview_arguments =
52
+ # "-vf 'select=eq(n\\,0)+eq(key\\,1)+gt(scene\\,0.015),loop=loop=-1:size=2,trim=start_frame=1' -frames:v 1 -f image2"
53
+
54
+ # Automatically infer `inverse_of` for associations with a scope.
55
+ # Rails.application.config.active_record.automatic_scope_inversing = true
56
+
57
+ # Raise when running tests if fixtures contained foreign key violations
58
+ # Rails.application.config.active_record.verify_foreign_keys_for_fixtures = true
59
+
60
+ # Disable partial inserts.
61
+ # This default means that all columns will be referenced in INSERT queries
62
+ # regardless of whether they have a default or not.
63
+ # Rails.application.config.active_record.partial_inserts = false
64
+
65
+ # Protect from open redirect attacks in `redirect_back_or_to` and `redirect_to`.
66
+ # Rails.application.config.action_controller.raise_on_open_redirects = true
67
+
68
+ # Change the variant processor for Active Storage.
69
+ # Changing this default means updating all places in your code that
70
+ # generate variants to use image processing macros and ruby-vips
71
+ # operations. See the upgrading guide for detail on the changes required.
72
+ # The `:mini_magick` option is not deprecated; it's fine to keep using it.
73
+ # Rails.application.config.active_storage.variant_processor = :vips
74
+
75
+ # Enable parameter wrapping for JSON.
76
+ # Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
77
+ # To disable parameter wrapping entirely, set this config to `false`.
78
+ # Rails.application.config.action_controller.wrap_parameters_by_default = true
79
+
80
+ # Specifies whether generated namespaced UUIDs follow the RFC 4122 standard for namespace IDs provided as a
81
+ # `String` to `Digest::UUID.uuid_v3` or `Digest::UUID.uuid_v5` method calls.
82
+ #
83
+ # See https://guides.rubyonrails.org/configuring.html#config-active-support-use-rfc4122-namespaced-uuids for
84
+ # more information.
85
+ # Rails.application.config.active_support.use_rfc4122_namespaced_uuids = true
86
+
87
+ # Change the default headers to disable browsers' flawed legacy XSS protection.
88
+ # Rails.application.config.action_dispatch.default_headers = {
89
+ # "X-Frame-Options" => "SAMEORIGIN",
90
+ # "X-XSS-Protection" => "0",
91
+ # "X-Content-Type-Options" => "nosniff",
92
+ # "X-Download-Options" => "noopen",
93
+ # "X-Permitted-Cross-Domain-Policies" => "none",
94
+ # "Referrer-Policy" => "strict-origin-when-cross-origin"
95
+ # }
96
+
97
+ # ** Please read carefully, this must be configured in config/application.rb **
98
+ # Change the format of the cache entry.
99
+ # Changing this default means that all new cache entries added to the cache
100
+ # will have a different format that is not supported by Rails 6.1 applications.
101
+ # Only change this value after your application is fully deployed to Rails 7.0
102
+ # and you have no plans to rollback.
103
+ # When you're ready to change format, add this to `config/application.rb` (NOT this file):
104
+ # config.active_support.cache_format_version = 7.0
105
+
106
+ # Cookie serializer: 2 options
107
+ #
108
+ # If you're upgrading and haven't set `cookies_serializer` previously, your cookie serializer
109
+ # is `:marshal`. The default for new apps is `:json`.
110
+ #
111
+ # Rails.application.config.action_dispatch.cookies_serializer = :json
112
+ #
113
+ #
114
+ # To migrate an existing application to the `:json` serializer, use the `:hybrid` option.
115
+ #
116
+ # Rails transparently deserializes existing (Marshal-serialized) cookies on read and
117
+ # re-writes them in the JSON format.
118
+ #
119
+ # It is fine to use `:hybrid` long term; you should do that until you're confident *all* your cookies
120
+ # have been converted to JSON. To keep using `:hybrid` long term, move this config to its own
121
+ # initializer or to `config/application.rb`.
122
+ #
123
+ # Rails.application.config.action_dispatch.cookies_serializer = :hybrid
124
+ #
125
+ #
126
+ # If your cookies can't yet be serialized to JSON, keep using `:marshal` for backward-compatibility.
127
+ #
128
+ # If you have configured the serializer elsewhere, you can remove this section of the file.
129
+ #
130
+ # See https://guides.rubyonrails.org/action_controller_overview.html#cookies for more information.
131
+
132
+ # Change the return value of `ActionDispatch::Request#content_type` to the Content-Type header without modification.
133
+ # Rails.application.config.action_dispatch.return_only_request_media_type_on_content_type = false
134
+
135
+ # Active Storage `has_many_attached` relationships will default to replacing the current collection instead of appending to it.
136
+ # Thus, to support submitting an empty collection, the `file_field` helper will render an hidden field
137
+ # `include_hidden` by default when `multiple_file_field_include_hidden` is set to `true`.
138
+ # See https://guides.rubyonrails.org/configuring.html#config-active-storage-multiple-file-field-include-hidden for more information.
139
+ # Rails.application.config.active_storage.multiple_file_field_include_hidden = true
140
+
141
+ # ** Please read carefully, this must be configured in config/application.rb (NOT this file) **
142
+ # Disables the deprecated #to_s override in some Ruby core classes
143
+ # See https://guides.rubyonrails.org/configuring.html#config-active-support-disable-to-s-conversion for more information.
144
+ # config.active_support.disable_to_s_conversion = true
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Define an application-wide HTTP permissions policy. For further
4
+ # information see https://developers.google.com/web/updates/2018/06/feature-policy
5
+ #
6
+ # Rails.application.config.permissions_policy do |f|
7
+ # f.camera :none
8
+ # f.gyroscope :none
9
+ # f.microphone :none
10
+ # f.usb :none
11
+ # f.fullscreen :self
12
+ # f.payment :self, "https://secure.example.com"
13
+ # end
@@ -7,12 +7,16 @@ class CreateActiveStorageTables < ActiveRecord::Migration[6.0]
7
7
  t.string :service_name, null: false
8
8
  t.text :metadata
9
9
  t.bigint :byte_size, null: false
10
- t.string :checksum, null: false
10
+ t.string :checksum, null: true
11
11
  t.datetime :created_at, null: false
12
12
 
13
13
  t.index [ :key ], unique: true
14
14
  end
15
15
 
16
+ if configured_service = ActiveStorage::Blob.service.name
17
+ ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
18
+ end
19
+
16
20
  create_table :active_storage_attachments do |t|
17
21
  t.string :name, null: false
18
22
  t.references :record, null: false, polymorphic: true, index: false
@@ -23,12 +27,24 @@ class CreateActiveStorageTables < ActiveRecord::Migration[6.0]
23
27
  t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
24
28
  end
25
29
 
26
- create_table :active_storage_variant_records do |t|
27
- t.belongs_to :blob, null: false, index: false
30
+ create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t|
31
+ t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type
28
32
  t.string :variation_digest, null: false
29
33
 
30
34
  t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
31
35
  t.foreign_key :active_storage_blobs, column: :blob_id
32
36
  end
33
37
  end
38
+
39
+ private
40
+ def primary_key_type
41
+ config = Rails.configuration.generators
42
+ config.options[config.orm][:primary_key_type] || :primary_key
43
+ end
44
+
45
+ def blobs_primary_key_type
46
+ pkey_name = connection.primary_key(:active_storage_blobs)
47
+ pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
48
+ pkey_column.bigint? ? :bigint : pkey_column.type
49
+ end
34
50
  end
@@ -1,4 +1,4 @@
1
- class CreateCms < ActiveRecord::Migration[5.2]
1
+ class CreateCms < ActiveRecord::Migration[6.0]
2
2
 
3
3
  LIMIT = 16777215
4
4
 
@@ -15,15 +15,14 @@
15
15
  # and/or pass in style overrides with the 'style' parameter, as above
16
16
 
17
17
  class Occams::Content::Tag::Audio < Occams::Content::Tag
18
- attr_reader :path, :locals
18
+ attr_reader :path, :style, :locals
19
19
 
20
20
  def initialize(context:, params: [], source: nil)
21
21
  super
22
- options = params.extract_options!
22
+ @locals = params.extract_options!
23
23
  @path = params[0]
24
24
  @style = ''
25
- @style = "<style>.audioplayer {#{options['style']}}</style>" if options['style']
26
- @style = options['style']
25
+ @style = "<style>.audioplayer {#{@locals['style']}}</style>" if @locals['style']
27
26
 
28
27
  return if @path.present?
29
28
 
@@ -16,13 +16,13 @@
16
16
  # and/or pass in style overrides with the 'style' parameter, as above
17
17
 
18
18
  class Occams::Content::Tag::Breadcrumbs < Occams::Content::Tag
19
- attr_reader :path, :locals
19
+ attr_reader :links, :style, :locals
20
20
 
21
21
  def initialize(context:, params: [], source: nil)
22
22
  super
23
- options = params.extract_options!
23
+ @locals = params.extract_options!
24
24
  @style = ''
25
- @style = "<style>#breadcrumbs {#{options['style']}}</style>" if options['style']
25
+ @style = "<style>#breadcrumbs {#{@locals['style']}}</style>" if @locals['style']
26
26
 
27
27
  @links = '<div id="breadcrumbs">'
28
28
  context.ancestors.reverse.each do |a|
@@ -20,15 +20,15 @@
20
20
  # style and exclude parameters are optional
21
21
 
22
22
  class Occams::Content::Tag::Siblings < Occams::Content::Tag
23
- attr_reader :path, :locals
23
+ attr_reader :locals, :style, :links
24
24
 
25
25
  def initialize(context:, params: [], source: nil)
26
26
  super
27
- options = params.extract_options!
27
+ @locals = params.extract_options!
28
28
  @style = ''
29
- @style = "<style>#siblings {#{options['style']}}</style>" if options['style']
29
+ @style = "<style>#siblings {#{@locals['style']}}</style>" if @locals['style']
30
30
  @exclude = []
31
- @exclude = options['exclude'].split(',') if options['exclude']
31
+ @exclude = @locals['exclude'].split(',') if @locals['exclude']
32
32
  @links = '<div id="siblings">'
33
33
 
34
34
  prevp = false
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Occams
4
- VERSION = '1.0.4'
4
+ VERSION = '1.0.5'
5
5
  end
data/occams.gemspec CHANGED
@@ -28,7 +28,8 @@ Gem::Specification.new do |s|
28
28
  s.add_runtime_dependency 'kramdown', '~> 2.4', '>= 2.4.0'
29
29
  s.add_runtime_dependency 'mimemagic', '~> 0.4', '>= 0.4.3'
30
30
  s.add_runtime_dependency 'mini_magick', '~> 4.12', '>= 4.12.0'
31
- s.add_dependency 'rails', '>= 6.1.0'
31
+ s.add_runtime_dependency 'rails', '>= 6.1.0'
32
32
  s.add_runtime_dependency 'rails-i18n', '>= 6.0.0'
33
33
  s.add_runtime_dependency 'sassc-rails', '~> 2.1', '>= 2.1.2'
34
+ s.add_runtime_dependency 'sprockets-rails', '~> 3.4', '>= 3.4.2'
34
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: occams
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew vonderLuft
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-26 00:00:00.000000000 Z
11
+ date: 2023-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_link_to
@@ -218,6 +218,26 @@ dependencies:
218
218
  - - ">="
219
219
  - !ruby/object:Gem::Version
220
220
  version: 2.1.2
221
+ - !ruby/object:Gem::Dependency
222
+ name: sprockets-rails
223
+ requirement: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - "~>"
226
+ - !ruby/object:Gem::Version
227
+ version: '3.4'
228
+ - - ">="
229
+ - !ruby/object:Gem::Version
230
+ version: 3.4.2
231
+ type: :runtime
232
+ prerelease: false
233
+ version_requirements: !ruby/object:Gem::Requirement
234
+ requirements:
235
+ - - "~>"
236
+ - !ruby/object:Gem::Version
237
+ version: '3.4'
238
+ - - ">="
239
+ - !ruby/object:Gem::Version
240
+ version: 3.4.2
221
241
  description: Occams is a powerful Rails 6-7+ CMS Engine
222
242
  email:
223
243
  - wonder@hey.com
@@ -577,12 +597,21 @@ files:
577
597
  - config.ru
578
598
  - config/application.rb
579
599
  - config/boot.rb
600
+ - config/cable.yml
580
601
  - config/cms_routes.rb
581
602
  - config/database.yml
582
603
  - config/environment.rb
583
604
  - config/environments/development.rb
605
+ - config/environments/production.rb
584
606
  - config/environments/test.rb
607
+ - config/initializers/assets.rb
608
+ - config/initializers/content_security_policy.rb
609
+ - config/initializers/filter_parameter_logging.rb
610
+ - config/initializers/inflections.rb
611
+ - config/initializers/json.rb
612
+ - config/initializers/new_framework_defaults_7_0.rb
585
613
  - config/initializers/occams.rb
614
+ - config/initializers/permissions_policy.rb
586
615
  - config/locales/ar.yml
587
616
  - config/locales/ca.yml
588
617
  - config/locales/cs.yml