.ruby-version file.
Exact version is not present in the .ruby-version file. For example regardless of your local version 3.1.2 or 3.1.1 in .ruby-version it will be 3.1. To create an alias:
ln -s ~/.rbenv/versions/3.1.2 ~/.rbenv/versions/3.1rvm alias create ruby-3.1.0 3.1.2If you are running Puma server in clustered mode, web workers will crash due to an issue with "Ethon" library. To work around the issue, disable fork safety:
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
This variable must be exported before starting Puma server. A good place for that would be .pumaenv (Puma-dev), ~/.profile or equivalent.
make setup
Also, you will need a "development" version of the production DB. For that just run
make fetchdb
It will fetch the dump and restore it automatically as halalbooking DB.
We have multiple make commands that help prefill the local database with sample data retrieved from the production database.
Running these commands requires access to our servers through ssh. Currently we execute these commands on the oscar server.
make refreshdb - Creates a new dump file on the server running this script. It is saved as last.dump which is later fetched and used on the local machine as hb.dump.
make fetchdb - Executes fetch-dump and then restore-dump commands, see details below
make fetch-dump - Downloads last.dump from the server to a local machine and saves it as hb.dump (in repository's root folder)
make restore-dump - Restores data from local hb.dump (stored in the root folder of this repository) to the local database, applies local changes and deletes hb.dump
make refresh-and-fetchdb - Runs refreshdb and then fetchdb commands
lein fig to start building and hot reloading CLJS code.If you prefer to work with concatenated file (because of performance reasons), you can run
lein cljsbuild auto front-whitespace (or "extranet-whitespace", or both)
It will still watch for changes. If you just want to build file once, use:
lein cljsbuild once front-whitespace (or "extranet-whitespace", or both)
To clean the output directory run lein clean.
lein fig.Dev setup:
clj -M:dev.(start) in REPL.By default PGUSER and PGDATABASE is used to define the connection. Otherwise current shell user
will be used as a DB user (same behavior as with psql) and "halalbooking" as a DB name.
If you want to override database name default, you can either specify PGDATABASE globally via export
in your .bash_profile or provide it directly in shell PGDATABASE=hb clj -M:dev.
By default Rails stubs all Clojure-backed requests in development. Make sure you have HANDLE_CLOJURE_REQUESTS=proxy
set up in your env.
See https://github.com/borkdude/clj-kondo/blob/master/doc/editor-integration.md for live linting setup.
Run all tests: bin/rake spec:all
Front tests only: bin/rspec front/spec
CLJS based:
yarn (first time only).make cljs-test-auto (if you want to run tests once, use make cljs-test-once).Capybara based:
brew install chromedriver (first time only).
(or upgrade it: brew upgrade chromedriver)lein fig.You will need to manually start Clojure backend for some tests. Note different environment (test) and database (halalbooking_test). A custom server port is used (8091) so that you can run it alongside a development server on the default port (8090).
env HTTP_KIT__PORT=8091 PGDATABASE=halalbooking_test clojure -M:test -m hb.core
Run tests:
env HTTP_KIT__PORT=8091 HANDLE_CLOJURE_REQUESTS=proxy rspec front/spec/features/search_filters_spec.rb
bin/rake db:test:prepare.make clj-test-once (or make clj-test-auto if you want tests being re-run once you save a file).Prepare
Install Selenium - npm install -g selenium-standalone selenium-standalone install
Run
To run tests against staging edit .hermione.conf.js file.
selenium-standalone startyarn run screenshotsRun RAILS_ENV=profiling bin/rails s.
Note, this is effectively a production environment, so you have to restart application after each code change.
See .circleci/README.
yarn run svg-sprite_ right before .svg (e. g. circle_.svg)CSS_LIVE_RELOAD=true or run server with it CSS_LIVE_RELOAD=true rails syarn run watch-cssyarn run watch-cssSee .browserlistrc file.
Server:
rails sThe rails server command launches a web server named Puma which comes bundled with Rails.
puma-devAlternative to rails s.
Puma-dev: A fast, zero-config development server for OS X and Linux.
Use the following syntax to create a symbolic link in ~/.puma-dev directory :
$ cd ~/.puma-dev && ln -s /path/to/halalbooking hb
Set "hb.test" as APP_HOST in your "~/.bash_profile":
export APP_HOST=hb.test
Console:
rails cThe console command lets you interact with your Rails application from the command line. You must always restart the console after code changes.
By default all jobs are stored into "queue_classic_jobs" table (QC adapter), but not executed. You have to start a QC worker in parallel if you want background jobs, such as sending emails, to be executed:
make jobs
If you don't want the worker to process all previously queued jobs, clear all of them with
bin/rake qc:truncate
Enqueueing jobs is stubbed and thus it can be asserted.
We don't run recurring jobs on staging.
All jobs are stored into "queue_classic_jobs" table and picked up by multiple QC workers (see example).
We run recurring jobs via cron.
Content type
Image
Digest
sha256:5be51cec5…
Size
762.9 MB
Last updated
over 3 years ago
docker pull halalbooking/ruby