# Underlay Underlay is used by [DVELP](https://dvelp.co.uk/) 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 * Enable [Circle CI](https://circleci.com/) Continuous Integration * Enable [GitHub auto deploys to Heroku staging and reviewapps](https://dashboard.heroku.com/apps/app-name-staging/deploy/github) * Enable [Sentry](https://sentry.io/) Error Tracking ## Packaged Gems To see the latest and greatest gems, look at Underlay' [Gemfile](templates/Gemfile.erb), which will be appended to the default generated projectname/Gemfile. It includes application gems like: * [Autoprefixer Rails](https://github.com/ai/autoprefixer-rails) for CSS vendor prefixes * [Flutie](https://github.com/thoughtbot/flutie) for `page_title` and `body_class` view helpers * [High Voltage](https://github.com/thoughtbot/high_voltage) for static pages * [jQuery Rails](https://github.com/rails/jquery-rails) for jQuery * [Normalize](https://necolas.github.io/normalize.css/) for resetting browser styles * [Postgres](https://github.com/ged/ruby-pg) for access to the Postgres database * [Sentry](https://github.com/getsentry/raven-ruby) for exception notification * [Sidekiq](https://github.com/mperham/sidekiq) for background processing * [Rack Canonical Host](https://github.com/tylerhunt/rack-canonical-host) to ensure all requests are served from the same domain * [Rack Timeout](https://github.com/heroku/rack-timeout) to abort requests that are taking too long * [Recipient Interceptor](https://github.com/croaky/recipient_interceptor) to avoid accidentally sending emails to real people from staging * [Simple Form](https://github.com/plataformatec/simple_form) for form markup and style * [Skylight](https://www.skylight.io/) for monitoring performance * [Title](https://github.com/calebthompson/title) for storing titles in translations * [Puma](https://github.com/puma/puma) to serve HTTP requests And development gems like: * [Figaro](https://github.com/laserlemon/figaro) for loading environment variables * [Pry Rails](https://github.com/rweng/pry-rails) for interactively exploring objects * [ByeBug](https://github.com/deivid-rodriguez/byebug) for interactively debugging behavior * [Bullet](https://github.com/flyerhzm/bullet) for help to kill N+1 queries and unused eager loading * [Bundler Audit](https://github.com/rubysec/bundler-audit) for scanning the Gemfile for insecure dependencies based on published CVEs * [Spring](https://github.com/rails/spring) for fast Rails actions via pre-loading * [Web Console](https://github.com/rails/web-console) for better debugging via in-browser IRB consoles. And testing gems like: * [Capybara](https://github.com/jnicklas/capybara) and * [Factory Bot](https://github.com/thoughtbot/factory_bot) for test data * [Formulaic](https://github.com/thoughtbot/formulaic) for integration testing HTML forms * [Poltergeist](https://github.com/teampoltergeist/poltergeist) for integration testing * [RSpec](https://github.com/rspec/rspec) for unit testing * [RSpec Mocks](https://github.com/rspec/rspec-mocks) for stubbing and spying * [Shoulda Matchers](https://github.com/thoughtbot/shoulda-matchers) for common RSpec matchers * [Timecop](https://github.com/travisjeffery/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 * A [low database connection pool limit][pool] * Safe binstubs * `t()` and `l()` in specs without prefixing with `I18n` * An automatically-created `SECRET_KEY_BASE` environment variable in all environments * Configuration for [CircleCI][circle] Continuous Integration (tests) * Configuration for [Sentry][sentry] error tracking * The analytics adapter [Google Tag Manager][gtm] [pool]: https://devcenter.heroku.com/articles/concurrency-and-database-connections [circle]: https://circleci.com/docs [gtm]: https://www.google.com/analytics/tag-manager/ [sentry]: https://sentry.io ## 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` and `production` Git remotes * Creates a [Heroku Pipeline] for review apps * Schedules automated backups for 10AM UTC for both `staging` and `production` [Heroku Pipeline]: https://devcenter.heroku.com/articles/pipelines 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](https://github.com/github/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](https://github.com/rails/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](https://github.com/thoughtbot/suspenders) by [Thoughtbot](https://thoughtbot.com/). ## 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 https://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](http://contributor-covenant.org/) code of conduct. ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

[![DVELP logo](https://raw.githubusercontent.com/DVELP/cookbook/master/assets/dvelp-logo.png 'DVELP logo')](http://dvelp.co.uk) 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](http://dvelp.co.uk)!