Giter VIP home page Giter VIP logo

denny / shinycms-ruby Goto Github PK

View Code? Open in Web Editor NEW
33.0 7.0 11.0 13.85 MB

ShinyCMS is an open-source CMS built in Ruby on Rails, with support for themes, plugins, and cloud hosting. (There is also a Perl version: www.github.com/denny/ShinyCMS)

Home Page: https://shinycms.org

License: GNU General Public License v2.0

Ruby 79.88% JavaScript 1.75% CSS 1.78% HTML 12.59% SCSS 4.00% Procfile 0.01%
ruby-on-rails cms open-source heroku rails6 cloud-hosting postgres themes plugins aws

shinycms-ruby's Introduction

ShinyCMS

ShinyCMS is an open-source content management system built in Ruby on Rails, with support for themes, plugins, and cloud hosting.

ShinyCMS is primarily intended for use by professional web developers, as a platform to build content-managed websites on top of. It provides a number of features 'out of the box', which all integrate into its easy-to-use admin area. Access to admin features is managed by a highly granular ACL system.

Web developers can also add custom functionality by writing their own plugins. A number of helpers and concerns are provided to help you build new features quickly, and with a consistent look-and-feel to the rest of the system.

The current version of ShinyCMS runs on Ruby 3.0 and Rails 6.1

Features

  • Plugin architecture ๐ˆ
    • Load the core plugin, plus only the feature plugins that you want to use
      • Reduces in-memory size and attackable surface area
    • Add custom functionality easily by writing your own plugins
    • Items on this list marked with ๐ˆ are provided by the core plugin
    • Items on this list marked with ยฑ are provided by one of the feature plugins
  • Themes (on the hosted site) ๐ˆ
    • Light-lift theme system - you can override just a few of the default partials if you want
    • Two themes included; Halcyonic, for content-rich sites, and Coming Soon for pre-launch sites
  • Pages ยฑ
    • Content-controlled 'brochure pages', with layout controlled by Page Templates
    • Can be organised into Page Sections (nested to any depth), with dynamically generated menus
  • Inserts ยฑ
    • Re-usable content fragments that can be pulled into any template on any page
  • News section ยฑ
  • Blog ยฑ
  • Comments ๐ˆ
    • Ready to add to any content; enabled by default on blog posts and optionally on news posts
    • Fully nested comment threads, so you can easily see who is replying to who at any level
    • Email notifications of replies to comments and posts
    • Uses reCAPTCHA to block bots, and Akismet to flag potential spam for moderation
      • Spam moderation feature sends training data back to Akismet, to improve its accuracy in future
  • Mailing lists ยฑ
    • Double opt-in, user subscription management, 'do not contact' feature
  • Newsletters ยฑ
    • HTML mailshots, generated from MJML templates for cross-platform compatibility
  • Basic form handlers ยฑ
    • e.g. 'email form data to site owner' - useful for contact and enquiry forms
    • Protected by reCAPTCHA and Akismet
  • Access control ยฑ
    • Create access groups, and add/remove members from them,
    • Use the current_user_can_access?( :group_name ) helper to show/hide content
  • Site search ยฑ
    • Ready to support multiple search backends (default is pg_search multisearch)
  • Tags ๐ˆ
  • Upvotes (AKA 'likes') on posts and comments
    • Supports downvotes too, if you want a full rating/ranking system
  • User profile pages ยฑ
    • With links to user-generated content such as recent comments, recent blog posts, etc
  • User accounts ๐ˆ
    • User administration in website admin area
    • Authentication powered by Devise
      • Uses reCAPTCHA to block registration by bots
    • ACL-based authorisation system for admin area, powered by Pundit
  • Site settings and feature flags ๐ˆ
    • Website admin area for both, plus a rake task for command-line access to feature flags
  • Sitemap generation and search-engine notification, powered by SitemapGenerator ยฑ
  • Emails can be generated from MJML or HTML templates ๐ˆ
    • Using MJML allows you to produce more reliably cross-platform HTML emails
    • Default MJML templates included for most features that send email
  • Built-in tracking of web stats and email stats
  • Build your own charts and dashboards for viewing and analyzing stats
    • Powered by Blazer
    • Default config includes a dozen useful charts and queries to get you started

