occams 1.0.7.3 → 1.0.8

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.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/coveralls.yml +11 -9
  3. data/.github/workflows/rubyonrails.yml +17 -15
  4. data/.gitignore +18 -16
  5. data/CHANGELOG.md +21 -12
  6. data/CONTRIBUTING.md +3 -4
  7. data/Gemfile +6 -4
  8. data/README.md +3 -2
  9. data/app/models/concerns/occams/cms/with_fragments.rb +1 -1
  10. data/app/models/occams/cms/fragment.rb +1 -1
  11. data/app/models/occams/cms/layout.rb +3 -1
  12. data/app/models/occams/cms/revision.rb +1 -1
  13. data/app/views/layouts/occams/admin/cms/_left.html.haml +1 -1
  14. data/bin/rails +3 -3
  15. data/bin/rake +2 -2
  16. data/bin/setup +11 -11
  17. data/config/application.rb +24 -6
  18. data/config/boot.rb +1 -4
  19. data/config/database.yml +30 -1
  20. data/config/environments/development.rb +9 -11
  21. data/config/environments/production.rb +26 -22
  22. data/config/environments/test.rb +16 -7
  23. data/config/initializers/content_security_policy.rb +2 -3
  24. data/config/initializers/filter_parameter_logging.rb +3 -3
  25. data/config/initializers/inflections.rb +0 -1
  26. data/config/initializers/new_framework_defaults_7_1.rb +224 -0
  27. data/config/initializers/permissions_policy.rb +10 -9
  28. data/gemfiles/6.1.gemfile +7 -4
  29. data/gemfiles/7.0.gemfile +6 -4
  30. data/gemfiles/7.1.gemfile +37 -0
  31. data/lib/generators/occams/cms/README +10 -2
  32. data/lib/occams/configuration.rb +1 -1
  33. data/lib/occams/content/tags/asset.rb +2 -2
  34. data/lib/occams/content/tags/audio.rb +2 -2
  35. data/lib/occams/content/tags/breadcrumbs.rb +2 -2
  36. data/lib/occams/content/tags/checkbox.rb +2 -2
  37. data/lib/occams/content/tags/children.rb +2 -2
  38. data/lib/occams/content/tags/date.rb +2 -2
  39. data/lib/occams/content/tags/datetime.rb +2 -2
  40. data/lib/occams/content/tags/file.rb +3 -3
  41. data/lib/occams/content/tags/file_link.rb +3 -3
  42. data/lib/occams/content/tags/files.rb +2 -2
  43. data/lib/occams/content/tags/fragment.rb +2 -2
  44. data/lib/occams/content/tags/helper.rb +2 -2
  45. data/lib/occams/content/tags/markdown.rb +2 -2
  46. data/lib/occams/content/tags/mixins/file_content.rb +1 -1
  47. data/lib/occams/content/tags/number.rb +2 -2
  48. data/lib/occams/content/tags/page_file_link.rb +3 -3
  49. data/lib/occams/content/tags/partial.rb +2 -2
  50. data/lib/occams/content/tags/siblings.rb +2 -2
  51. data/lib/occams/content/tags/snippet.rb +2 -2
  52. data/lib/occams/content/tags/template.rb +2 -2
  53. data/lib/occams/content/tags/text.rb +2 -2
  54. data/lib/occams/content/tags/textarea.rb +3 -2
  55. data/lib/occams/content/tags/wysiwyg.rb +2 -2
  56. data/lib/occams/content/tags.rb +28 -0
  57. data/lib/occams/content.rb +1 -26
  58. data/lib/occams/extensions/acts_as_tree.rb +3 -3
  59. data/lib/occams/extensions/has_revisions.rb +3 -3
  60. data/lib/occams/extensions.rb +8 -0
  61. data/lib/occams/routing.rb +74 -5
  62. data/lib/occams/version.rb +1 -1
  63. data/lib/occams.rb +3 -3
  64. data/occams.gemspec +13 -13
  65. metadata +8 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97f3c2e83bbf1b0aed1f59775a3bac214997aa5569687460ec48e44ff9c62bd8
