A few utilities for Kingdom Hall users.
After installing the ruby version displayed in this file.
Also install nodejs
and yarn
.
# first time
gem install bundler
mkdir ~/Projects
cd projects
git clone https://github.com/mjacobus/khtools.git
cd khtools
bundle install # after you installed ruby version
cp .env.sample .env
yarn install
# every time you update your project
cd ~/Projects/khtools
docker-compose up # start docker. Make sure your local postgress is not running
bundle install
./bin/rake db:create # create database
./bin/rake db:migrate # create tables
./bin/rake db:seed # create fake data for the database
./bin/rails server # to stop the server hit <ctrl>+C
RAILS_ENV=test ./bin/rake db:create # create test database
RAILS_ENV=test ./bin/rake db:migrate # create test tables
./bin/rspec
bundle exec rubocop -a
- If you are on Ubuntu 18.04 LTS
- The above step is not installing ruby itself. However you can try to use asdf for ruby.
- Same for nodejs and yarn. Try asdf for nodejs and after installing run
npm install -g yarn
.
Download a backup from the above link and then:
pg_restore -U pguser -W --no-owner --no-privileges -h localhost -d khtools_development -1 tmp/bkp/jw-khtools-backup-21-01-14
Other tricks
heroku run 'pg_dump $DATABASE_URL' > tmp/my_database.sql
./bin/rails db:drop
./bin/rails db:create
psql -U pguser -W -h localhost -d khtools_development \
-f tmp/my_database.sql
The master key is stored in 1password, and the development key is the same as prod.
RAILS_MASTER_KEY=the-key bin/rails credentials:edit
RAILS_MASTER_KEY=12345678901234567890123456789012 bin/rails credentials:edit --environment test