Planned features

  • Payment handling plugins
    • Including recurring subscriptions to Access Groups - AKA paid membership
  • Online shop
  • Support for multiple blogs on a single site (in progress)
  • Algolia support for search plugin (in progress)
  • More themes!

Documentation

Installation and configuration

Please start by reading the installation guide (tl,dr).

Demo site

Theme templates and sample data for a demo site are provided, so you can try all of the CMS features without doing any data-entry work first. You can run the demo site locally or on a free Heroku plan.

System dependencies

You will need a webserver, a Postgres-compatible database server, and a Sidekiq-compatible caching service (e.g. Redis).

You will need a mail server if you intend to enable any of the features that send emails; user registrations, reply notifications, etc. Anything supported by ActionMailer should work.

All other supported external services are optional. If you add config details for them (in ENV / .env* files / Heroku config) then they will be used, otherwise the related CMS features will be unavailable or will have reduced functionality.

Ruby and Rails versions

ShinyCMS requires Rails 6.1 and Ruby 2.7 or later. The project generally uses the most recent stable release of both Ruby and Rails (currently Ruby 3.0.1 and Rails 6.1.3).

Contributing

Everyone is encouraged to help improve this project! Here are a few ways you can help:

  • Report issues
  • Improve the documentation
  • Fix bugs and submit pull requests
  • Suggest new features
  • Add new features :)

See contributing to ShinyCMS for more information.

Code of Conduct

This project has a Code of Conduct, which is intended to make using ShinyCMS, or contributing to it, a harassment-free experience for everybody involved - regardless of who they are and what they do or don't know.

Please read and follow the code of conduct - thank you.

Copyright and Licensing

ShinyCMS is copyright 2009-2024 Denny de la Haye - https://denny.me

ShinyCMS is free software; you can redistribute it and/or modify it under the terms of the GPL (version 2 or later). There are copies of both v2 and v3 of the GPL in docs/Licensing, or you can read them online: https://opensource.org/licenses/gpl-2.0 / https://opensource.org/licenses/gpl-3.0

ShinyCMS includes code from other open source and free software projects, which have their own licensing terms; please read the licensing docs for more details.

Current Status

CircleCI Codecov Dependabot Security

Code Climate maintainability Code Climate maintainability CodeFactor Grade CodeBeat (code quality)

GitHub code size GitHub repo size GitHub

shinycms-ruby's People

Contributors

denny avatar dependabot-preview[bot] avatar dependabot[bot] avatar eliotsykes avatar paultcochrane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

shinycms-ruby's Issues

Make 'site settings' admin page clearer

Currently the description of each setting is in the table row under the inputs for changing it, and the table striping makes it less than obvious that they are related.

Admin menu UX improvements: persist open/fold state of sections

Currently the admin sidebar menu opens all sections on each page load. It should remember which sections you have closed and which you have left open, and restore that state on each page load.

(I did have some JavaScript code in earlier versions which tried to do this, but it turned out to be so horrifically buggy that I eventually removed it. JavaScript is not my strong point.) ๐Ÿ˜„

Paging is broken on some admin pages

I think it's any page with more than one part path after /admin - e.g. /admin/news will page okay, but /admin/newsletters/editions won't.

It looks like the pager block (pulled in from a partial) is trying to render with the URL /admin/editions, dropping the middle part of the path.

Possibly an easy fix, but I couldn't see it at first glance.

(Paging is powered by kaminari, not will_paginate)

Toggle icon broken when editing users in admin area

The toggle icon to open/close the capabilities editing box is b0rked since I removed the CoreUI icons; it doesn't change when you toggle the panel now. Probably a five-second fix for somebody who knows JavaScript better than me :)

Emails are blank

Some (quite possibly all) of the emails generated by the system are coming through with completely blank bodies - not even the plain text section is there.

Possibly related, some of them seem to have odd titles too ("Send email", not sure where that's from - the i18n file? Why?)

Fix rubocop RSpec/DescribedClassModuleWrapping warnings

I've decided to move this into the rubocop todo file, as something that should be removed from the code at some point.

I think it's a pretty simple fix, but there are about 30 spec files that need changing so it migth takea while to work through.

Basic instructions:

  1. Remove the exception from the todo file.
  2. Run rubocop.
  3. For each file this cop warns about:
    a. Remove the module wrapper from the spec file
    b. Fix any class references in that file that need explicit namespacing after 3a

If anybody wants to pick it up, that'd be great (and I'm happy to help, just get in touch if you want a bit more explanation or even to pair on it), otherwise it can sit in the backlog until I want something simple to sort out :)