4
- data.tar.gz: fcba8bd301c5628533c5d048d4238429d3471f94bbe4d2bf06a8003628635136
3
+ metadata.gz: fcc8760162308f5d0ad46ac82f46fa92be816f9e8c6ee291759709ddc472513e
4
+ data.tar.gz: f67e7efd920a103c3027e0201e824ee95bea38853893688ca7cbd9b0961d9a6d
5
5
  SHA512:
6
- metadata.gz: baadb59130faf8bcf1f50de653b9eb3238175830331a5fd1c8b899be92f84de23cb218c9a8ca1d5449b4c99793f14c13b6eed8b00130309a0fef50ffafcfc484
7
- data.tar.gz: 237e11025f46b90286420873b9e0bc4278485a7e428bcffb1955ecd9aff13ec583031a4c349f2971f95b1276503dfa21f31f63e3249d6fcf6ed2a76f18330ad7
6
+ metadata.gz: aa7e678609d40af0dcd82a99a135f398006120c6b867a51a5814a7295f2540ec9771a21a0e972d64299e552b989b267748d35f8fe0c242b4fb2cc731e0086275
7
+ data.tar.gz: aaab1c6865ad43badee1f359c76fa3e45157f85ecb16f742c309c2ebd5de5430426745155f97fb619568d1d3280b2bdc21b33a9ba48f7e6eed763dcaa47a0ec9
@@ -13,7 +13,7 @@ jobs:
13
13
  - "3.2"
14
14
  rails-version:
15
15
  - "7.0"
16
- continue-on-error: [false]
16
+ continue-on-error: [true]
17
17
  name: ${{ format('Coverage (Ruby {0}, Rails {1})', matrix.ruby-version, matrix.rails-version) }}
18
18
  runs-on: ubuntu-latest
19
19
  continue-on-error: ${{ matrix.continue-on-error }}
@@ -23,16 +23,18 @@ jobs:
23
23
  COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
24
24
 
25
25
  steps:
26
- - uses: actions/checkout@v2
26
+ - name: Checkout source
27
+ uses: actions/checkout@v2
27
28
 
28
- - name: Install Ruby
29
+ - name: Install Ruby ${{ matrix.ruby-version }}
29
30
  uses: ruby/setup-ruby@v1
30
31
  with:
31
32
  ruby-version: ${{ matrix.ruby-version }}
32
- bundler-cache: true
33
-
34
- - name: Set up Test DB
35
- run: bin/rails db:migrate RAILS_ENV=test
36
- - name: Run tests
37
- run: bin/rake test
38
33
 
34
+ - name: Run tests, report coverage
35
+ run: |
36
+ bin/bundle install --retry 3 --quiet
37
+ bin/bundle exec rails db:drop
38
+ bin/bundle exec rails db:create
39
+ bin/bundle exec rails db:migrate
40
+ bin/bundle exec rails test:db
@@ -6,17 +6,18 @@ on:
6
6
  pull_request:
7
7
 
8
8
  jobs:
9
- test_lint_audit:
9
+ build_test_lint_audit:
10
10
  strategy:
11
11
  matrix:
12
12
  ruby-version:
13
13
  - "2.7"
14
14
  - "3.1"
15
15
  - "3.2"
16
+ - "3.3"
16
17
  rails-version:
17
18
  - "6.1"
18
19
  - "7.0"
19
- continue-on-error: [false]
20
+ continue-on-error: [true]
20
21
  name: ${{ format('Tests (Ruby {0}, Rails {1})', matrix.ruby-version, matrix.rails-version) }}
21
22
  runs-on: ubuntu-latest
22
23
  continue-on-error: ${{ matrix.continue-on-error }}
@@ -24,26 +25,27 @@ jobs:
24
25
  BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails-version }}.gemfile
25
26
  RAILS_ENV: test
26
27
  SKIP_COV: true
27
-
28
28
  steps:
29
- - uses: actions/checkout@v2
29
+ - name: Checkout source
30
+ uses: actions/checkout@v2
30
31
 
