Best practice to automatically initialize project (git + composer + bower etc.)
I have private git repository with 2 git submodule
(Backend – Laravel API REST & Fronted – AngularJS).
Once the developer clones the project, he must run a setup process to initialize this project.
git submodule init git submodule update cd backend composer update mv .env.example .env php artisan migrate --seed cd ../frontend bower install etc ...
- What is the best practice to run these commands automatically?
- What is the best practice to simply tell to developer how to initialize project manually
(maybe some readme file inside git repository)?
2 Solutions collect form web for “Best practice to automatically initialize project (git + composer + bower etc.)”
Sounds like you need a script that will do this work for you.
Write the script, place it in your root folder of the project and tell user to run it. Using script will make your life easier if you modify the script and its content.
You simply update the script skipping the need to update your doc unless you have to.
If you use git (any OS) you can write bash/sh file bu simply copying the content in your question to the file and pushing it to git. Just make sure you set the execute permissions on the file so your users will be able to execute it.
#!/bin/sh git submodule init git submodule update cd backend composer update mv .env.example .env php artisan migrate --seed cd ../frontend bower install
You can create bash script
Create a file named “update.sh” and add the your sequence of commands like this
#!/bin/bash -e git status composer update bower install jquery
and now save the file and put it in your root directory.
You can execute sh file in your shell like this update.sh