occams 1.0.7.1 → 1.0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a00b3daa132f332250a7764bb37a42535293eb290c00fdba37febd63f8950873
4
- data.tar.gz: '05929ac5d67803f5fd855bc602e255e31dd730615108a1561c4e03541cb9528f'
3
+ metadata.gz: e9fce10bdb602179a806185f8069a8121d8405e4e9e04839e433096572207342
4
+ data.tar.gz: 96efa1be357c97aa6659ff74cd865a9c4e7732880c0817469e6cee0da1bcb745
5
5
  SHA512:
6
- metadata.gz: ff72090234dae1fc2d750b696c7796d190a73b349bbe2f2e731f5b906c6b4e0550cbdf67a94c9b986f9f603841f7c00ecbe17fd2007492930eb8484a3aaade9d
7
- data.tar.gz: 5da49c13c964c3b11f5af90b2576175cfdd9e85362a4339d29a3b6cf825615ece8610c141b8fc77c9f351cb302cfe5546753e816bba549adb9d6a2cfe48c5f90
6
+ metadata.gz: d681988915ae056de2c763f86927cdd2c51cc2ca121f0b291e59c8a4fe2fa069a5b21cb9e7f5f3719605475da2425165497f2b702242ba9b71043c5dff99b8b5
7
+ data.tar.gz: 4bc6d9ac47bd585a3f966e5308d066a423c1eb57e80535f5d2df0eda335273324d5ebf13066d32dd7ea12c027bdaa347b9fc02aea7363229f8849f4efd6c9973
@@ -0,0 +1,38 @@
1
+ name: "Coveralls"
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ pull_request:
7
+
8
+ jobs:
9
+ coveralls:
10
+ strategy:
11
+ matrix:
12
+ ruby-version:
13
+ - "3.2"
14
+ rails-version:
15
+ - "7.0"
16
+ continue-on-error: [false]
17
+ name: ${{ format('Coverage (Ruby {0}, Rails {1})', matrix.ruby-version, matrix.rails-version) }}
18
+ runs-on: ubuntu-latest
19
+ continue-on-error: ${{ matrix.continue-on-error }}
20
+ env:
21
+ BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails-version }}.gemfile
22
+ RAILS_ENV: test
23
+ COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
24
+
25
+ steps:
26
+ - uses: actions/checkout@v2
27
+
28
+ - name: Install Ruby
29
+ uses: ruby/setup-ruby@v1
30
+ with:
31
+ 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
+
@@ -1,4 +1,4 @@
1
- name: "Test,Lint,Audit"
1
+ name: "Rails CI"
2
2
  on:
3
3
  push:
4
4
  branches:
@@ -17,12 +17,13 @@ jobs:
17
17
  - "6.1"
18
18
  - "7.0"
19
19
  continue-on-error: [false]
20
- name: ${{ format('Test,Lint,Audit (Ruby {0}, Rails {1})', matrix.ruby-version, matrix.rails-version) }}
20
+ name: ${{ format('Tests (Ruby {0}, Rails {1})', matrix.ruby-version, matrix.rails-version) }}
21
21
  runs-on: ubuntu-latest
22
22
  continue-on-error: ${{ matrix.continue-on-error }}
23
23
  env:
24
24
  BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.rails-version }}.gemfile
25
25
  RAILS_ENV: test
26
+ SKIP_COV: true
26
27
 
27
28
  steps:
28
29
  - uses: actions/checkout@v2
@@ -33,7 +34,7 @@ jobs:
33
34
  ruby-version: ${{ matrix.ruby-version }}
34
35
  bundler-cache: true
35
36
 
36
- - name: Set up DB
37
+ - name: Set up Test DB
37
38
  run: bin/rails db:migrate RAILS_ENV=test
38
39
  - name: Run tests
39
40
  run: bin/rake test
@@ -43,5 +44,6 @@ jobs:
43
44
 