31
- - name: Install Ruby
32
+ - name: Install Ruby ${{ matrix.ruby-version }}
32
33
  uses: ruby/setup-ruby@v1
33
34
  with:
34
35
  ruby-version: ${{ matrix.ruby-version }}
35
- bundler-cache: true
36
36
 
37
- - name: Set up Test DB
38
- run: bin/rails db:migrate RAILS_ENV=test
39
37
  - name: Run tests
40
- run: bin/rake test
38
+ run: |
39
+ bin/bundle install --retry 3 --quiet
40
+ bin/bundle exec rails db:drop
41
+ bin/bundle exec rails db:create
42
+ bin/bundle exec rails db:migrate
43
+ bin/bundle exec rails test:db
41
44
 
42
- - name: Ruby Lint
45
+ - name: Lint the code
43
46
  run: bin/bundle exec rubocop --parallel
44
47
 
45
- - name: Security audit application code
46
- run: bin/bundle exec brakeman -q -w3
47
-
48
- - name: Security audit dependencies
49
- run: bin/bundle exec bundler-audit --update --gemfile-lock gemfiles/${{ matrix.rails-version }}.gemfile.lock
48
+ - name: Audit for security
49
+ run: |
50
+ bin/bundle exec brakeman -q -w3
51
+ bin/bundle exec bundler-audit --update --gemfile-lock gemfiles/${{ matrix.rails-version }}.gemfile.lock
data/.gitignore CHANGED
@@ -1,22 +1,24 @@
1
1
  .bundle
2
- db/*.sqlite3
3
- log/*.log
4
- tmp/**/*
5
2
  .DS_Store
6
- db/schema.rb
7
- db/development_structure.sql
8
- db/test.sqlite3*
9
- pkg
10
- rdoc
11
- /tmp
12
- public/system/
13
- Gemfile.lock
14
- gemfiles/*.gemfile.lock
15
- .rvmrc
16
- .ruby-version
3
+ .idea
17
4
  .ruby-gemset
5
+ .ruby-version
6
+ .rvmrc
7
+ .vscode
18
8
  /.sass-cache
19
- coverage/
20
9
  /storage
10
+ /tmp
11
+ coverage/
12
+ db/*.sqlite3
21
13
  db/cms_fixtures/test-site/
22
- .idea
14
+ db/development_structure.sql
15
+ db/schema.rb
16
+ db/test.sqlite3*
17
+ Gemfile.lock
18
+ gemfiles/*.gemfile.lock
19
+ log/
20
+ pkg
21
+ public/system/
22
+ rdoc
23
+ tmp/**/*
24
+ vendor/bundle/
data/CHANGELOG.md CHANGED
@@ -1,20 +1,29 @@
1
1
  # Changelog
2
2
 
3
- ## v1.0.7.3 - 10/7/2023
3
+ ## v1.0.8 - 29 December 2023
4
+
5
+ - Updated configs, et al. in pursuit of Rails 7.1 compatibility
6
+ - Added explicit coder for serialize commands
7
+ - Added ActiveRecord Adapter (database) info to admin footer
8
+ - Added commented defaults for MySQL and Postgres to database.yml
9
+ - Updated documentation
10
+ - Refactored lib files for better test coverage awareness
11
+
12
+ ## v1.0.7.3 - 7 October 2023
4
13
 
5
14
  - Fixed edge case with siblings tag when current page is excluded
6
15
  - Git ignore all sqlite* files for testing
7
16
  - Small testing refinements
8
17
  - Prep for Rails 7.1 compatibility
9
18
 
10
- ## v1.0.7.2 - 9/27/2023
19
+ ## v1.0.7.2 - 27 September 2023
11
20
 
12
21
  - Pulled will_paginate option out in favor of Kaminari
13
22
  - Switched CI from Buildkite to [Github actions](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml)
14
23
  - Improved test coverage to 99+
15
24
  - Removed backward compatibility to Rails prior to 6.x
16
25
 
