{"id":15308530,"url":"https://github.com/rexshijaku/git-pull-dirigent","last_synced_at":"2025-02-26T13:31:18.605Z","repository":{"id":106639358,"uuid":"252861832","full_name":"rexshijaku/git-pull-dirigent","owner":"rexshijaku","description":"Updates a Git repository and manages dependencies in a single shot","archived":false,"fork":false,"pushed_at":"2020-05-06T20:01:06.000Z","size":27,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-07T00:51:20.933Z","etag":null,"topics":["automated-deployment","composer","dirigent","laravel-mix","npm","pull-requests","ubuntu","yarn"],"latest_commit_sha":null,"homepage":"https://rexshijaku.github.io/git-pull-dirigent/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rexshijaku.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-03T23:05:17.000Z","updated_at":"2023-05-03T14:22:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"73e8f3aa-80e4-41e0-81db-601a04b08fdf","html_url":"https://github.com/rexshijaku/git-pull-dirigent","commit_stats":null,"previous_names":["rexshijaku/git-pull-dirigent","rexshijaku/gitpulldirigent"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexshijaku%2Fgit-pull-dirigent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexshijaku%2Fgit-pull-dirigent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexshijaku%2Fgit-pull-dirigent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rexshijaku%2Fgit-pull-dirigent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rexshijaku","download_url":"https://codeload.github.com/rexshijaku/git-pull-dirigent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240261594,"owners_count":19773484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automated-deployment","composer","dirigent","laravel-mix","npm","pull-requests","ubuntu","yarn"],"created_at":"2024-10-01T08:16:42.912Z","updated_at":"2025-02-26T13:31:18.243Z","avatar_url":"https://github.com/rexshijaku.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Git Pull Dirigent\n\nGit Pull Dirigent is a bash script which aims to automate the whole process of updating a Git repository in an advanced manner and one shot.\n\n#### Main Features\n\n  - Updates a Git repository\n  - Installs or Updates php dependencies **if composer.json is affected** after pull\n  - Installs or Updates node dependencies **if package.json was updated** after pull\n  - Compiles Assets using Laravel Mix, **if any compileable file is affected** after pull\n  - Offers **control over the processes** which can be executed\n  \nYou can:\n  - Specify what should be run and when should be run\n \n### Usage\n\n#### Requirments \nDepending on what you want to do with this script, it has different requirements.\n##### php dependencies\n - To supervise php dependency management [Composer](https://getcomposer.org/download/) is required.\n - Your repository should contain composer.json file.\n\n##### node dependencies\n - To manage node dependency management [NPM](https://getcomposer.org/download/) or [YARN](https://classic.yarnpkg.com/en/docs) is required.\n - Your repository should contain package.json file.\n \n##### compiling assets\n - To conduct the complie process of your files requires [laravel-mix](https://laravel.com/docs/7.x/mix) must be included in node dependencies and to be configured properly.\n - Your repository should contain webpack.mix.js file. \n- To run mix you have to install [NPM](https://getcomposer.org/download/) or [YARN](https://classic.yarnpkg.com/en/docs).\n\n ### Choosing what to run\n Git Pull Dirigent's work is based on the digit combination **gpd_cmd** which can be found at the begining of the script. Every index in this command is reserved for a specific functionality. By default Git Pull Dirigent will run a digit combination like **11110** which will update your repository and subsequently it will check whether the **composer.json** was updated, if it does it will run **'composer install'** command, if not will do nothing. Similarly, it will run **'npm install'** command if **package.json** was updated. Finally, using **'npm run production'**  it will run all mix tasks by minifying output for production **if and only if** any of files which are set to be compiled **was changed**. What's good here is that we can have a control over this process and we can modify it by changing only a few variables. \n Let's assume that instead of **npm** we want to use **yarn** to update our node dependencies, the only thing we should do is to **change the digit** in the second position (the index which is reserved for the type of PM) in the combination from **1** to **2**. In the same way, if we want to run **'composer update'** we can change only the first digit from **1** to **2**. Below is provided a table which helps to create combinations. If you don't want to run any of aforementioned tasks simply change its digit to **0**.\n\n  ### Controlling when to execute\nGit Pull Dirigent by default will run tasks asssigned to it only if their respective files get affected during update. For example, if package.json is changed, then gpd will update node dependencies, if not, gpd will not it will skip this process. We can have a control **when to run** jobs we specified to be done. This can be done by changing the last digit of combination. If this digit is set to **1** it will run always the commands which are specified, if it is **0** it will run them only if their files are changed.\n \n### Creating combinations\n\nGit Pull Dirigent can do diffent things by assigning different combinations to **gpd_cmd**. Instructions on how to use these commands are provided in the table below.\n\n| ------ | -- COMPOSER  --| ----- JS PM ---- |  - JS PM CMD - | -  FILE COMPILE - |  ---- -- WHEN-- ------- |\n\n| ------ | - install | update |  install | update  |  install | update  | - prod | dev | watch | always |- on update - |\n\n| ------ |  --- 1 --- | --- 2 --- | ---- 1 --- | --- 2 ---  | --- 1 --- | --- 2 ----  |  -- 1 -- | - 2 - | -- 3 --  | --- 1 --- | --- -- 0 ------ |  \n\n| ------ |  ---- ----  1  ---- ---- | ----- ---  1 ---- ---- | --- --- 1 --------   | ---   -- --- -- 1 -- --- ---- | --- --- - 0 --- --- ------- |\n\n| ------ |  composer install  | --- ------  -----  npm install  --- --- ---    |  ---- run prod -------  |  -- on updates only - |\n\n| ------ |  composer.json | --- --- --- --- package.json -- --- ---- ---   |  --  files to compile --- | ----------------------  |\n\nIn this table was described how **gpd_cmd=11110**, and what selected commands will do.\n\n##### gpd_cmd examples:\n\n- gpd_cmd=00000 -\u003e will pull the changes and run nothing\n- gpd_cmd=10000 -\u003e will update php dependencies only if composer.json was changed\n- gpd_cmd=10001 -\u003e will update php dependencies always\n- gpd_cmd=01101 -\u003e will install node dependencies always\n- gpd_cmd=01001 -\u003e will do nothing, since script exits because in position 2 and 3 there is no job specified for npm \n- gpd_cmd=30000 -\u003e will do nothing, script exists because there is a wrong command for composer\n\n### Setting up the executable command\n\n#### Linux(Ubuntu)\nYou can either set it to run as a global command or simply put in a project repository. To use it **as a global command** follow ensuing steps:\nOpen cmd and go to bin: \n```sh\n$ cd /bin\n```\ncreate an file using your text editor, in my case nano:\n\n```sh\n$ nano gitpulldirigent  \n```\nadd the content of this script and save it. After this make the file **executable**:\n```sh\n$ chmod +x gitpulldirigent  \n```\nyour file is ready to run globaly. To **test** it, go to the root directory of your project\n```sh\n$ gitpulldirigent\n```\n\n#### Windows\nClone this script and  make sure it is placed in the projects root directory, makes sure you give the **read \u0026 execute permission** to it.\nRight click in the main directory of your project and select **'Run Bash Here'** from the menu and run:\n```sh\n$ sh gitpulldirigent.sh\n```\n### Known issues\n - If files which are defined to be compiled by webpack mix contain modules (files) which are being included (imported) inside those files, changes in these imported module (files) will not trigger the necessary command.\n\n### Todos\n\n - Testing more\n - Send gpd_cmd as parameter \n - Extending functionality\n - Fix known issues\n\nLicense\n----\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frexshijaku%2Fgit-pull-dirigent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frexshijaku%2Fgit-pull-dirigent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frexshijaku%2Fgit-pull-dirigent/lists"}