brunofacca / zen-rails-base-app
- среда, 30 августа 2017 г. в 03:14:18
Base application for Ruby on Rails 5 projects. Built to minimize the time spent writing boilerplate code and performing repetitive setup tasks.
Base or "skeleton" application for Ruby on Rails 5.1 projects. Built to minimize the time spent writing boilerplate code and performing repetitive setup tasks.
It comes with a preselected set of tools which I believe to be the most efficient and widely used. If you are looking for greater flexibility, an application template which uses Rails's templating system such as Rails Composer should be a better fit as it allows the user to choose which templating engine, test framework, JS framework and other tools to use.
Although this project is opinionated regarding tool choices, community feedback and contributions are always welcome and highly appreciated.
It consists of a Rails 5.1.3 app, including:
A selection of useful gems for development and debugging such as rubocop, brakeman, awesome_print, byebug, and better_errors.
Preconfigured test environment, including:
Preconfigured authentication with the Devise gem.
Preconfigured authorization with the Pundit gem.
Internationalization (i18n)
jQuery
HTML Layouts developed with Bootstrap 3 (bootstrap-sass gem) to use as a starting point, including:
Controller concerns such as SkipAuthorization.
User-friendly error messages (flash) on exceptions such as
ActiveRecord::DeleteRestrictionError and Pundit::NotAuthorizedErrorand.
User management interface for admins in /admin/users with pagination
(kaminari gem) and searching/filtering
(ransack
gem). Accessible only by
users with "admin" role.
Seed users for the development environment. Run rails db:seed to
create them:
user@test.com / password: Devpass1admin@test.com / password: Devpass1Contact form built with the mail_form gem.
E-mails "sent" in the development environment are saved as html files in
tmp/letter_opener (letter_opener
gem).
The following JavaScript libraries:
data-confirm confirmation by a
better-looking version.SCSS utility classes for alignment, spacing and font size standardization. See app/assets/stylesheets/utility-classes.scss.
High test coverage.
Consider using my Zen Rails Development Environment. It consists of a Ubuntu 16.04 (Xenial Xerus) Vagrant VM with all of the above dependencies preinstalled.
Setup tasks such as configuring time zones, default locale and action mailer (e.g., SMTP or transactional e-mail service) are not included in the following steps as they are not specific to this base app.
Fork this repository.
Clone the forked repository to your machine.
Rename the application:
config/application.rb
from ZenRailsBaseApp to your application name, in camel case.zen_rails_base_app by your_app_nameZEN_RAILS_BASE_APP by YOUR_APP_NAMEProject Name by the project's namereplace@me.com manually by the different e-mail addresses
that should send and receive e-mails in various parts of the
application.Run bundle install
Configure the databases:
If using PostgreSQL, uncomment the pg gem from the Gemfile. If
using MySQL, uncomment the mysql2 gem.
Uncomment the section of config/database.yml corresponding to your
chosen DBMS.
Customise the authentication setup. You may want to change one or more of the following items:
User model also has role, first_name, and last_name attributes.User model has an enum
attribute called role. Its possible values are :user and :admin. The
default value is :user.Customize the application colors by overwriting Bootstrap's variables in
app/assets/stylesheets/global.scss.
Remove unused items from the application, such as gems from the Gemfile,
RSpec helpers, custom matchers and shared examples from spec/support.
global.js and
zen-utils.js.Bug reports
Please use the issue tracker to report any bugs.
Developing
Released under the MIT License.