Responsive web application that manages: Store, Category y Product.
- Ruby: 2.6.6
- RubyGems: 3.0.8
- Rails 5.2.0
- MariaDB: Ver 15.1 Distrib 10.1.44-MariaDB
Tool | Description |
---|---|
libmariadb-dev | If you have MariaDB database engine |
libmysqlclient-dev | If you have MySQL database engine |
sudo apt-get install libmariadb-dev
or,
sudo apt-get install libmysqlclient-dev
-
First, clone the repository
git clone https://github.com/fabiobazurto/leadmin.git
-
Set your database credencials
For development environment, you need to declare this environment variables:
# Use this command in linux terminal export APPUSER={YOUR DATABASE USER such as root or leadmin} export APPPASSWORD={YOUR DATABASE USER PASSWORD} export APPDB ={YOUR DATABASE NAME} export APPLOCALHOST={DATABASE HOST IP, use localhost if you are running the webapp in your laptop}
For production environment, you need to declare LEADMIN_DATABASE_PASSWORD and bind your local IP
export LEADMIN_DATABASE_PASSWORD={YOUR PRODUCTION DATABASE PASSWORD }
-
Install gems
bundle install
-
Create development and test databases
rake db:create
-
Populate your database
rake db:setup
You can choose between rake commands or mysqldump.
If you choose mysqldump, you can find the database dump into /db folder.
- leadmin_development.sql
- leadmin_test.sql
For mysqldump option, run this command
mysqldump -u {YOUR DB USER} -p leadmin_development < db/leadmin_development.sql
mysqldump -u {YOUR DB USER} -p leadmin_test < db/leadmin_test.sql
If you have problems with the connection using /tmp/mysql.sock, you need to bind your local mysql socket to /tmp/mysql.sock
- First, find your mysql.sock location
mysqladmin -u root -p variables | grep socket
-
Create a symbolic link to your local mysql.sock in /tmp/mysql.sock
ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
-
Finally, try again
rake db:create rake db:setup
In order to run test specs you need to run this commands:
#For models
bundle exec rspec spec/models
#For views
bundle exec rspec spec/views/stores/index.html.erb_spec.rb
bundle exec rspec spec/views/products/show.html.erb_spec.rb
#Feature/Integration
bundle exec rspec spec/feature/assign_product2store_spec.rb
bundle exec rspec spec/feature/create_store_spec.rb