diff --git a/Gemfile b/Gemfile index 2fa8ab07..fb40cd77 100755 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,6 @@ gem 'ffi', '~> 1.11', '>= 1.11.1' gem 'httparty', '~> 0.17.0' # https://github.com/jnunemaker/httparty gem 'rack-attack', '~> 5.2' # for blocking ip addressses gem 'rack-ssl', '~> 1.4' -gem 'rack-timeout', '~> 0.5.1' gem 'sprockets', '~> 3.7' # AWS services @@ -75,6 +74,10 @@ gem 'grape-swagger-entity', '~> 0.3.3' gem 'grape-swagger', '~> 0.33.0' gem 'grape', '~> 1.2', '>= 1.2.4' +group :production do + gem 'rack-timeout', '~> 0.5.1' +end + group :development, :ci do gem 'debase', '~> 0.2.3' gem 'ruby-debug-ide', '~> 0.7.0' @@ -87,6 +90,7 @@ group :development, :ci, :test do gem 'dotenv-rails', '~> 2.7', '>= 2.7.5' gem 'mail_view', '~> 2.0' gem 'pry', '~> 0.12.2' + gem 'pry-byebug', '~> 3.7.0' gem 'ruby-prof', '0.15.9' gem 'solargraph', '~> 0.35.1' gem 'standard', '~> 0.1.2' diff --git a/Gemfile.lock b/Gemfile.lock index eda20ee1..dfddc01a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -323,6 +323,9 @@ GEM pry (0.12.2) coderay (~> 1.1.0) method_source (~> 0.9.0) + pry-byebug (3.7.0) + byebug (~> 11.0) + pry (~> 0.10) public_suffix (3.1.1) puma (4.1.0) nio4r (~> 2.0) @@ -549,6 +552,7 @@ DEPENDENCIES param_validation! pg (~> 0.11) pry (~> 0.12.2) + pry-byebug (~> 3.7.0) puma (~> 4.0, >= 4.0.1) puma_worker_killer (~> 0.1.1) qx! diff --git a/docs/GETTING_STARTED.MD b/docs/GETTING_STARTED.MD index 33a26757..8af55f6b 100644 --- a/docs/GETTING_STARTED.MD +++ b/docs/GETTING_STARTED.MD @@ -6,9 +6,9 @@ You'll need to have in your Mac the following dependencies installed, if you don't want to use the provided Docker containers. -* Ruby `2.5.1` -* Rails `5.0.7.1` -* Node `11.12.0` +- Ruby `2.5.1` +- Rails `5.0.7.1` +- Node `11.12.0` ## Local Config @@ -17,45 +17,47 @@ You'll need to have in your Mac the following dependencies installed, if you don Instructions for running Development environment using macOS Catalina ### Initial steps -*Dependencies:* + +_Dependencies:_ Have a ruby version installed, you can learn more about how to use multiple versions of Ruby installed in your computer with [rbenv](https://github.com/rbenv/rbenv) or [rvm](https://rvm.io). An instance of PostgresSQL running. -*Setting up secrets:* +_Setting up secrets:_ Run `cp .env.template .env` to copy the provided template file for env variables to create your own. You'll need to provide a `DEVISE_SECRET_KEY` and `SECRET_TOKEN` which you can obtain by running `bundle exec rake secret`. -Set the following secrets in your `.env` file with your *Stripe account* information. +Set the following secrets in your `.env` file with your _Stripe account_ information. -* `STRIPE_API_KEY` with your Stripe *private* key. -* `STRIPE_API_PUBLIC` with your Stripe *public* key. +- `STRIPE_API_KEY` with your Stripe _private_ key. +- `STRIPE_API_PUBLIC` with your Stripe _public_ key. The last secrets you'll need are related to AWS. You can learn how to [create an S3 Bucket](https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html) within the AWS Documentation, and to obtain your access and secret key, you can [learn more here](https://aws.amazon.com/blogs/security/wheres-my-secret-access-key/). -* `S3_BUCKET_NAME` -* `AWS_ACCESS_KEY` -* `AWS_SECRET_ACCESS_KEY` +- `S3_BUCKET_NAME` +- `AWS_ACCESS_KEY` +- `AWS_SECRET_ACCESS_KEY` -*Setting up the local database:* +_Setting up the local database:_ Run `rake db:setup` to run all the db tasks within one command. This will create the dbs for each environment, load the `structure.sql`, run pending migrations and will also run the seed functionality. -------- +--- **Known problems** If you encounter `database doesnt exist in rake db create` after running both `rake db:setup` and `rake db:create`, you'll need to comment out the lines these lines at `pg_type_map.rb` + ``` Qx.config(type_map: PG::BasicTypeMapForResults.new(ActiveRecord::Base.connection.raw_connection)) Qx.execute("SET TIME ZONE utc") ``` - ### How to run -You'll need 2 consoles to run the project. One for the rails env and another one to run the asset pipeline through [webpack](https://webpack.js.org) , since it's *not incorporated yet* into the rails asset pipeline. + +You'll need 2 consoles to run the project. One for the rails env and another one to run the asset pipeline through [webpack](https://webpack.js.org) , since it's _not incorporated yet_ into the rails asset pipeline. ```bash # Console one (1) @@ -80,3 +82,22 @@ npx webpack --watch --- Run `bundle exec rspec` to run test suite. + +## Formatting + +We are using [Standard](https://github.com/testdouble/standard) that is a wrapper on top of Rubocop with a predefined set of Rules. If you use VS Code you will want to install [vscode-ruby](https://marketplace.visualstudio.com/items?itemName=rebornix.Ruby) extension and enable formatting on save. + +To enable formatting on save add these lines to your `settings.json`. + +```json +{ + "[ruby]": { + "editor.formatOnSave": true + }, + "ruby.lint": { + "rubocop": true + }, + "ruby.format": "rubocop", + "editor.formatOnSaveTimeout": 5000 +} +```