Skip to content

Instantly share code, notes, and snippets.

@anitagraham

anitagraham/Gemfile

Created Apr 27, 2021
Embed
What would you like to do?
Minimal config for setting up Refinerycms (April 2021)
default: &default
adapter: postgresql
host: localhost
username: <%= Rails.application.credentials[:database][:username] %>
password: <%= Rails.application.credentials[:database][:password] %>
database: <%= Rails.application.credentials[:database][:dbname] %>_<%= Rails.env %>
pool: 5
development:
<<: *default
test:
<<: *default
production: &production
database: <%= ENV['DATABASE_URL'] %>
<<: *default
# At least these refinery gems
gem 'refinerycms', git: 'https://github.com/refinery/refinerycms', branch: 'master'
gem 'refinerycms-authentication-devise', git: 'https://github.com/refinery/refinerycms-authentication-devise', ref: 'master'
gem 'refinerycms-wymeditor', git: 'https://github.com/parndt/refinerycms-wymeditor', branch: 'master'
I will try using these to build a new refinery app, and see what else I need to do.
@anitagraham

This comment has been minimized.

Copy link
Owner Author

@anitagraham anitagraham commented Apr 27, 2021

Building a new refinerycms site April 2021

TL;DR

  • I have left out any errors that occured (and will occur) in this section. They are mentioned further down outside the magic TL;DR. Assume one occurred at least everytime you need to stop and edit a file.

  • Just to make things more confusing I am (for reasons) building my refinerycms site in a directory called ... site. No need to do the same (unless reasons).

gem install refinerycms
rails new site -m https://www.refinerycms.com/t/edge 

Edit config/application.rb and add

config.autoloader = :classic

Edit Gemfile and add

gem 'routing-filter', git: 'https://github.com/svenfuchs/routing-filter', branch: 'master'
  • temporary until Refinery updates its gem requirements for this gem, which probably needs to wait until the new version of routing-filter is released.

Note: at this point the steps that the install script would take need to be done manually.

rails db:create
rails generate refinery:cms --fresh-installation
rails webpacker:install
rails s

and you should see a webserver start up (probably on port 3000, so you can take your browser to http://localhost:3000 and see the default Refinery front page.

To login to refinery and make changes, navigate to http://localhost:3000/refinery. Refinery will begin by creating an admin user for you, then taking you to the 'backend' page where you can edit the site's content.


If you really want to see the ups and downs to get to the answer above... Note: here I am using postgresql, not mentioned in tldr.

gem install refinerycms
rails new site -m https://www.refinerycms.com/t/edge -d postgresql

bundle install failed as it couldn't find suitable gems for rails (3.2) or even bundler.

Second try

refinerycms site -fresh-installation -d=postgresql 

same results

Third try

rails new site -m https://www.refinerycms.com/t/edge

Got a lot further, until it hit a Zeitwerk problem. Now to fix that, and also consider what else I might like to add.

NameError: wrong constant name Refinerycms-authentication-devise
/private/var/www/purify/site/config/environment.rb:5:in `<main>'

(p.s. purify because that is what a refinery does.)

The quick answer is to edit config/application.rb and add
config.autoloader = :classic

What to do next? How to pick up the Refinerycms install process mid-stream?

  1. refinerycms site --skip looked good until it added
    gem 'refinerycms', '~> 2.1.0' to a Gemfile which already had refinery added.

  2. refinerycms site --update also tries to update the Gemfile.

  3. Look at the template that began this run from https://www.refinerycms.com/t/edge.

Aha! (I needed to edit my database.yml and my rails credentials here, but that is because I
have some not-the-default values I use. You don't need to do this ... yet)

Picking up where the template left off, I ran

rails db:create
rails generate refinery:cms --fresh-installation

which got a little further before running into a genuine problem with Rails 6.1, which we can fix.

I added the following to the Gemfile. Note: this fix is only required until Refinery incorporates it into its own requirements.

gem 'routing-filter', git: 'https://github.com/svenfuchs/routing-filter', branch: 'master'

Trying out rails s revealed just one more step:

Webpacker was not installed. So after rails webpacker:install I was able to bring the application up and see the default, unstyled application front page. (see image)

@anitagraham

This comment has been minimized.

Copy link
Owner Author

@anitagraham anitagraham commented Apr 29, 2021

Refinery default home page

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment