Add markdownlint to project and builds

This commit is contained in:
Eric Schultz 2020-10-15 14:15:34 -05:00 committed by Eric Schultz
parent 7f37a826fe
commit a077eec7fa
6 changed files with 150 additions and 69 deletions

View file

@ -135,7 +135,7 @@ jobs:
bundle-use-node-js-${{ matrix.os }}-${{ matrix.node }}-
- name: run jest
run: yarn jest
eslint:
lint:
runs-on: ${{ matrix.os }}
strategy:
matrix:
@ -156,6 +156,9 @@ jobs:
- name: run yarn eslint
run: |
yarn eslint
- name: run yarn markdownlint
run: |
yarn markdownlint
main_build:
needs: ['install_yarn', 'install_gems']
runs-on: ${{ matrix.os }}

6
.markdownlint.jsonc Normal file
View file

@ -0,0 +1,6 @@
{
"default": true,
"no-hard-tabs": false,
"MD013": {"line_length": 80},
"MD007": {"indent": 1}
}

View file

@ -1,69 +1,99 @@
#### Docker install (if you don't have docker and docker-compose installed)
##### install Docker and Docker compose
# Using docker (outdated)
## Docker install (if you don't have docker and docker-compose installed)
### install Docker and Docker compose
You need to install Docker and Docker Compose.
* *Note:* Docker and Docker Compose binaries from Docker itself are proprietary software based entirely upon
free software. If you feel more comfortable, you may build them from source.
* *Note 2:* For Debian, the Docker package is simply too out of date to be usable.
* *Note:* Docker and Docker Compose binaries from Docker itself are proprietary
software based entirely upon free software. If you feel more comfortable,
you may build them from source.
* *Note 2:* For Debian, the Docker package is simply too out of date to be usable.
Even the version for latest Ubuntu LTS is too old. For reliability, we strongly
recommend using the Docker debian feed from docker itself OR making sure you keep your
own build up to date.
recommend using the Docker debian feed from docker itself OR making sure you
keep your own build up to date.
### Add yourself to the docker group
##### Add yourself to the docker group
Adding yourself as a Docker group user as follows:
`sudo usermod -aG docker $USER`
You will likely need to logout and log back in again.
#### Build your docker-container and start it up for initial set up.
## Build your docker-container and start it up for initial set up
We'll keep this running in the console we'll call **console 1**
```
```ruby
./dc build
./dc up
```
#### System configuration
There are a number of steps for configuring your Houdini instance for startup
##### Start a new console we'll call **console 2**.
##### In console 2, copy the env template to your .env file
```
## System configuration
There are a number of steps for configuring your Houdini instance for startup
### Start a new console we'll call **console 2**
### In console 2, copy the env template to your .env file
```shell
cp .env.template .env
```
##### In console 2, run the following and copy the output to you .env file to set you `DEVISE_SECRET_KEY` environment variable.
`./run rake secret # copy this result into your DEVISE_SECRET_KEY`
##### In console 2, , run the following and copy the output to you .env file to set you `SECRET_TOKEN` environment variable.
```
./run rake secret # copy this result into your SECRET_TOKEN
### In console 2, run the following fill your `DEVISE_SECRET_KEY`
`./run rake secret ## copy this result into your DEVISE_SECRET_KEY`
Now copy the output to you .env file to set you `DEVISE_SECRET_KEY` environment variable
### In console 2, run the following to fill your `SECRET_TOKEN`
```ruby
./run rake secret ## copy this result into your SECRET_TOKEN
```
##### 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
Now copy the output to you .env file to set you `SECRET_TOKEN` environment variable
### 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
### You SHOULD set your AMAZON s3 information (optional but STRONGLY recommended)
##### You SHOULD set your AMAZON s3 information (optional but STRONGLY recommended)
If you don't, file uploads WILL NOT WORK but it's not required.
##### In console 2, install yarn
### In console 2, install yarn
`./run yarn`
##### In console 2, fill the db
`./run rake db:create db:structure:load db:seed test:prepare`
### In console 2, fill the db
##### Set up mailer info
You can set this in `config/default_organization.yml` or better yet, make a copy with your own org name and add that to your .env file as `ORG_NAME`
If you need help setting up your mailer, visit `config/environment.rb` where the settings schema is verified and documented.
`./run rake db:create db:structure:load db:seed test:prepare`
#### Startup
##### Switch back to console 1 and run `Ctrl-c` to end the session.
### Set up mailer info
You can set this in `config/default_organization.yml` or better yet, make
a copy with your own org name and add that to your .env file as `ORG_NAME`
If you need help setting up your mailer, visit `config/environment.rb` where
the settings schema is verified and documented.
## Startup
### Switch back to console 1 and run `Ctrl-c` to end the session
### In console 1, restart the containers
##### In console 1, restart the containers
`./dc up`
##### In console 2, run:
### In console 2, run
`./run yarn watch`
##### You can go to http://localhost:5000
### You can go to <http://localhost:5000>
To get started, register your nonprofit using the "Get Started" link.
To get started, register your nonprofit using the "Get Started" link.

View file

