Underlay
¶ ↑
Underlay
is used by DVELP to fire up new rails applications.
Installation¶ ↑
First install the underlay gem:
gem install underlay
Then run:
underlay projectname
This will create a Rails API app in projectname
using the latest version of Rails.
Associated services¶ ↑
Packaged Gems¶ ↑
To see the latest and greatest gems, look at Underlay' Gemfile, which will be appended to the default generated projectname/Gemfile.
It includes application gems like:
-
Autoprefixer Rails for CSS vendor prefixes
-
Flutie for
page_title
andbody_class
view helpers -
High Voltage for static pages
-
jQuery Rails for jQuery
-
Normalize for resetting browser styles
-
Postgres for access to the Postgres database
-
Sentry for exception notification
-
Sidekiq for background processing
-
Rack Canonical Host to ensure all requests are served from the same domain
-
Rack Timeout to abort requests that are taking too long
-
Recipient Interceptor to avoid accidentally sending emails to real people from staging
-
Simple Form for form markup and style
-
Skylight for monitoring performance
-
Title for storing titles in translations
-
Puma to serve HTTP requests
And development gems like:
-
Figaro for loading environment variables
-
Pry Rails for interactively exploring objects
-
ByeBug for interactively debugging behavior
-
Bullet for help to kill N+1 queries and unused eager loading
-
Bundler Audit for scanning the Gemfile for insecure dependencies based on published CVEs
-
Spring for fast Rails actions via pre-loading
-
Web Console for better debugging via in-browser IRB consoles.
And testing gems like:
-
Capybara and
-
Factory Bot for test data
-
Formulaic for integration testing HTML forms
-
Poltergeist for integration testing
-
RSpec for unit testing
-
RSpec Mocks for stubbing and spying
-
Shoulda Matchers for common RSpec matchers
-
Timecop for testing time
More Awesomeness¶ ↑
Underlay
also comes with:
-
The
./bin/setup
convention for new developer setup -
The
./bin/deploy
convention for deploying to Heroku -
Rails' flashes set up and in application layout
-
A few nice time formats set up for localization
-
Rack::Deflater
to compress responses with Gzip -
Safe binstubs
-
t()
andl()
in specs without prefixing withI18n
-
An automatically-created
SECRET_KEY_BASE
environment variable in all environments -
Configuration for CircleCI Continuous Integration (tests)
-
Configuration for Sentry error tracking
-
The analytics adapter Google Tag Manager
Heroku¶ ↑
You can optionally create Heroku staging and production apps:
underlay app --heroku true
This:
-
Creates a staging and production Heroku app
-
Sets them as
staging
andproduction
Git remotes -
Creates a Heroku Pipeline for review apps
-
Schedules automated backups for 10AM UTC for both
staging
andproduction
You can optionally specify alternate Heroku flags:
underlay app \ --heroku true \ --heroku-flags "--region eu --addons sendgrid,ssl"
See all possible Heroku flags:
heroku help create
Git¶ ↑
This will initialize a new git repository for your Rails app. You can bypass this with the --skip-git
option:
underlay app --skip-git true
GitHub¶ ↑
You can optionally create a GitHub repository for Rails app. It requires that you have Hub on your system:
curl http://hub.github.com/standalone -sLo ~/bin/hub && chmod +x ~/bin/hub underlay app --github organization/project
This has the same effect as running:
hub create organization/project -p
Spring¶ ↑
Underlay
uses spring by default. It makes Rails applications load faster, but it might introduce confusing issues around stale code not being refreshed. If you think your application is running old code, run spring stop
. And if you'd rather not use spring, add DISABLE_SPRING=1
to your login file.
Application mode¶ ↑
You can set Application mode:
underlay app --application_mode true
This creates full Rails application including assets and action cable.
Dependencies¶ ↑
Underlay
requires the latest version of Ruby.
PostgreSQL needs to be installed and running for the db:create
rake task.
TODO¶ ↑
-
[] Set
config.cache_classes
to false for test environment, Otherwise it doesn't allow us to stub classes properly -
[X] Install TwilioBase gem (if the option is set)
-
[x] Remove duplicate application.html.erb layout
-
[X] Fix issue with flashes.scss partial not being added to assets
-
[ ] Configure s3 buckets and ENV vars
-
[X] Manually check all files are created and in place
-
[X] Configure Redis on heroku (with config vars + initializer)
-
[X] Update rake (in generated project) to run lints
-
[X] Prevent views and static sites from generating in API mode
-
[ ] Setup default front-end libraries and dependencies
-
[X] Setup .gitignore
-
[X] Fix lograge Installation
-
[X] Setup circle ci
-
[X] Configure rspec to require spec_helper
-
[X] Use factory_bot_rails instead of factory_bot
-
[X] Create github repo
-
[X] Fix rubocop and other linters offenses
-
[X] Publish gem
Kudos¶ ↑
This app was built on the foundations set out in Suspenders by Thoughtbot.
Development¶ ↑
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/rake
to run the automated test suite.
To install this gem onto your local machine, run bundle exec rake install
.
Contributing¶ ↑
Bug reports and pull requests are welcome on GitHub at github.com/DVELP/underlay. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License¶ ↑
The gem is available as open source under the terms of the MIT License.
Seoable was created and is maintained by DVELP Ltd.
If you like what you see and would like to hire us or join us, get in touch!