- Ruby 2.6.3
- Rails 6.0.0
- Postgresql 11.6
git clone https://github.com/calblueprint/unloop.git
cd unloop
bundle install
yarn install
You may need to install bundle and/or yarn if you do not already have them.
cp config/database.yml.example config/database.yml
rails db:setup
# This runs db:create, db:schema:load, and db:seed
You may need to run start postgres
if postgres is not running (you will get an error).
This is a simple mail server that sends and receives all emails.
Installation
gem install mailcatcher
Running mailcatcher
mailcatcher
Creating new assignments in the app will throw a 505 error if you are not running mailcatcher.
rails server
In order to speed up development and enable hot reloading, you should run this command in a separate terminal.
./bin/webpack-dev-server
In order to run the development server successfully, you need the config/master.key
file.
Once you have the file, you can check that this is the correct key by running EDITOR=vim rails credentials:edit
. You should be able to see the api keys in vim using this command.
Regenerating the master.key file
If your master.key has been compromised, you might want to regenerate it.
No key regeneration feature at the moment. We have to do this manually.
- Copy content of original credentials
rails credentials:show
somewhere temporarily. - Remove
config/master.key
andconfig/credentials.yml.enc
- Run
EDITOR=vim rails credentials:edit
in the terminal: This command will create a newmaster.key
andcredentials.yml.enc
if they do not exist. - Paste the original credentials you copied (step 1) in the new credentials file (and save + quit vim)
- Add and Commit the file
config/credentials.yml.enc
Important
- Make sure
config/master.key
is listed in.gitignore
and NOT tracked by git. - The command
EDITOR=vim rails credentials:edit
might not work if you require credential value in some file (initializers
ordatabase.yml
). I had the problem withdevise.rb
. I just uncommented the linesecret_key = ...
just the time to run the command to regenerate the credentials file, and then commented the line out again. - If you want to use Sublime to edit the credentials, you can replace the command
EDITOR=vim rails credentials:edit
byEDITOR="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl -w" rails credentials:edit
source: https://gist.github.com/db0sch/19c321cbc727917bc0e12849a7565af9
Functional components are components that are made of a function. You need to use hooks in order to use state or lifecycle methods. Most frequently used for components that are stateless but not always. Class components are components that use a class structure. This has been the standard format for React components.
yarn generate
You can also attach functional
or class
after generate to quickly specify which component to generate.
- Do you want to wrap your component in React.memo?
- This adds memoization to the component. A rule of thumb to think about whether or not your component needs
memo
is if it- Renders the same thing given the same props
- Renders often
- Re-renders with the same props
- Medium to big size
- Do you want headers? (Only for containers)
- This changes the title tag and the meta tag for this page.
- Do you want styles?
- This uses
withStyles
higher order component to add styles fromstyles.js
to override Material UI default styles. Useclasses
inclassName
to assign properties.
- Do you want to load resources asynchronously?
- This adds React lazy and Suspense before importing. In order to use this, you need to import the Loadable file rather than the index file. This only works with importing on an existing React component, and doesn't work in Rails.
If your component is not a root for a page or shared component, move your component to the folder that matches the page or shared component that it will live under.
Gems have many dependencies and also require certain ruby versions in order to be used. Be sure that the ruby version you are using is compatible with this repo's gemfile. If you run into any issues with gems while you run bundle install
, double check that your ruby version is the same as specified above.
Bundler could not find compatible versions for gem "faraday"
Make sure your ruby version is 2.6.3 as specificed above. Afterwards, run bundle update
.