@ -4,7 +4,8 @@
---
You'll need to have in your Mac the following dependencies installed, if you don't want to use the provided Docker containers.
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`
@ -20,22 +21,29 @@ Instructions for running Development environment using macOS Catalina
_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).
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:_
Run `cp .env.template .env` to copy the provided template file for env variables to create your own.
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`.
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.
- `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/).
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`
@ -43,21 +51,27 @@ The last secrets you'll need are related to AWS. You can learn how to [create an
_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.
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`
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`
```
```ruby
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)
@ -85,7 +99,11 @@ 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.
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`.

View file

@ -1,41 +1,63 @@
# Known issues
## Byebug or Pry won't start - image not found readline.bundle
----------
---
Error reported.
```bash
pry
# Sorry, you can't use byebug without Readline. To solve this, you need to
# rebuild Ruby with Readline support. If using Ubuntu, try `sudo apt-get
# install libreadline-dev` and then reinstall your Ruby.
```
### What's the problem?
Ruby installation with gems, specifically the `readline` gem already installed on a system that had a macOS upgrade.
### How to solve it?
If **you use `rvm` to manage your ruby versions**. You can use `rvm` to recompile ruby from source to solve the problem.
### What's the problem
Ruby installation with gems, specifically the `readline` gem already installed
on a system that had a macOS upgrade.
### How to solve it
If **you use `rvm` to manage your ruby versions**. You can use `rvm` to
recompile ruby from source to solve the problem.
_Note:_ You'll need to rebuild `ruby` as a best practice after `macOS` upgrades.
#### Steps to rebuild ruby via **RVM**
Make sure you've installed the latest Xcode + tools before proceeding; check App Store for updates. Be sure to accept the Xcode License before proceeding!
Make sure you've installed the latest Xcode + tools before proceeding; check
App Store for updates. Be sure to accept the Xcode License before proceeding!
Update Xcode and accept the license:
* Update Xcode to latest via App Store, be sure to update the Xcode Tools as well.
* In a terminal window, exec this command: `sudo xcodebuild -license accept`
- Update Xcode to latest via App Store, be sure to update the Xcode Tools as well.
- In a terminal window, exec this command: `sudo xcodebuild -license accept`
Make sure you have the **readline** lib installed:
* `brew --prefix readline`
* if you get Error: No available formula with the name "readline", install readline:
* `brew install readline`
* `brew link --force readline` You'll need to use `--force` to make it work.
* `vi ~/.rvm/user/db` and add the following: `ruby_configure_flags=--with-readline-dir=/usr/local/opt/readline`
- `brew --prefix readline`
- if you get Error: No available formula with the name "readline", install readline:
- `brew install readline`
- `brew link --force readline` You'll need to use `--force` to make it work.
- `vi ~/.rvm/user/db` and add the following: `ruby_configure_flags=--with-readline-dir=/usr/local/opt/readline`
Reinstall Ruby, with a rebuild of sources:
* `rvm reinstall <your_ruby_version>` This command removes the specified version's ruby binaries and libs, and rebuilds from source code on your system, with the latest macOS headers and libs.
* `rvm reinstall <your_ruby_version> --gems` This command repro's the same steps as above, but it removes the gems first as well. The next time you run bundle install the gems will be downloaded and rebuilt against your latest ruby. This can help resolve other potential issues with gems after rebuilding ruby on macOS.
* Change the specified version (2.5.1 in my case) to match your needs.
* **I ended up using the second syntax for a completely fresh start.**
- `rvm reinstall <your_ruby_version>` This command removes the
specified version's ruby binaries and libs, and rebuilds
from source code on your system, with the latest macOS headers and libs.
- `rvm reinstall <your_ruby_version> --gems` This command repro's the same
steps as above, but it removes the gems first as well. The next time
you run bundle install the gems will be downloaded and rebuilt against
your latest ruby. This can help resolve other potential issues with
gems after rebuilding ruby on macOS.
- Change the specified version (2.5.1 in my case) to match your needs.
- **I ended up using the second syntax for a completely fresh start.**
_Gotchas:_ If you're in the project directory running a terminal window when finished this process, You'll had to `cd ..` up a level and then `cd project-folder` back into the project so that RVM would reactivate your gemset.
Run `gem install bundler` and then `bundle install` to re-hydrate the gems for the project.
_Gotchas:_ If you're in the project directory running a terminal window when
finished this process, You'll had to `cd ..` up a level and then `cd project-folder`
back into the project so that RVM would reactivate your gemset.
Run `gem install bundler` and then `bundle install` to re-hydrate the gems
for the project.

View file

@ -8,13 +8,15 @@
"scripts": {
"build-all": "yarn install --frozen-lockfile && script/compile-assets.sh && yarn build",
"ci-build-all": "script/compile-assets.sh && yarn build",
"test": "rake -v spec && yarn build && yarn jest",
"test": "bin/rails spec && yarn jest",
"jest": "jest",
"eslint": "eslint . --ext .ts,.js,.es6,.tsx",
"storybook": "start-storybook -p 6006 -c .storybook/react",
"build-storybook": "build-storybook -c .storybook/react",
"html-storybook": "bin/start-html-storybook -p 6007 -c .storybook/html",
"build-html-storybook": "bin/build-html-storybook -c .storybook/html"
"build-html-storybook": "bin/build-html-storybook -c .storybook/html",
"markdownlint": "npx markdownlint-cli **/*.md --ignore node_modules",
"prepare-for-push": "yarn test && yarn markdownlint --fix && bin/rails notice:update"
},
"devDependencies": {
"@babel/core": "^7.0.0",