On starting the server I got a new error with the template.

Now the process end successfully, but on starting the server I got a new related error with the template.

i will take a look over it and I let you know...

  โ†ณ app/models/page_section.rb:104:in `default_section'
  Page Load (0.3ms)  SELECT "pages".* FROM "pages" WHERE "pages"."section_id" IS NULL AND "pages"."hidden" = $1 ORDER BY "pages"."sort_order" ASC  [["hidden", false]]
  โ†ณ app/models/page.rb:97:in `min'
  CACHE Setting Load (0.0ms)  SELECT "settings".* FROM "settings" WHERE "settings"."name" = $1 LIMIT $2  [["name", "theme_name"], ["LIMIT", 1]]
  โ†ณ app/models/setting.rb:49:in `get'
  CACHE SettingValue Load (0.0ms)  SELECT "setting_values".* FROM "setting_values" WHERE "setting_values"."setting_id" = $1 LIMIT $2  [["setting_id", 10], ["LIMIT", 11]]
  โ†ณ app/models/setting.rb:22:in `setting_value'
  CACHE SettingValue Load (0.0ms)  SELECT "setting_values".* FROM "setting_values" WHERE "setting_values"."setting_id" = $1 AND "setting_values"."user_id" IS NULL LIMIT $2  [["setting_id", 10], ["LIMIT", 1]]
  โ†ณ app/models/setting.rb:23:in `setting_value'
Completed 500 Internal Server Error in 313ms (ActiveRecord: 42.9ms | Allocations: 248057)

 
NoMethodError (undefined method `page_templates_path' for nil:NilClass):
  
app/models/page_template.rb:49:in `template_dir'
app/models/page_template.rb:54:in `available_templates'
app/models/page_template.rb:64:in `<class:PageTemplate>'
app/models/page_template.rb:4:in `<main>'
app/controllers/pages_controller.rb:78:in `show_page'
app/controllers/pages_controller.rb:19:in `index'

Originally posted by @maxvlc in #287 (comment)

rails shiny:demo:load doesn't work

Hi, I've got this error after to fill the email for the admin account:

