Workarea is a large Rails engine that requires a few things out of a Rails app it's installed into. This guide will walk you through the details of running
bin/rails generate workarea:install so you know what changes are being made and why.
First, this will require the Workarea gems in your
config/application.rb file. This is done to ensure Workarea can control the environment your application is run in for the purposes of testing and rake tasks.
The install generator will mount the three main engines that workarea is built on within your
Rails.application.routes.draw do mount Workarea::Core::Engine => '/' mount Workarea::Admin::Engine => '/admin', as: 'admin' mount Workarea::Storefront::Engine => '/', as: 'storefront' end
An initializer will be created at
config/initializers/workarea.rb. This serves that the main location for modifying configuration for Workarea. The generator will add some default information based on the name of your application such as
email_to. These serve as critical pieces of information for Workarea to know in order to start the application. Be sure to address the
TODOs in the file and add the correct production information before deploying to a live environment.
Workarea relies on Sidekiq for running background jobs. For development, the install generator will add the following line of code to your
config/environments/development.rb to alleviate the need for sidekiq to be running while in development.
This tells sidekiq to run workers in process while working locally.
Workarea provides puma configuration out of the box, and the install generator will replace the default rails-generated
config/puma.rb with the following:
require 'workarea/configuration/puma' Workarea::Configuration::Puma.load(self)
This configuration class allows for customizing the puma configuration through environment variables, eliminating the need to add custom configuration files for each environment.
Workarea provides robust testing configuration for consistent and easy testing. The install generator will add
require workarea/test_help.rb to your existing
Workarea provides favicon support through content assets within the admin UI. As a result, the install generator removes the
public/favicon.ico file generated with a new rails application so that it does not interfere with that functionality.
Workarea provides a large set of seed data to get your application started. The install generator adds the
db/seeds.rb file so that you can run seeds like any other rails application.
How'd We Do?
If you found this article was missing information or wasn't quite what you were looking for, we are open to any suggestions or feedback on what we could do better.Help Us Out