17
- ## v1.0.7.1 - 9/22/2023
26
+ ## v1.0.7.1 - 22 September 2023
18
27
 
19
28
  - Addressed deprecations for file type 'image/jpg'
20
29
  - Added github workflow for tests, lints and audits
@@ -22,7 +31,7 @@
22
31
  - Bumped rubocop version to latest
23
32
  - Updated some testing parameters
24
33
 
25
- ## v1.0.7 - 9/12/2023
34
+ ## v1.0.7 - 12 September 2023
26
35
 
27
36
  - Updated coveralls Coverage reporting
28
37
  - Added minitest-reporters for test output
@@ -31,33 +40,33 @@
31
40
  - Lints and 1 typo
32
41
  - Added Build Status and Coveralls Coverage Status to README
33
42
 
34
- ## v1.0.6.1 - 9/5/2023
43
+ ## v1.0.6.1 - 5 September 2023
35
44
 
36
45
  - Fixed siblings and children nav tags which as written had problems creating child pages in the admin panel
37
46
 
38
- ## v1.0.6 - 9/5/2023
47
+ ## v1.0.6 - 5 September 2023
39
48
 
40
49
  - Fixed [cms:siblings Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#siblings) to handle edge case when page(s) are excluded by the `exclude` parameter
41
50
  - Added [cms:children Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#children) to render unordered list of links for children of current page
42
51
 
43
- ## v1.0.5 - 8/31/2023
52
+ ## v1.0.5 - 31 August 2023
44
53
 
45
54
  - 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.
46
55
  - Tests added for new tags
47
56
  - TODO: set up CI pipeline
48
57
 
49
- ## v1.0.4 - 8/26/2023
58
+ ## v1.0.4 - 26 August 2023
50
59
 
51
60
  - Added [cms:breadcrumbs Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#breadcrumbs)
52
61
  - Added [cms:siblings Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#siblings)
53
62
  - Updated [wiki documentation](https://github.com/avonderluft/occams/wiki)
54
63
 
55
- ## v1.0.3 - 8/15/2023
64
+ ## v1.0.3 - 15 August 2023
56
65
 
57
66
  - Added a [cms:audio tag](https://github.com/avonderluft/occams/wiki/Content-Tags#audio) for an embedded audio player
58
67
  - Some formatting of admin menu footer
59
68
 
60
- ## v1.0.2 - 8/14/2023
69
+ ## v1.0.2 - 14 August 2023
61
70
 
62
71
  - Fixed image rendering which rubocop broke in v1.0.1
63
72
  - Show unpublished pages in Rails development mode
@@ -65,14 +74,14 @@
65
74
  - Updated documentation at [Occams Wiki](https://github.com/avonderluft/occams/wiki)
66
75
  - Comprehensive rubocop linting
67
76
 
68
- ## v1.0.1 - 8/7/2023
77
+ ## v1.0.1 - 7 August 2023
69
78
 
70
79
  - Fixed image thumbnail hover for Rails 7
71
80
  - Added display of Rails and Ruby versions along with Occams version at foot of Admin menu
72
81
  - Refined gemspec dependencies
73
82
  - Tweaked with a bunch of rubocop linting
74
83
 
75
- ## v1.0.0 - 8/5/2023
84
+ ## v1.0.0 - 5 August 2023
76
85
 
77
86
  - Copied the original [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa)
78
87
  - Added the changes from [Restarone's fork](https://github.com/restarone/comfortable-mexican-sofa) (23 commits)
data/CONTRIBUTING.md CHANGED
@@ -24,12 +24,11 @@ Fork the project. Optionally, create a branch you want to work on.
24
24
  - Tests please, but nothing complicated. UnitTest / Fixtures all the way. Make sure all tests pass.
25
25
  - Run `bundle exec rubocop` and fix any issues raised.
26
26
 
27
- ### 4. Make a pull request
27
+ ### 4. Create a pull request
28
28
 
29
29
  - If you never done it before read this: https://help.github.com/articles/using-pull-requests
30
- - When PR is submitted check if TravisCI ran all tests successfully and Rubocop didn't raise any issues
30
+ - When PR is submitted check if [Github Actions](https://github.com/avonderluft/occams/actions) ran all tests successfully and Rubocop didn't raise any issues
31
31
 
32
32
  ### 5. Done!
33
33
 
34
- If everything is good your changes will be merged into master branch. Eventually
35
- a new version of gem will be published.
34
+ If everything looks good, we will review your changes to be merged into the main branch, and publish a new version of the gem.
data/Gemfile CHANGED
@@ -10,11 +10,10 @@ gem 'rails', '~> 7.0.0'
10
10
  group :development, :test do
11
11
  gem 'autoprefixer-rails', '~> 8.1.0'
12
12
  gem 'byebug', '~> 10.0.0', platforms: %i[mri mingw x64_mingw]
13
- gem 'capybara', '~> 3.39.0'
14
13
  gem 'image_processing', '>= 1.2'
15
- gem 'kaminari', '~> 1.2', '>= 1.2.2'
16
- gem 'selenium-webdriver', '~> 4.9.0'
17
- gem 'sqlite3', '~> 1.4.2'
14
+ gem 'sqlite3', '~> 1.6.7'
15
+ # gem 'mysql2', '~> 0.5'
16
+ # gem 'pg', '~> 1.5.4'
18
17
  end
19
18
 
20
19
  group :development do
@@ -25,12 +24,15 @@ end
25
24
  group :test do
26
25
  gem 'brakeman', '~> 5.4.1'
27
26
  gem 'bundler-audit', '~> 0.9.1'
27
+ gem 'capybara', '~> 3.39.0'
28
28
  gem 'coveralls_reborn', '~> 0.28.0', require: false
29
+ gem 'cuprite', '~> 0.14.3'
29
30
  gem 'diffy', '~> 3.4.2'
30
31
  gem 'equivalent-xml', '~> 0.6.0'
31
32
  gem 'minitest', '~> 5.20.0'
32
33
  gem 'minitest-reporters', '~> 1.6.1'
33
34
  gem 'mocha', '~> 2.1.0', require: false
35
+ gem 'puma', '~> 6.4.0'
34
36
  gem 'rails-controller-testing', '~> 1.0.5'
35
37
  gem 'rubocop', '~> 1.56.0', require: false
36
38
  gem 'simplecov', '~> 0.22.0', require: false
data/README.md CHANGED
@@ -47,8 +47,9 @@ ocCaM'S, pronounced "AH-kums" is a nod to [Occam's Razor](https://en.wikipedia.o
47
47
 
48
48
  ## Compatibility
49
49
 
50
- - [Test suite](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml) on Ruby 2.7, 3.1 and 3.2 with Rails 6.1 and 7.0+
51
- - On Ruby 3.2, Rails 7+ is recommended, since performance is noticably better than 6
50
+ - [Test suite](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml) on Ruby >= 2.7 with Rails >= 6.1
51
+ - On Ruby 3.2, Rails 7.x + is recommended, since performance is noticably better than on 6.x
52
+ - Sites do run on Rails 7.1, e.g. [GKNT](https://gknt.org/), but some tests fail in [Github Actions](https://github.com/avonderluft/occams/actions). Your mileage may vary.
52
53
 
53
54
  ## Installation
54
55
 
@@ -77,7 +77,7 @@ module Occams::Cms::WithFragments
77
77
  # duplicate tags on the layout. That's wierd (but still works).
78
78
  def fragment_nodes
79
79
  nodes
80
- .select { |n| n.is_a?(Occams::Content::Tag::Fragment) }
80
+ .select { |n| n.is_a?(Occams::Content::Tags::Fragment) }
81
81
  .uniq(&:identifier)
82
82
  end
83
83
 
@@ -5,7 +5,7 @@ class Occams::Cms::Fragment < ActiveRecord::Base
5
5
 
6
6
  has_many_attached :attachments
7
7
 
8
- serialize :content
8
+ serialize :content, coder: Psych
9
9
 
10
10
  attr_reader :files
11
11
 
@@ -3,6 +3,8 @@
3
3
  class Occams::Cms::Layout < ActiveRecord::Base
4
4
  self.table_name = 'occams_cms_layouts'
5
5
 
6
+ require_relative '../../../../lib/occams/extensions/acts_as_tree'
7
+
6
8
  cms_acts_as_tree
7
9
  cms_has_revisions_for :content, :css, :js
8
10
 
@@ -67,7 +69,7 @@ class Occams::Cms::Layout < ActiveRecord::Base
67
69
  tokens = renderer.tokenize(content)
68
70
 
69
71
  if parent
70
- fragment_tags = Occams::Content::Tag::Fragment.subclasses.map do |c|
72
+ fragment_tags = Occams::Content::Tags::Fragment.subclasses.map do |c|
71
73
  Occams::Content::Renderer.tags.key(c)
72
74
  end
73
75
 
@@ -3,7 +3,7 @@
3
3
  class Occams::Cms::Revision < ActiveRecord::Base
4
4
  self.table_name = 'occams_cms_revisions'
5
5
 
6
- serialize :data
6
+ serialize :data, coder: Psych
7
7
 
8
8
  # -- Relationships --------------------------------------------------------
9
9
  belongs_to :record, polymorphic: true
@@ -42,5 +42,5 @@
42
42
  = link_to 'Ruby', 'https://www.ruby-lang.org', target: '_blank'
43
43
  %span.version= RUBY_VERSION
44
44
  %br
45
- = Rails.env.upcase
45
+ = Rails.env.upcase + ' - ' + ActiveRecord::Base.connection.adapter_name
46
46
 
data/bin/rails CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../config/application', __dir__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
2
+ APP_PATH = File.expand_path("../config/application", __dir__)
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
data/bin/rake CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
2
+ require_relative "../config/boot"
3
+ require "rake"
4
4
  Rake.application.run
data/bin/setup CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
- require 'fileutils'
2
+ require "fileutils"
3
3
 
4
4
  # path to your application root.
5
- APP_ROOT = File.expand_path('..', __dir__)
5
+ APP_ROOT = File.expand_path("..", __dir__)
6
6
 
7
7
  def system!(*args)
8
- system(*args) || abort("\n== Command #{args} failed ==")
8
+ system(*args, exception: true)
9
9
  end
10
10
 
11
11
  FileUtils.chdir APP_ROOT do
@@ -13,21 +13,21 @@ FileUtils.chdir APP_ROOT do
13
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
- puts '== Installing dependencies =='
17
- system! 'gem install bundler --conservative'
18
- system('bundle check') || system!('bundle install')
16
+ puts "== Installing dependencies =="
17
+ system! "gem install bundler --conservative"
18
+ system("bundle check") || system!("bundle install")
19
19
 
20
20
  # puts "\n== Copying sample files =="
21
- # unless File.exist?('config/database.yml')
22
- # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
21
+ # unless File.exist?("config/database.yml")
22
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
23
23
  # end
24
24
 
25
25
  puts "\n== Preparing database =="
26
- system! 'bin/rails db:setup'
26
+ system! "bin/rails db:prepare"
27
27
 
28
28
  puts "\n== Removing old logs and tempfiles =="
29
- system! 'bin/rails log:clear tmp:clear'
29
+ system! "bin/rails log:clear tmp:clear"
30
30
 
31
31
  puts "\n== Restarting application server =="
32
- system! 'bin/rails restart'
32
+ system! "bin/rails restart"
33
33
  end
@@ -10,10 +10,31 @@ Bundler.require(*Rails.groups)
10
10
 
11
11
  module Occams
12
12
  class Application < Rails::Application
13
- require_relative '../lib/occams'
13
+ # Load defaults based on Rails major/minor version
14
+ config.load_defaults Rails.version.scan(%r{^\d+\.\d+}).first.to_f
15
+
16
+ # Rails 7.1 compatibility - See config/initializers/new_framework_defaults_7_1.rb
17
+ config.add_autoload_paths_to_load_path = true
18
+
19
+ if Gem::Version.new(Rails.version) >= Gem::Version.new('7.1.0')
20
+ config.active_record.default_column_serializer = YAML
21
+ config.active_record.before_committed_on_all_records = false
22
+ config.active_record.commit_transaction_on_non_local_return = false
23
+ config.active_record.run_after_transaction_callbacks_in_order_defined = false
24
+ config.active_support.message_serializer = :json
25
+ config.active_record.run_commit_callbacks_on_first_saved_instances_in_transaction = true
26
+ # config.active_record.allow_deprecated_singular_associations_name = true
27
+ # config.active_support.raise_on_invalid_cache_expiration_time = false
28
+ # config.active_record.sqlite3_adapter_strict_strings_by_default = false
29
+ # config.active_support.cache_format_version = 7.0
30
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
31
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
32
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
33
+ config.autoload_lib(ignore: %w[generators])
34
+ end
14
35
 
15
- # Initialize configuration defaults for originally generated Rails version.
16
- config.load_defaults 6.1
36
+ # Making sure we don't load our dev routes as part of the engine
37
+ config.paths['config/routes.rb'] << 'config/cms_routes.rb'
17
38
 
18
39
  # Configuration for the application, engines, and railties goes here.
19
40
  #
@@ -25,9 +46,6 @@ module Occams
25
46
  # Ensuring that all ActiveStorage routes are loaded before out globbing route.
26
47
  config.railties_order = [ActiveStorage::Engine, :main_app, :all]
27
48
 
28
- # Making sure we don't load our dev routes as part of the engine
29
- config.paths['config/routes.rb'] << 'config/cms_routes.rb'
30
-
31
49
  config.i18n.enforce_available_locales = true
32
50
 
33
51
  config.active_record.yaml_column_permitted_classes = [
data/config/boot.rb CHANGED
@@ -1,8 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Set up gems listed in the Gemfile.
4
3
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
5
4
 
6
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
7
-
8
- File.exist? ENV.fetch('BUNDLE_GEMFILE')
5
+ require 'bundler/setup' # Set up gems listed in the Gemfile.
data/config/database.yml CHANGED
@@ -8,4 +8,33 @@ test:
8
8
  adapter: sqlite3
9
9
  database: db/test.sqlite3
10
10
  pool: 5
11
- timeout: 10000
11
+ timeout: 10000
12
+
13
+ # default: &default
14
+ # adapter: mysql2
15
+ # encoding: utf8mb4
16
+ # pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
17
+ # username: root
18
+ # password:
19
+ # socket: /tmp/mysql.sock
20
+ #
21
+ # development:
22
+ # <<: *default
23
+ # database: occams_dev
24
+ #
25
+ # test:
26
+ # <<: *default
27
+ # database: occams_test
28
+
29
+ # default: &default
30
+ # adapter: postgresql
31
+ # encoding: unicode
32
+ # pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
33
+ #
34
+ # development:
35
+ # <<: *default
36
+ # database: occams_dev
37
+ #
38
+ # test:
39
+ # <<: *default
40
+ # database: occams_test
@@ -8,7 +8,7 @@ defined?(Occams::Application) && Occams::Application.configure do
8
8
  # In the development environment your application's code is reloaded any time
9
9
  # it changes. This slows down response time but is perfect for development
10
10
  # since you don't have to restart the web server when you make code changes.
11
- config.cache_classes = false
11
+ config.enable_reloading = true
12
12
 
13
13
  # Do not eager load code on boot.
14
14
  config.eager_load = false
@@ -55,22 +55,15 @@ defined?(Occams::Application) && Occams::Application.configure do
55
55
  # Raise an error on page load if there are pending migrations.
56
56
  config.active_record.migration_error = :page_load
57
57
 
58
- # Debug mode disables concatenation and preprocessing of assets.
59
- # This option may cause significant delays in view rendering with a large
60
- # number of complex assets.
61
- config.assets.debug = true
62
-
63
58
  # Highlight code that triggered database queries in logs.
64
59
  config.active_record.verbose_query_logs = true
65
60
 
61
+ # Highlight code that enqueued background job in logs.
62
+ config.active_job.verbose_enqueue_logs = true
63
+
66
64
  # Suppress logger output for asset requests.
67
65
  config.assets.quiet = true
68
66
 
69
- # Use an evented file watcher to asynchronously detect changes in source code,
70
- # routes, locales, etc. This feature depends on the listen gem.
71
- config.file_watcher = ActiveSupport::EventedFileUpdateChecker
72
-
73
- config.active_job.queue_adapter = :inline
74
67
  # Raises error for missing translations.
75
68
  # config.i18n.raise_on_missing_translations = true
76
69
 
@@ -79,4 +72,9 @@ defined?(Occams::Application) && Occams::Application.configure do
79
72
 
80
73
  # Uncomment if you wish to allow Action Cable access from any origin.
81
74
  # config.action_cable.disable_request_forgery_protection = true
75
+
76
+ if Gem::Version.new(Rails.version) >= Gem::Version.new('7.1.0')
77
+ # Raise error when a before_action's only/except options reference missing actions
78
+ config.action_controller.raise_on_missing_callback_actions = true
79
+ end
82
80
  end
@@ -6,7 +6,7 @@ defined?(Occams::Application) && Occams::Application.configure do
6
6
  # Settings specified here will take precedence over those in config/application.rb.
7
7
 
8
8
  # Code is not reloaded between requests.
9
- config.cache_classes = true
9
+ config.enable_reloading = false
10
10
 
11
11
  # Eager load code on boot. This eager loads most of Rails and
12
12
  # your application in memory, allowing both threaded web servers
@@ -18,12 +18,11 @@ defined?(Occams::Application) && Occams::Application.configure do
18
18
  config.consider_all_requests_local = false
19
19
  config.action_controller.perform_caching = true
20
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).
21
+ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
22
+ # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
23
23
  # config.require_master_key = true
24
24
 
25
- # Disable serving static files from the `/public` folder by default since
26
- # Apache or NGINX already handles this.
25
+ # Enable static file serving from the `/public` folder (turn off if using NGINX/Apache for it).
27
26
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
28
27
 
29
28
  # Compress CSS using a preprocessor.
@@ -47,16 +46,26 @@ defined?(Occams::Application) && Occams::Application.configure do
47
46
  # config.action_cable.url = "wss://example.com/cable"
48
47
  # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
49
48
 
49
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
50
+ # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
51
+ # config.assume_ssl = true
52
+
50
53
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
51
- # config.force_ssl = true
54
+ config.force_ssl = true
52
55
 
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
+ # Log to STDOUT by default
57
+ config.logger = ActiveSupport::Logger.new($stdout)
58
+ .tap { |logger| logger.formatter = Logger::Formatter.new }
59
+ .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
56
60
 
57
61
  # Prepend all log lines with the following tags.
58
62
  config.log_tags = [:request_id]
59
63
 
64
+ # Info include generic and useful information about system operation, but avoids logging too much
65
+ # information to avoid inadvertent exposure of personally identifiable information (PII). If you
66
+ # want to log everything, set the level to "debug".
67
+ config.log_level = ENV.fetch('RAILS_LOG_LEVEL', 'info')
68
+
60
69
  # Use a different cache store in production.
61
70
  # config.cache_store = :mem_cache_store
62
71
 
@@ -77,19 +86,14 @@ defined?(Occams::Application) && Occams::Application.configure do
77
86
  # Don't log any deprecations.
78
87
  config.active_support.report_deprecations = false
79
88
 
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
89
  # Do not dump schema after migrations.
94
90
  config.active_record.dump_schema_after_migration = false
91
+
92
+ # Enable DNS rebinding protection and other `Host` header attacks.
93
+ # config.hosts = [
94
+ # "example.com", # Allow requests from example.com
95
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
96
+ # ]
97
+ # Skip DNS rebinding protection for the default health check endpoint.
98
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
95
99
  end