rails aborted!
NoMethodError: undefined method `page_templates_path' for nil:NilClass
/home/lvargas/projects/ShinyCMS-ruby/app/models/page_template.rb:49:in `template_dir'
/home/lvargas/projects/ShinyCMS-ruby/app/models/page_template.rb:54:in `available_templates'
/home/lvargas/projects/ShinyCMS-ruby/app/models/page_template.rb:64:in `<class:PageTemplate>'
/home/lvargas/projects/ShinyCMS-ruby/app/models/page_template.rb:4:in `<main>'
/home/lvargas/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/home/lvargas/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/home/lvargas/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/lvargas/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/home/lvargas/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/home/lvargas/.gem/ruby/2.7.1/gems/zeitwerk-2.3.0/lib/zeitwerk/kernel.rb:16:in `require'
/home/lvargas/projects/ShinyCMS-ruby/lib/tasks/demo.rake:27:in `block (3 levels) in <main>'
/home/lvargas/.gem/ruby/2.7.1/gems/railties-6.0.3/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/lvargas/.gem/ruby/2.7.1/gems/railties-6.0.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/lvargas/.gem/ruby/2.7.1/gems/railties-6.0.3/lib/rails/command.rb:48:in `invoke'
/home/lvargas/.gem/ruby/2.7.1/gems/railties-6.0.3/lib/rails/commands.rb:18:in `<main>'
/home/lvargas/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/home/lvargas/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/home/lvargas/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/lvargas/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/home/lvargas/.gem/ruby/2.7.1/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/home/lvargas/.gem/ruby/2.7.1/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `block in require'
/home/lvargas/.gem/ruby/2.7.1/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:291:in `load_dependency'
/home/lvargas/.gem/ruby/2.7.1/gems/activesupport-6.0.3/lib/active_support/dependencies.rb:324:in `require'
bin/rails:9:in `<main>'
Tasks: TOP => shiny:demo:load
(See full trace by running task with --trace)

Rake task to export demo site data doubles all tag counts

To reproduce:

  1. Run rails shinycms:demo:load to reset the database and load the demo data, including some tag data
  2. Run rails shinycms:demo:export to export the database content to db/demo_site_data.rb
  3. Run git diff (also, compare the tag.taggings data in the database to the data in db/demo_site_data.rb)

Can't run test suite: FrozenError

I get this error on execute rspec:

An error occurred while loading ./spec/models/feature_flag_spec.rb.
Failure/Error: require File.expand_path( '../config/environment', __dir__ )

FrozenError:
  can't modify frozen #<Class:#<Array:0x000056523b277048>>: ["/home/......

[ Copy of issue posted on CodeCov forums ]

Description

Recently I moved a bunch of files in my project into a new directory. For some reason that new directory isn't showing up on CodeCov and instead all the files moved into it are classed by you as removed from the project.

When I run rspec locally, the HTML reports generated by SimpleCov do include the new directory and the files in it.

My path to CodeCov is push to GitHub, GitHub notifies CircleCI, CircleCI pull and run my tests and then push results to you (I think!) - and I have your GitHub integration enabled so you can comment on PRs etc. I'll add links to config files where they exist, but mostly I think it's default settings hooked up via web UIs.

I am perfectly willing to hear that I've done something weird here that's caused this, but at this point I don't know what else to check ๐Ÿ™‚

Commit SHAs

Here's the PR that merged moving those files into the new directory:
#1047

As you can see in the comments there, I noticed the glitch at the time and did a little investigation. It looked like merging the same feature branch into a fresh fork of main didn't have the same issue, so I was hoping that the PR report was a caching glitch of some sort, and went ahead with the main merge - sadly with the reported results.

(Sidenote: I've subsequently looked back at that test branch and it looks like it did have the same problem after all - unless your system would have updated its stats after the merge to main? - so I probably misread something there)

I've made quite a few changes to main since merging this PR, many relating to the moved files (and to unmoved files that you do still see and that depend on the moved files), and whatever is going on hasn't sorted itself out - the project is still 10% smaller according to you, due to those 'missing' files.

Here's your page for that PR:
https://app.codecov.io/gh/denny/ShinyCMS-ruby/compare/1047/commits

Nothing of use there, I don't think - I wasn't pushing to GitHub in the early stages of this change, just working locally, so the interesting stuff all happened in 'contextual commits' from your point of view.

The base commit for the merge shows 5092 tracked lines, the first push of that branch to GitHub shows 4,528 lines, so I guess that's where this all happened, rather than when merging the PR - the latter is just when I noticed it.

Repository

https://github.com/denny/ShinyCMS-ruby

CI/CD or Build URL

https://app.circleci.com/pipelines/github/denny/ShinyCMS-ruby

Uploader

I'm sorry, I don't actually know how this bit works. I think it's handled between CircleCI and yourselves without my directly configuring much (beyond ticking boxes and adding ENV vars, maybe).

Codecov Output

Coverage report generated to /home/circleci/ShinyCMS/coverage/codecov-result.json.
{"app/controllers/application_controller.rb"=>[nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 1], "app/controllers/main_controller.rb"=>[nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, ...

  _____          _
 / ____|        | |
| |     ___   __| | ___  ___ _____   __
| |    / _ \ / _\`|/ _ \/ __/ _ \ \ / /
| |___| (_) | (_| |  __/ (_| (_) \ V /
 \_____\___/ \__,_|\___|\___\___/ \_/
                               Ruby-0.5.1
==> Circle CI detected
==> Gzipping contents
==> Uploading reports
    url:   https://codecov.io
    query: token=secret&flags&package=ruby-0.5.1&service=circleci&build=7088&job=0&slug=denny%2FShinyCMS-ruby&pr&branch=test%2Fcodecov%2Fmerge-packwerk-into-main&commit=4925497985068c0258faf34c768930d3ffc99002
->  Pinging Codecov
https://codecov.io/upload/v4?token=secret&flags&package=ruby-0.5.1&service=circleci&build=7088&job=0&slug=denny%2FShinyCMS-ruby&pr&branch=test%2Fcodecov%2Fmerge-packwerk-into-main&commit=4925497985068c0258faf34c768930d3ffc99002
->  Uploading to
https://storage.googleapis.com/codecov/v4/raw/2021-04-06/0CBB4EDF4ABAE8FC111FC8CFC8DAB09D/4925497985068c0258faf34c768930d3ffc99002/241fb0c7-cb72-4cf7-95a5-52d59cd442a2.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=GOO[snip]DWA%2F20210406%2FUS%2Fs3%2Faws4_request&X-Amz-Date=20210406T234811Z&X-Amz-Expires=10&X-Amz-SignedHeaders=host&X-Amz-Signature=[snip]
    View reports at https://codecov.io/github/denny/ShinyCMS-ruby/commit/4925497985068c0258faf34c768930d3ffc99002
JSON Coverage report generated for RSpec to /home/circleci/ShinyCMS/coverage.         4157 / 5185 LOC (80.17%) covered.
CircleCI received exit code 0

Expected Results

Please provide what you expect to have happened (e.g. a file that has missing coverage on a particular line).

I expected to see coverage data for the following new directories and the files that I moved into or created in them:

Actual Results

These directories do not appear in my CodeCov coverage data. (I think they're the only thing that's missing, but I haven't dug into that.)

Additional Information

.circleci/config.yml

I don't have a codecov.yml, and I don't think I've ticked anything spectacularly unusual on your site :slight_smile:

The PR I was merging was adding Packwerk, which does have some config relating to autoload paths and similar - but given that the tests work and that the simplecov reports show the files in question, I don't think that's relevant? Let me know if you disagree and I can post links to Packwerk config (or you can look at everything in the repo yourself obviously; it's a public, open source project).

Accessible error reporting on all forms (admin area and main site)

Currently forms only report success/failure, with no clear instructions in the case of failure on what exactly the problem is and how to fix it.

Fields with errors are identified by a red border in the admin area, but this is not an accessible solution; need to add aria-invalid, aria-error, etc.

Webpack 5 upgrade is broken (something to do with webpack-cli?)

Dependabot gave us this PR: #653

It works on my local machine, but fails CI on errors relating to webpack-cli - initially saying it wasn't installed, and currently saying it has invalid configuration. I think the latter refers to stuff coming from other Node modules rather than this project, but I'm not sure.

Failing CI test runs:
https://app.circleci.com/pipelines/github/denny/ShinyCMS-ruby?branch=dependabot%2Fnpm_and_yarn%2Fwebpack-5.1.0
https://travis-ci.com/github/denny/ShinyCMS-ruby/builds/199847665

Remove all timezones, use UTC throughout

This would be intended as a rather heavy-handed but temporary step 1 on the way to adding some timezone support that actually works. Right now I'm pretty sure this app will have different bugs in different countries at different times of the year, because Rails is doing magic in some places and not others.

(Eventual solution needs to support sites with users in multiple countries/timezones... but for now just making things consistent would be good.)

Admin search features aren't comprehensive

Some of the search methods in the admin controllers aren't checking all the fields that a user might want to use to search for that kind of content.

Also, in some cases it would make sense to search against fields from associated objects, which none of the searches currently support - and some of those relationships are polymorphic. For example you might well want to search on /admin/lists/1/subscriptions for a ShinyList::Subscription by putting in the name or email address of the subscriber, which will be either a User or an EmailRecipient.

Tests expose DST bug between midnight and 1am in BST

We're into daylight saving time in the UK now (BST, UTC+1), and every time I run my tests between midnight and 01:00 this one fails:

  1. ShinyLists::Admin::SubscriptionsController GET /admin/list/:id/subscriptions/search?q=2001-12-31 displays the list of matching subscriptions
    Failure/Error: expect( response.body ).to have_css 'td', text: 2.days.ago.to_s( :shinydate_with_day )
    expected to find visible css "td" with text "Wed, 31 Mar 2021" but there were no matches. Also found "Subscribed (00:27 on Thu, 01 Apr 2021)", which matched the selector but not all filters.
    ./plugins/ShinyLists/spec/requests/shiny_lists/admin/subscriptions_controller_spec.rb:57:in `block (3 levels) in <top (required)>'

