[![Maintainability](https://api.codeclimate.com/v1/badges/c07d77e147686e90e0b0/maintainability)](https://codeclimate.com/github/gizotti/tractor_beam/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/c07d77e147686e90e0b0/test_coverage)](https://codeclimate.com/github/gizotti/tractor_beam/test_coverage) # Tractor Beam ## Acknowledgments This gem has two major source or inspiration, and I am deeply grateful for the awesome work done by both of them. ### Evil Martians All the frontend setup Tractor Beam does is a representation of the good work put together by the folks at [Evil Martians](https://evilmartians.com), specifically described on their [Modern Front-end in Rails](https://evilmartians.com/chronicles/evil-front-part-1) series of blog posts. ### thoughtbot When looking at how to build a custom rails generator there's no better example than [thoughtbot/suspenders](https://github.com/thoughtbot/suspenders). I have used suspenders as the starting point for Tractor Beam, and ~stole~ borrowed some of its ideas on top of my main goal of building a Rails app with modern frontend tooling. ## Goals The main goal of this gem is to bootstrap a Rails application with all the modern component-based frontend goodness described by Evil Martians [Modern Front-end in Rails](https://evilmartians.com/chronicles/evil-front-part-1) series of blog posts. It also sets up a lot of the go to gems and tools for development in Rails, thus avoiding the initial configuration boilerplate that every new project brings. ## Installation ``` gem install tractor_beam ``` Then run: ``` tractor_beam project-name ``` ## Versions `ruby 2.5.0` `rails ~> 5.1.4` ## Gemfile Tractor Beam copies [Gemfile.erb](https://github.com/gizotti/tractor_beam/blob/master/templates/Gemfile.erb) to project-name/Gemfile. It includes application gems: * [Postgres](https://github.com/ged/ruby-pg) for access to the Postgres database. * [Puma](https://github.com/puma/puma) to serve HTTP requests. * [Webpacker](https://github.com/rails/webpacker) to Webpack to manage app-like JavaScript modules in Rails. Development gems: * [pry-rails](https://github.com/rweng/pry-rails) Rails >= 3 pry initializer. * [pry-byebug](https://github.com/deivid-rodriguez/pry-byebug) step-by-step debugging and stack navigation. capabilities to [pry] using [byebug]. * [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. ## Other Sweet Sweet Goodness ### Component Generator ```shell rails g component component-name ``` Will generate: ```shell frontend/components ├── component-name │ ├── _component-name.html.erb │ ├── component-name.css │ └── component-name.js ``` ### General Linting * [lint-staged](https://github.com/okonet/lint-staged) run linters on git staged files. * [pre-commit](https://github.com/pre-commit/pre-commit) manage multi-language pre-commit hooks. ### Javascript Linting * [babel-eslint](https://github.com/babel/babel-eslint) ESLint using Babel as the parser. * [eslint](https://github.com/eslint/eslint) identify and report on patterns found in ECMAScript/JavaScript code. * [eslint-config-airbnb-base](https://www.npmjs.com/package/eslint-config-airbnb-base) provides Airbnb's base JS .eslintrc. * [prettier](https://github.com/prettier/prettier) code formatter that enforces a consistent style by parsing your code and re-printing it with its own rules. * [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) turns off all rules that are unnecessary or might conflict with Prettier. * [eslint-import-resolver-webpack](https://www.npmjs.com/package/eslint-import-resolver-webpack) webpack-literate module resolution plugin for eslint-plugin-import. * [eslint-plugin-import](https://www.npmjs.com/package/eslint-plugin-import) support linting of ES2015+ (ES6+) import/export syntax. ### CSS Linting * [stylelint](https://github.com/stylelint/stylelint) a mighty, modern CSS linter. * [stylelint-config-standard](https://github.com/stylelint/stylelint-config-standard) the standard shareable config for stylelint. ## Todo List - [ ] Write Specs - [ ] Normalize css - [ ] Simple Form - [ ] Testing configuration - [ ] Coverage - [ ] shoulda-matchers - [ ] Factory Bot - [ ] CI configuration - [ ] Dotenv configuration - [ ] Bundler Audit - [ ] Rubocop (Maybe reinteractive-style) - [ ] option to make app Heroku ready ## Maybe TODO (Stolen ideas from [https://github.com/thoughtbot/suspenders](https://github.com/thoughtbot/suspenders)) - 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 - 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 Continuous Integration (tests) - Configuration for Hound Continuous Integration (style) - The analytics adapter Segment (and therefore config for Google Analytics, Intercom, Facebook Ads, Twitter Ads, etc.)