Zero Waste Lviv is a Public Organization that works on the implementation of waste reduction principles in Lviv and Ukraine. Organization draws attention of the city and businesses by conducting trainings, meetings, workshops and research to support ‘zero waste’ grounds. Organization conducts a campaign to draw attention to the problem of using disposable hygiene products for women and children and possible ways or reduction. Website - https://zerowastelviv.org.ua
In order to attract attention to financial and ecological consequences of disposable diaper usage it is planned to create a module that will calculate budget spent on diapers and calculations of the future expenses. As visual representation it is planned to show the volume of waste that was made during usage of disposable diapers for one child.
The latest version from the 'develop' branch is automatically deployed to stage environment in Render, staging link. The latest version from the release branch 'master' is automatically deployed to Production environment, production link.
$ git clone https://github.com/ita-social-projects/ZeroWaste.git
First of all you need RVM to setup project. For the operating system Windows the optimal solution is to use WSL.
$ bin/setup
or
$ bundle install
Install the following packages:
sudo apt install imagemagick
sudo apt install libvips42
PostgreSQL
Install PostgreSQL for your operating system or subsystem. You can familiarize yourself with PostgreSQL documentation.
To check if it is installed and running correctly run sudo systemctl status postgresql
In your local machine in cloned project in config folder rename database.yml.sample to database.yml. Make sure that the user and password match the data in this file. Port may be changed.
For further work, make sure that you have a user 'postgres' with superuser. If is no that one do next:
$ sudo -u user psql user
$ CREATE USER postgres SUPERUSER;
$ CREATE DATABASE postgres WITH OWNER postgres;
If you're having trouble authenticating, you may need to reset your password. You can read instruction how to do it.
pg gem
Under certain circumstances bundle can do not install pg.
To install manually:
$ sudo apt-get install libpq-dev
then
$ gem install pg
Database configure
For correct operation of the migration, you need to rename the migration file 20220123171144_create_versions.rb
so that it is processed first.
To create the necessary databases and update them:
$ rake db:create
then
$ rake db:migrate
$ rake db:reset
can resolve some errors connected with database.
Redis
You need Redis for correct work. Install Redis for your operating system or subsystem. You can familiarize yourself with Redis documentation.
Installation for Ubuntu:
$ curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
$ sudo apt-get update
$ sudo apt-get install redis
To check if it is installed and running correctly run sudo systemctl status redis
npm and Node.js
Also you need Node.js. Install npm and Node.js for your operating system or subsystem. You can familiarize yourself with npm and Node.js documentation
yarn
You can read more about yarn there: yarn documentation.
Installation:
$ npm install --global yarn
Webpacker
To prevent an error when starting the server install webpacker. You can read more about webpacker there: Webpacker documentation.
Installation:
$ yarn add @rails/webpacker
$ bundle update webpacker
Sidekiq
Simple, efficient background processing for Ruby. You can read more about sidekiq there: Sidekiq documentation.
Installation:
$ bundle add sidekiq
rails assets:precompile
to precompile assetsbin/rails tailwindcss:watch
with rails server
to watch for changes in tailwind and start server or run bin/dev
Solutions when an errors occurs: psql: FATAL: role "postgres" does not exist
If you have Webpacker::Manifest::MissingEntryError you can try next steps:
$ rm -rf node_modules
$ rails webpacker:install
$ yarn install
Running rubocop with no arguments will check all Ruby source files in the current folder:
$ rubocop
Alternatively you can pass rubocop a list of files and folders to check:
$ rubocop app spec lib/something.rb
For more details check the available command-line options:
$ rubocop -h
Before using git-hook-pre-commit
you need to install sudo apt-get install cmake
For using git-hook-pre-commit
type cp git-hooks/pre-commit .git/hooks/pre-commit
command to install your hook.
Run git commit -m "name"
to commit changes locally.
If you have some troubles with style conventions after running git commit -m "name"
, you need to run rubocop -a
or rubocop -A
. Each of these commands can resolve the majority of warnings.
Type git commit -m "name" --no-verify
for commiting without formating.