Finished in 3 minutes 14.8 seconds (files took 8.07 seconds to load)
599 examples, 1 failure

Failed examples:
rspec ./plugins/ShinyLists/spec/requests/shiny_lists/admin/subscriptions_controller_spec.rb:49 # ShinyLists::Admin::SubscriptionsController GET /admin/list/:id/subscriptions/search?q=2001-12-31 displays the list of matching subscriptions

I haven't looked into it yet, but I'm assuming there's something very embarrassing in the date/time handling - maybe in that test, more likely in the code itself, quite possibly in both ๐Ÿ˜

For a more specific guess, I would say it's likely that the database is still in UTC (as it should be!) but ActiveRecord is using BST. I may well be guilty of causing the mismatch, with bad configuration or bad code or both.

There's a card on the project board about handling timezones; getting that done is probably the best/right way to fix this, but ripping out all timezones in favour of forcing UTC everywhere would be an acceptable first step.

Admin menu UX improvements: 'you are here' highlighting

When viewing a page in the admin area:

  • Move the relevant section to the top of the page (use anchors?)
    • Make this feature on/off configurable (it might be more annoying than helpful for some people, especially once menu open/fold state is persistent)
  • If there is not a specific menu item to highlight for that page, highlight the relevant section heading in the menu instead
    • Or, always highlight section heading, as well as highlighting menu item if it exists?