44
45
  - name: Security audit application code
45
46
  run: bin/bundle exec brakeman -q -w3
47
+
46
48
  - name: Security audit dependencies
47
49
  run: bin/bundle exec bundler-audit --update --gemfile-lock gemfiles/${{ matrix.rails-version }}.gemfile.lock
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## v1.0.7.2 - 9/27/2023
4
+
5
+ - Pulled will_paginate option out in favor of Kaminari
6
+ - Switched CI from Buildkite to [Github actions](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml)
7
+ - Improved test coverage to 99+
8
+ - Removed backward compatibility to Rails prior to 6.x
9
+
3
10
  ## v1.0.7.1 - 9/22/2023
4
11
 
5
12
  - Addressed deprecations for file type 'image/jpg'
data/Gemfile CHANGED
@@ -28,6 +28,7 @@ group :test do
28
28
  gem 'coveralls_reborn', '~> 0.28.0', require: false
29
29
  gem 'diffy', '~> 3.4.2'
30
30
  gem 'equivalent-xml', '~> 0.6.0'
31
+ gem 'minitest', '~> 5.20.0'
31
32
  gem 'minitest-reporters', '~> 1.6.1'
32
33
  gem 'mocha', '~> 2.1.0', require: false
33
34
  gem 'rails-controller-testing', '~> 1.0.5'
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # ocCaM'S
2
2
 
