occams 1.0.7.2 → 1.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/coveralls.yml +11 -9
- data/.github/workflows/rubyonrails.yml +17 -15
- data/.gitignore +18 -16
- data/CHANGELOG.md +27 -11
- data/CONTRIBUTING.md +3 -4
- data/Gemfile +7 -5
- data/README.md +4 -3
- data/app/models/concerns/occams/cms/with_fragments.rb +1 -1
- data/app/models/occams/cms/fragment.rb +1 -1
- data/app/models/occams/cms/layout.rb +3 -1
- data/app/models/occams/cms/revision.rb +1 -1
- data/app/views/layouts/occams/admin/cms/_left.html.haml +1 -1
- data/bin/rails +3 -3
- data/bin/rake +2 -2
- data/bin/setup +11 -11
- data/config/application.rb +32 -7
- data/config/boot.rb +1 -4
- data/config/database.yml +30 -1
- data/config/environments/development.rb +9 -11
- data/config/environments/production.rb +26 -22
- data/config/environments/test.rb +16 -7
- data/config/initializers/content_security_policy.rb +2 -3
- data/config/initializers/filter_parameter_logging.rb +3 -3
- data/config/initializers/inflections.rb +0 -1
- data/config/initializers/new_framework_defaults_7_1.rb +224 -0
- data/config/initializers/permissions_policy.rb +10 -9
- data/gemfiles/6.1.gemfile +8 -5
- data/gemfiles/7.0.gemfile +7 -5
- data/gemfiles/7.1.gemfile +37 -0
- data/lib/generators/occams/cms/README +10 -2
- data/lib/occams/configuration.rb +1 -1
- data/lib/occams/content/tags/asset.rb +2 -2
- data/lib/occams/content/tags/audio.rb +2 -2
- data/lib/occams/content/tags/breadcrumbs.rb +2 -2
- data/lib/occams/content/tags/checkbox.rb +2 -2
- data/lib/occams/content/tags/children.rb +2 -2
- data/lib/occams/content/tags/date.rb +2 -2
- data/lib/occams/content/tags/datetime.rb +2 -2
- data/lib/occams/content/tags/file.rb +3 -3
- data/lib/occams/content/tags/file_link.rb +3 -3
- data/lib/occams/content/tags/files.rb +2 -2
- data/lib/occams/content/tags/fragment.rb +2 -2
- data/lib/occams/content/tags/helper.rb +2 -2
- data/lib/occams/content/tags/markdown.rb +2 -2
- data/lib/occams/content/tags/mixins/file_content.rb +1 -1
- data/lib/occams/content/tags/number.rb +2 -2
- data/lib/occams/content/tags/page_file_link.rb +3 -3
- data/lib/occams/content/tags/partial.rb +2 -2
- data/lib/occams/content/tags/siblings.rb +3 -2
- data/lib/occams/content/tags/snippet.rb +2 -2
- data/lib/occams/content/tags/template.rb +2 -2
- data/lib/occams/content/tags/text.rb +2 -2
- data/lib/occams/content/tags/textarea.rb +3 -2
- data/lib/occams/content/tags/wysiwyg.rb +2 -2
- data/lib/occams/content/tags.rb +28 -0
- data/lib/occams/content.rb +1 -26
- data/lib/occams/extensions/acts_as_tree.rb +3 -3
- data/lib/occams/extensions/has_revisions.rb +3 -3
- data/lib/occams/extensions.rb +8 -0
- data/lib/occams/routing.rb +74 -5
- data/lib/occams/version.rb +1 -1
- data/lib/occams.rb +3 -3
- data/occams.gemspec +13 -13
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcc8760162308f5d0ad46ac82f46fa92be816f9e8c6ee291759709ddc472513e
|
4
|
+
data.tar.gz: f67e7efd920a103c3027e0201e824ee95bea38853893688ca7cbd9b0961d9a6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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: [
|
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
|
-
-
|
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
|
-
|
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: [
|
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
|
-
-
|
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:
|
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:
|
45
|
+
- name: Lint the code
|
43
46
|
run: bin/bundle exec rubocop --parallel
|
44
47
|
|
45
|
-
- name:
|
46
|
-
run:
|
47
|
-
|
48
|
-
|
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
|
-
|
7
|
-
db/development_structure.sql
|
8
|
-
db/test.sqlite3-journal
|
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
|
-
.
|
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,13 +1,29 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## v1.0.
|
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
|
13
|
+
|
14
|
+
- Fixed edge case with siblings tag when current page is excluded
|
15
|
+
- Git ignore all sqlite* files for testing
|
16
|
+
- Small testing refinements
|
17
|
+
- Prep for Rails 7.1 compatibility
|
18
|
+
|
19
|
+
## v1.0.7.2 - 27 September 2023
|
4
20
|
|
5
21
|
- Pulled will_paginate option out in favor of Kaminari
|
6
22
|
- Switched CI from Buildkite to [Github actions](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml)
|
7
23
|
- Improved test coverage to 99+
|
8
24
|
- Removed backward compatibility to Rails prior to 6.x
|
9
25
|
|
10
|
-
## v1.0.7.1 -
|
26
|
+
## v1.0.7.1 - 22 September 2023
|
11
27
|
|
12
28
|
- Addressed deprecations for file type 'image/jpg'
|
13
29
|
- Added github workflow for tests, lints and audits
|
@@ -15,7 +31,7 @@
|
|
15
31
|
- Bumped rubocop version to latest
|
16
32
|
- Updated some testing parameters
|
17
33
|
|
18
|
-
## v1.0.7 -
|
34
|
+
## v1.0.7 - 12 September 2023
|
19
35
|
|
20
36
|
- Updated coveralls Coverage reporting
|
21
37
|
- Added minitest-reporters for test output
|
@@ -24,33 +40,33 @@
|
|
24
40
|
- Lints and 1 typo
|
25
41
|
- Added Build Status and Coveralls Coverage Status to README
|
26
42
|
|
27
|
-
## v1.0.6.1 -
|
43
|
+
## v1.0.6.1 - 5 September 2023
|
28
44
|
|
29
45
|
- Fixed siblings and children nav tags which as written had problems creating child pages in the admin panel
|
30
46
|
|
31
|
-
## v1.0.6 -
|
47
|
+
## v1.0.6 - 5 September 2023
|
32
48
|
|
33
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
|
34
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
|
35
51
|
|
36
|
-
## v1.0.5 -
|
52
|
+
## v1.0.5 - 31 August 2023
|
37
53
|
|
38
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.
|
39
55
|
- Tests added for new tags
|
40
56
|
- TODO: set up CI pipeline
|
41
57
|
|
42
|
-
## v1.0.4 -
|
58
|
+
## v1.0.4 - 26 August 2023
|
43
59
|
|
44
60
|
- Added [cms:breadcrumbs Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#breadcrumbs)
|
45
61
|
- Added [cms:siblings Nav tag](https://github.com/avonderluft/occams/wiki/Content-Tags#siblings)
|
46
62
|
- Updated [wiki documentation](https://github.com/avonderluft/occams/wiki)
|
47
63
|
|
48
|
-
## v1.0.3 -
|
64
|
+
## v1.0.3 - 15 August 2023
|
49
65
|
|
50
66
|
- Added a [cms:audio tag](https://github.com/avonderluft/occams/wiki/Content-Tags#audio) for an embedded audio player
|
51
67
|
- Some formatting of admin menu footer
|
52
68
|
|
53
|
-
## v1.0.2 -
|
69
|
+
## v1.0.2 - 14 August 2023
|
54
70
|
|
55
71
|
- Fixed image rendering which rubocop broke in v1.0.1
|
56
72
|
- Show unpublished pages in Rails development mode
|
@@ -58,14 +74,14 @@
|
|
58
74
|
- Updated documentation at [Occams Wiki](https://github.com/avonderluft/occams/wiki)
|
59
75
|
- Comprehensive rubocop linting
|
60
76
|
|
61
|
-
## v1.0.1 -
|
77
|
+
## v1.0.1 - 7 August 2023
|
62
78
|
|
63
79
|
- Fixed image thumbnail hover for Rails 7
|
64
80
|
- Added display of Rails and Ruby versions along with Occams version at foot of Admin menu
|
65
81
|
- Refined gemspec dependencies
|
66
82
|
- Tweaked with a bunch of rubocop linting
|
67
83
|
|
68
|
-
## v1.0.0 -
|
84
|
+
## v1.0.0 - 5 August 2023
|
69
85
|
|
70
86
|
- Copied the original [ComfortableMexicanSofa](https://github.com/comfy/comfortable-mexican-sofa)
|
71
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.
|
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
|
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
|
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
@@ -5,16 +5,15 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
5
5
|
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem 'rails', '~> 7.0'
|
8
|
+
gem 'rails', '~> 7.0.0'
|
9
9
|
|
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 '
|
16
|
-
gem '
|
17
|
-
gem '
|
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
@@ -4,7 +4,7 @@
|
|
4
4
|
[![Coverage Status](https://coveralls.io/repos/github/avonderluft/occams/badge.svg?branch=main)](https://coveralls.io/github/avonderluft/occams?branch=main)
|
5
5
|
[![Gem Version](https://img.shields.io/gem/v/occams.svg?style=flat)](http://rubygems.org/gems/occams)
|
6
6
|
[![Gem Downloads](https://img.shields.io/gem/dt/occams.svg?style=flat)](http://rubygems.org/gems/occams)
|
7
|
-
[![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/avonderluft/occams)](https://github.com/avonderluft/occams/releases)
|
7
|
+
[![GitHub Release Date - Published_At](https://img.shields.io/github/release-date/avonderluft/occams?label=last%20release&color=seagreen)](https://github.com/avonderluft/occams/releases)
|
8
8
|
|
9
9
|
***Prefer Simplicity.***
|
10
10
|
|
@@ -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
|
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::
|
80
|
+
.select { |n| n.is_a?(Occams::Content::Tags::Fragment) }
|
81
81
|
.uniq(&:identifier)
|
82
82
|
end
|
83
83
|
|
@@ -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::
|
72
|
+
fragment_tags = Occams::Content::Tags::Fragment.subclasses.map do |c|
|
71
73
|
Occams::Content::Renderer.tags.key(c)
|
72
74
|
end
|
73
75
|
|
data/bin/rails
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
APP_PATH = File.expand_path(
|
3
|
-
require_relative
|
4
|
-
require
|
2
|
+
APP_PATH = File.expand_path("../config/application", __dir__)
|
3
|
+
require_relative "../config/boot"
|
4
|
+
require "rails/commands"
|
data/bin/rake
CHANGED
data/bin/setup
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
2
|
+
require "fileutils"
|
3
3
|
|
4
4
|
# path to your application root.
|
5
|
-
APP_ROOT = File.expand_path(
|
5
|
+
APP_ROOT = File.expand_path("..", __dir__)
|
6
6
|
|
7
7
|
def system!(*args)
|
8
|
-
system(*args
|
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
|
17
|
-
system!
|
18
|
-
system(
|
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?(
|
22
|
-
# FileUtils.cp
|
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!
|
26
|
+
system! "bin/rails db:prepare"
|
27
27
|
|
28
28
|
puts "\n== Removing old logs and tempfiles =="
|
29
|
-
system!
|
29
|
+
system! "bin/rails log:clear tmp:clear"
|
30
30
|
|
31
31
|
puts "\n== Restarting application server =="
|
32
|
-
system!
|
32
|
+
system! "bin/rails restart"
|
33
33
|
end
|
data/config/application.rb
CHANGED
@@ -10,10 +10,31 @@ Bundler.require(*Rails.groups)
|
|
10
10
|
|
11
11
|
module Occams
|
12
12
|
class Application < Rails::Application
|
13
|
-
|
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
|
-
#
|
16
|
-
config.
|
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,11 +46,15 @@ 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
|
-
config.active_record.yaml_column_permitted_classes = [
|
51
|
+
config.active_record.yaml_column_permitted_classes = [
|
52
|
+
Symbol,
|
53
|
+
Date,
|
54
|
+
Time,
|
55
|
+
ActiveSupport::TimeWithZone,
|
56
|
+
ActiveSupport::TimeZone,
|
57
|
+
ActiveSupport::SafeBuffer
|
58
|
+
]
|
34
59
|
end
|
35
60
|
end
|
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'
|
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.
|
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
|