Find untranslated strings, add them to the locales files

There are some bare strings in templates here and there, which should be moved into the locales file in case the CMS is translated into another language at some point.

I think the main problem areas are column headings on admin index pages and input labels on admin add/edit pages, but need to check the rest of the admin area templates too, and all of the main site templates (both the default templates and those in the included themes) - in the core code and all of the plugins.

Fix fragile tests (should use 'has_css' matcher instead of 'include')

There are still several fragile tests that do something like expect( response.body ).not_to include a_test_string - this breaks occasionally when the test string is something that crops up in words used elsewhere in the page (e.g. 'tin' when using Faker::Science.elements). These tests should be made more specific using has_css to target the correct HTML element (and then hopefully I can remove the 'string_string'' kludge that's currently in a bunch of the factories).

Add more indexes to database

There are probably quite a few places where the database could benefit from having more indexes added.

As a rule of thumb, I think there should be an index on any column that is used in a scope or a utility method to filter the contents of the table down to a smaller result-set (e.g. posted_at for .recent), as well as any column that gets used for single-row lookups (e.g. slugs).

Relatedly; I think there are already indexes on all the foreign keys, but it wouldn't hurt to check and make sure - particularly for things like page->elements, group->memberships, etc.

Test suite is broken

Since 2925f44 tests don't pass anymore in a fresh setup:

ยฑ |master โ†’ origin U:1 โœ—| โ†’ rspec

Randomized with seed 26662
..............................................................................*.*.............................................................................FF.F.............................................................................................

Pending: (Failures listed here are expected and do not affect your suite's status)

  1) Discussions/Comments POST /discussion/1 classifies a new comment as spam after checking Akismet
     # Valid Akismet API KEY required
     # ./spec/requests/discussions_spec.rb:231

  2) Discussions/Comments POST /discussion/1 doesn't save a new comment if Akismet classifies it as 'blatant' spam
     # Valid Akismet API KEY required
     # ./spec/requests/discussions_spec.rb:260


