It is expected that you have the following software already on your system.
- Docker (for running Redis)
rbenv
ruby 3.1.0
(installed viarbenv
)node 16.14.0
yarn
(pretty much any version)sqlite
heroku
CLI
git clone [email protected]:calebschoepp/canvasync.git
cd canvasync
bin/bundle install
yarn install
Create a file at config/application.yml
and insert the following contents:
development:
EMAIL_USERNAME: "<A Gmail username>"
EMAIL_PASSWORD: "<A Gmail app password>"
CONVERT_API_SECRET: "<Convert API secret>"
For sending email locally you can use a Gmail account. You'll need to generate an app password.
Convert API is used to convert uploaded PowerPoints, PNGs, and JPEGs to their PDF equivalent so that canvasync can provide its services to those file types. You can get a secret here. It is free to use for the first 1500 seconds of conversion time so it should be more than enough for our purposes.
See Running in devlopment for how to start your database.
rails db:create
rails db:migrate
docker run --name docker-redis -d -p 6379:6379 redis
Run docker ps
to confirm the container is running.
The following will run the rails server, a js compiler on watch mode, and a css compiler on watch mode. To see the commands to run them individually look at Procfile.dev
.
bin/dev
Now you can see the app at http://localhost:3000.
For pushes to master are not allowed. Tests must pass in Github before a PR can merge. Ideally somebody reviews your code.
If you need to fix the formatting of your code bin/bundle exec rubocop --auto-correct-all
will usually do the trick.
bin/rails test
bin/rails test:system
To open up a live REPL session in the context of the server run:
rails console
To set a breakpoint in your code that starts a REPL session insert the line debugger
somewhere. Note that to use debugger
you will need to start the server individually with:
bin/rails server
Before you can start interacting with production you'll need to setup your git remotes.
heroku git:remote -r prod -a canvasync
To push code up to production run:
git push prod main
If you pushed some code that depends on some migrations you will need to run the following after you push your code.
heroku run bin/rails db:migrate
If you need to debug something in production you can hop into a Rails console with the following. Note that --sandbox
prevents you from writing to production for saftey.
heroku run bin/rails console --sandbox