It is expected that you have the following software already on your system.
- Docker (for running Redis)
rbenvruby 3.1.0(installed viarbenv)node 16.14.0yarn(pretty much any version)sqliteherokuCLI
git clone [email protected]:calebschoepp/canvasync.git
cd canvasyncbin/bundle install
yarn installCreate 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:migratedocker run --name docker-redis -d -p 6379:6379 redisRun 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/devNow 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:systemTo open up a live REPL session in the context of the server run:
rails consoleTo 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 serverBefore you can start interacting with production you'll need to setup your git remotes.
heroku git:remote -r prod -a canvasyncTo push code up to production run:
git push prod mainIf 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:migrateIf 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