Failures:

  1) Comment moderation PUT /admin/comments removes spam flags from the selected comments if you say they are not spam
     Failure/Error: client.open
     
     SocketError:
       Failed to open TCP connection to .rest.akismet.com:443 (getaddrinfo: Name or service not known)
     # /home/lvargas/.gem/ruby/2.6.6/gems/akismet-3.0.0/lib/akismet/client.rb:101:in `open'
     # ./app/helpers/akismet_helper.rb:23:in `akismet_client'
     # ./app/helpers/akismet_helper.rb:49:in `akismet_flag_as_ham'
     # ./app/controllers/admin/comments_controller.rb:98:in `process_ham_comments'
     # ./app/controllers/admin/comments_controller.rb:34:in `update'
     # /home/lvargas/.gem/ruby/2.6.6/gems/ahoy_matey-3.0.3/lib/ahoy/controller.rb:45:in `set_ahoy_request_store'
     # /home/lvargas/.gem/ruby/2.6.6/gems/warden-1.2.8/lib/warden/manager.rb:36:in `block in call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/warden-1.2.8/lib/warden/manager.rb:34:in `catch'
     # /home/lvargas/.gem/ruby/2.6.6/gems/warden-1.2.8/lib/warden/manager.rb:34:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/tempfile_reaper.rb:15:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/etag.rb:27:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/conditional_get.rb:40:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/head.rb:12:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:266:in `context'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:260:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/rack/logger.rb:38:in `call_app'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/rack/logger.rb:26:in `block in call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/rack/logger.rb:26:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/ahoy_matey-3.0.3/lib/ahoy/engine.rb:22:in `call_with_quiet_ahoy'
     # /home/lvargas/.gem/ruby/2.6.6/gems/request_store-1.5.0/lib/request_store/middleware.rb:19:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/method_override.rb:24:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/runtime.rb:22:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/sendfile.rb:110:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/engine.rb:526:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-test-1.1.0/lib/rack/mock_session.rb:29:in `request'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-test-1.1.0/lib/rack/test.rb:266:in `process_request'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-test-1.1.0/lib/rack/test.rb:119:in `request'
     # ./spec/requests/admin/comments_spec.rb:97:in `block (3 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # SocketError:
     #   getaddrinfo: Name or service not known
     #   /home/lvargas/.gem/ruby/2.6.6/gems/akismet-3.0.0/lib/akismet/client.rb:101:in `open'

  2) Comment moderation PUT /admin/comments deletes the selected comments if you say they are spam
     Failure/Error: client.open
     
     SocketError:
       Failed to open TCP connection to .rest.akismet.com:443 (getaddrinfo: Name or service not known)
     # /home/lvargas/.gem/ruby/2.6.6/gems/akismet-3.0.0/lib/akismet/client.rb:101:in `open'
     # ./app/helpers/akismet_helper.rb:23:in `akismet_client'
     # ./app/helpers/akismet_helper.rb:37:in `akismet_confirm_spam'
     # ./app/controllers/admin/comments_controller.rb:92:in `process_spam_comments'
     # ./app/controllers/admin/comments_controller.rb:32:in `update'
     # /home/lvargas/.gem/ruby/2.6.6/gems/ahoy_matey-3.0.3/lib/ahoy/controller.rb:45:in `set_ahoy_request_store'
     # /home/lvargas/.gem/ruby/2.6.6/gems/warden-1.2.8/lib/warden/manager.rb:36:in `block in call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/warden-1.2.8/lib/warden/manager.rb:34:in `catch'
     # /home/lvargas/.gem/ruby/2.6.6/gems/warden-1.2.8/lib/warden/manager.rb:34:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/tempfile_reaper.rb:15:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/etag.rb:27:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/conditional_get.rb:40:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/head.rb:12:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:266:in `context'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:260:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/rack/logger.rb:38:in `call_app'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/rack/logger.rb:26:in `block in call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/rack/logger.rb:26:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/ahoy_matey-3.0.3/lib/ahoy/engine.rb:22:in `call_with_quiet_ahoy'
     # /home/lvargas/.gem/ruby/2.6.6/gems/request_store-1.5.0/lib/request_store/middleware.rb:19:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/method_override.rb:24:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/runtime.rb:22:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/sendfile.rb:110:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/engine.rb:526:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-test-1.1.0/lib/rack/mock_session.rb:29:in `request'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-test-1.1.0/lib/rack/test.rb:266:in `process_request'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-test-1.1.0/lib/rack/test.rb:119:in `request'
     # ./spec/requests/admin/comments_spec.rb:69:in `block (3 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # SocketError:
     #   getaddrinfo: Name or service not known
     #   /home/lvargas/.gem/ruby/2.6.6/gems/akismet-3.0.0/lib/akismet/client.rb:101:in `open'

  3) Comment moderation PUT /admin/comments reports an error if it fails to remove spam flags
     Failure/Error: client.open
     
     SocketError:
       Failed to open TCP connection to .rest.akismet.com:443 (getaddrinfo: Name or service not known)
     # /home/lvargas/.gem/ruby/2.6.6/gems/akismet-3.0.0/lib/akismet/client.rb:101:in `open'
     # ./app/helpers/akismet_helper.rb:23:in `akismet_client'
     # ./app/helpers/akismet_helper.rb:49:in `akismet_flag_as_ham'
     # ./app/controllers/admin/comments_controller.rb:98:in `process_ham_comments'
     # ./app/controllers/admin/comments_controller.rb:34:in `update'
     # /home/lvargas/.gem/ruby/2.6.6/gems/ahoy_matey-3.0.3/lib/ahoy/controller.rb:45:in `set_ahoy_request_store'
     # /home/lvargas/.gem/ruby/2.6.6/gems/warden-1.2.8/lib/warden/manager.rb:36:in `block in call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/warden-1.2.8/lib/warden/manager.rb:34:in `catch'
     # /home/lvargas/.gem/ruby/2.6.6/gems/warden-1.2.8/lib/warden/manager.rb:34:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/tempfile_reaper.rb:15:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/etag.rb:27:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/conditional_get.rb:40:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/head.rb:12:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:266:in `context'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:260:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/rack/logger.rb:38:in `call_app'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/rack/logger.rb:26:in `block in call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/rack/logger.rb:26:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/ahoy_matey-3.0.3/lib/ahoy/engine.rb:22:in `call_with_quiet_ahoy'
     # /home/lvargas/.gem/ruby/2.6.6/gems/request_store-1.5.0/lib/request_store/middleware.rb:19:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/method_override.rb:24:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/runtime.rb:22:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-2.2.2/lib/rack/sendfile.rb:110:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/railties-6.0.2.2/lib/rails/engine.rb:526:in `call'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-test-1.1.0/lib/rack/mock_session.rb:29:in `request'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-test-1.1.0/lib/rack/test.rb:266:in `process_request'
     # /home/lvargas/.gem/ruby/2.6.6/gems/rack-test-1.1.0/lib/rack/test.rb:119:in `request'
     # ./spec/requests/admin/comments_spec.rb:124:in `block (3 levels) in <top (required)>'
     # ------------------
     # --- Caused by: ---
     # SocketError:
     #   getaddrinfo: Name or service not known
     #   /home/lvargas/.gem/ruby/2.6.6/gems/akismet-3.0.0/lib/akismet/client.rb:101:in `open'