3
- [![Build status](https://badge.buildkite.com/6b70f3f81c5922bd134b33d3ba1412c68f53a9f67e0a907ade.svg?branch=main)](https://buildkite.com/gknt/occams)
4
- [![Test,Lint,Audit](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml/badge.svg)](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml)
3
+ [![Rails CI](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml/badge.svg?branch=main)](https://github.com/avonderluft/occams/actions/workflows/rubyonrails.yml)
5
4
  [![Coverage Status](https://coveralls.io/repos/github/avonderluft/occams/badge.svg?branch=main)](https://coveralls.io/github/avonderluft/occams?branch=main)
6
5
  [![Gem Version](https://img.shields.io/gem/v/occams.svg?style=flat)](http://rubygems.org/gems/occams)
7
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)
8
8
 
9
9
  ***Prefer Simplicity.***
10
10
 
@@ -29,8 +29,6 @@ ocCaM'S is a revival of [ComfortableMexicanSofa](https://github.com/comfy/comfor
29
29
 
30
30
  ocCaM'S, pronounced "AH-kums" is a nod to [Occam's Razor](https://en.wikipedia.org/wiki/Occam%27s_razor) - for this Rails-based Content Management System endeavors to follow the principle that unnecessarily complex models should not be preferred over simpler ones.
31
31
 
32
-
33
-
34
32
  ## Features
35
33
 
36
34
  * Simple drop-in integration with Rails 6.1+ apps with minimal configuration
@@ -46,12 +44,11 @@ ocCaM'S, pronounced "AH-kums" is a nod to [Occam's Razor](https://en.wikipedia.o
46
44
 
47
45
  * File attachments are handled by [ActiveStorage](https://github.com/rails/rails/tree/master/activestorage). Make sure that you can run appropriate migrations by running: `rails active_storage:install` and then `rake db:migrate`
48
46
  * Image resizing is done with [ImageMagick](http://www.imagemagick.org/script/download.php), so make sure it's installed
49
- * Pagination is handled by [kaminari](https://github.com/amatsuda/kaminari) or [will_paginate](https://github.com/mislav/will_paginate). Please add one of those to your Gemfile.
50
47
 
51
48
  ## Compatibility
52
49
 
53
- - Test suite passing on Ruby 2.7.8, 3.1.4 and 3.2.2 with Rails 6.1 and 7.0+
54
- - 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, 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
55
52
 
56
53
  ## Installation
57
54
 
@@ -1,14 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Occams::Paginate
4
- # Wrapper to deal with WillPaginate vs Kaminari nonsense
5
4
  def occams_paginate(scope, per_page: 50)
6
- if defined?(WillPaginate)
7
- scope.paginate(page: params[:page], per_page: per_page)
8
- elsif defined?(Kaminari)
9
- scope.page(params[:page]).per(per_page)
10
- else
11
- scope
12
- end
5
+ return unless defined?(Kaminari)
6
+
7
+ scope.page(params[:page]).per(per_page)
13
8
  end
14
9
  end
@@ -74,10 +74,10 @@ protected
74
74
  # Getting page and setting content_cache and fragments data if we need to
75
75
  # serve translation data
76
76
  def find_cms_page_by_full_path(full_path)
77
- @cms_page = if Rails.env == 'production'
78
- @cms_site.pages.published.find_by!(full_path: full_path)
79
- else
77
+ @cms_page = if Rails.env == 'development'
80
78
  @cms_site.pages.find_by!(full_path: full_path)
79
+ else
80
+ @cms_site.pages.published.find_by!(full_path: full_path)
81
81
  end
82
82
 
83
83
  @cms_page.translate!
@@ -62,15 +62,12 @@ module Occams
62
62
  Occams::Cms::Site.find_site(host, path)
63
63
  end
64
64
 
65
- # Wrapper to deal with Kaminari vs WillPaginate
66
65
  def occams_paginate(collection)
67
66
  return unless collection
68
67
 
69
- if defined?(WillPaginate)
70
- will_paginate collection
71
- elsif defined?(Kaminari)
72
- paginate collection, theme: 'occams'
73
- end
68
+ return unless defined?(Kaminari)
69
+
70
+ paginate collection, theme: 'occams'
74
71
  end
75
72
  end
76
73
  end
@@ -22,13 +22,8 @@ class Occams::Cms::File < ActiveRecord::Base
22
22
  # -- Callbacks ---------------------------------------------------------------
23
23
  before_validation :assign_label, on: :create
24
24
  before_create :assign_position
25
- # active_storage attachment behavior changed in rails 6 - see PR#892 for details
26
- if Rails::VERSION::MAJOR >= 6
27
- before_save :process_attachment
28
- else
29
- after_save :process_attachment
30
- end
31
-
25
+ # active_storage attachment behavior changed in rails 6
26
+ before_save :process_attachment
32
27
  after_save :clear_page_content_cache
33
28
 
34
29
  # -- Validations -------------------------------------------------------------
@@ -10,12 +10,8 @@ class Occams::Cms::Fragment < ActiveRecord::Base
10
10
  attr_reader :files
11
11
 
12
12
  # -- Callbacks ---------------------------------------------------------------
13
- # active_storage attachment behavior changed in rails 6 - see PR#892 for details
14
- if Rails::VERSION::MAJOR >= 6
15
- before_save :remove_attachments, :add_attachments
16
- else
17
- after_save :remove_attachments, :add_attachments
18
- end
13
+ # active_storage attachment behavior changed in rails 6
14
+ before_save :remove_attachments, :add_attachments
19
15
 
20
16
  # -- Relationships -----------------------------------------------------------
21
17
  belongs_to :record, polymorphic: true, touch: true
@@ -29,7 +29,7 @@ class Occams::Content::Tag::Children < Occams::Content::Tag
29
29
  @list = ''
30
30
  # ActiveRecord_Associations_CollectionProxy
31
31
  @page_children = context.children.order(:position).to_ary
32
- if Rails.env == 'production'
32
+ unless Rails.env == 'development'
33
33
  @page_children.delete_if { |child| !child.is_published }
34
34
  end
35
35
  @page_children.delete_if { |child| @exclude.include? child.slug }
@@ -23,14 +23,10 @@ module Occams::Seeds::File
23
23
  # writing content
24
24
  begin
25
25
  ::File.binwrite(::File.join(path, ::File.basename(file_path)), file.attachment.download)
26
+ Occams.logger.info("[CMS SEEDS] Exported File \t #{file.attachment.filename}")
26
27
  rescue Errno::ENOENT, OpenURI::HTTPError
27
- message = "[CMS SEEDS] No physical File \t #{file.attachment.filename}"
28
- Occams.logger.warn(message)
29
- next
28
+ Occams.logger.warn("[CMS SEEDS] No physical File \t #{file.attachment.filename}")
30
29
  end
31
-
32
- message = "[CMS SEEDS] Exported File \t #{file.attachment.filename}"
33
- Occams.logger.info(message)
34
30
  end
35
31
  end
36
32
  end
@@ -41,11 +41,9 @@ module Occams::Seeds::File
41
41
 
42
42
  if fresh_file
43
43
  if file.save
44
- message = "[CMS SEEDS] Imported File \t #{file_path}"
45
- Occams.logger.info(message)
44
+ Occams.logger.info("[CMS SEEDS] Imported File \t #{file_path}")
46
45
  else
47
- message = "[CMS SEEDS] Failed to import File \n#{file.errors.inspect}"
48
- Occams.logger.warn(message)
46
+ Occams.logger.warn("[CMS SEEDS] Failed to import File \n#{file.errors.inspect}")
49
47
  end
50
48
  end
51
49
 
@@ -41,11 +41,9 @@ module Occams::Seeds::Layout
41
41
  )
42
42
 
43
43
  if layout.save
44
- message = "[CMS SEEDS] Imported Layout \t #{layout.identifier}"
45
- Occams.logger.info(message)
44
+ Occams.logger.info("[CMS SEEDS] Imported Layout \t #{layout.identifier}")
46
45
  else
47
- message = "[CMS SEEDS] Failed to import Layout \n#{layout.errors.inspect}"
48
- Occams.logger.warn(message)
46
+ Occams.logger.warn("[CMS SEEDS] Failed to import Layout \n#{layout.errors.inspect}")
49
47
  end
50
48
  end
51
49
 
@@ -79,8 +79,7 @@ module Occams::Seeds::Page
79
79
  page.fragments.where(identifier: old_frag_identifiers - new_frag_identifiers).destroy_all
80
80
 
81
81
  else
82
- message = "[CMS SEEDS] Failed to import Page \n#{page.errors.inspect}"
83
- Occams.logger.warn(message)
82
+ Occams.logger.warn("[CMS SEEDS] Failed to import Page \n#{page.errors.inspect}")
84
83
  end
85
84
  end
86
85
 
@@ -29,11 +29,9 @@ module Occams::Seeds::Snippet
29
29
  )
30
30
 
31
31
  if snippet.save
32
- message = "[CMS SEEDS] Imported Snippet \t #{snippet.identifier}"
33
- Occams.logger.info(message)
32
+ Occams.logger.info("[CMS SEEDS] Imported Snippet \t #{snippet.identifier}")
34
33
  else
35
- message = "[CMS SEEDS] Failed to import Snippet \n#{snippet.errors.inspect}"
36
- Occams.logger.warn(message)
34
+ Occams.logger.warn("[CMS SEEDS] Failed to import Snippet \n#{snippet.errors.inspect}")
37
35
  end
38
36
  end
39
37
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Occams
4
- VERSION = '1.0.7.1'
4
+ VERSION = '1.0.7.2'
5
5
  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.7.1
4
+ version: 1.0.7.2
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-09-22 00:00:00.000000000 Z
11
+ date: 2023-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_link_to
@@ -269,6 +269,7 @@ files:
269
269
  - ".gitattributes"
270
270
  - ".github/issue_template.md"
271
271
  - ".github/pull_request_template.md"
272
+ - ".github/workflows/coveralls.yml"
272
273
  - ".github/workflows/rubyonrails.yml"
273
274
  - ".gitignore"
274
275
  - ".rubocop.yml"