Finished in 43.86 seconds (files took 3.49 seconds to load)
255 examples, 3 failures, 2 pending

Failed examples:

rspec ./spec/requests/admin/comments_spec.rb:88 # Comment moderation PUT /admin/comments removes spam flags from the selected comments if you say they are not spam
rspec ./spec/requests/admin/comments_spec.rb:60 # Comment moderation PUT /admin/comments deletes the selected comments if you say they are spam
rspec ./spec/requests/admin/comments_spec.rb:116 # Comment moderation PUT /admin/comments reports an error if it fails to remove spam flags

Mailers need separate tests

Currently most of the mailer code is only 'tested' indirectly, when the request specs touch a controller action that touches a model method that touches the mailer.

MJML binary attempting to make Internet connection every time it's run?

Tests of MJML mailers (Forms, Newsletters, etc) throw this warning when run offline:
"Mjml: warning You don't appear to have an internet connection. Try the --offline flag to use the cache for registry queries."

The Newsletter plugin tests tend to top the 'slowest tests' list, which could be related - network delays rather than slow or complicated code.

NoMethodError insert-demo-site-data

Description

I'd like to start contributing to this project, but as the Readme says, I get an rails aborted error when running this command at final part of the Database section.

โžœ  ShinyCMS-ruby git:(master) tools/insert-demo-site-data
This will wipe your database; are you sure? (y/n) y
.
.
.
rails aborted!
NoMethodError: undefined method `page_templates_path' for nil:NilClass
/home/max/web/ShinyCMS-ruby/app/models/page_template.rb:49:in `template_dir'
/home/max/web/ShinyCMS-ruby/app/models/page_template.rb:54:in `available_templates'
/home/max/web/ShinyCMS-ruby/app/models/page_template.rb:64:in `<class:PageTemplate>'
/home/max/web/ShinyCMS-ruby/app/models/page_template.rb:4:in `<main>'
/home/max/.rvm/gems/ruby-2.6.6/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/home/max/.rvm/gems/ruby-2.6.6/gems/bootsnap-1.4.6/lib/bootsnap/load_path_
.
.
.
/home/max/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:291:in `load_dependency'
/home/max/.rvm/gems/ruby-2.6.6/gems/activesupport-6.0.2.2/lib/active_support/dependencies.rb:325:in `require'
bin/rails:9:in `<main>'
Tasks: TOP => db:fixtures:load
(See full trace by running task with --trace)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.