Shell script for Git module deployment with include/exclude filters.

Related tags

Laravel modgit
Overview

Deploy multiple Git repositories in an unique folder

modgit is a shell script for deploying multiple Git repositories in root folder of any project, which is not possible with default git submodule command. A common use case would be the easy installation of Magento modules that need to be deployed in root folder.

Installation

curl installation

$ curl https://raw.githubusercontent.com/jreinke/modgit/master/modgit > modgit
$ chmod +x modgit
$ mv modgit /usr/local/bin

wget installation

$ wget -O modgit https://raw.githubusercontent.com/jreinke/modgit/master/modgit
$ chmod +x modgit
$ mv modgit /usr/local/bin

Manual download

  • Download shell script here
  • Copy modgit file to /usr/local/bin (or any folder in your $PATH)
  • Run chmod +x modgit

Usage

Install a module

$ cd /path/to/project
$ modgit init
$ modgit add [-n] [-t tag_name] [-b branch_name] <module> <git_repository>

Update a module

$ modgit up [-n] <module>

Update all modules

$ modgit up-all [-n]

Remove a module

$ modgit rm [-n] <module>

Remove all modules

$ modgit rm-all [-n]

List installed modules

$ modgit ls

Show information about an installed module

$ modgit info <module>

Show deployed files of an installed module

$ modgit files <module>

Show help

$ modgit help

Advanced usage

Dry run mode

$ modgit add -n scheduler https://github.com/fbrnc/Aoe_Scheduler.git
  => show what would be done

Include filter

$ modgit add -i lib/ elastica git://github.com/ruflin/Elastica.git
  => will deploy only lib/ folder

Include filter with custom target

$ modgit -i lib/:library/ add elastica git://github.com/ruflin/Elastica.git
  => will deploy only lib/ (remote folder) to library/ (local folder)

Exclude filter

$ modgit add -e tests/ atoum https://github.com/atoum/atoum.git
  => will deploy all remote files and folders, except tests/ folder

Automatic modman compatibility

$ modgit add debug https://github.com/madalinoprea/magneto-debug.git
  => will parse remote modman file for files and folders mapping
Comments
  • modman file globbing incompatibility

    modman file globbing incompatibility

    modgit currently doesn't handle the globbing supported in modman files.

    e.g. https://github.com/rjocoleman/Magento-Cloud-Backup/blob/master/modman Strange things happen around subfolders, see backup.php (a folder) and backup.php.php (the original file).

    Cloning into an empty folder using default syntax:

    $ mkdir test && cd test
    $ modgit init
    Initialized Module Git at /Users/robert/Code/test
    $ modgit clone cloud-backup git://github.com/rjocoleman/Magento-Cloud-Backup.git
    Cloning into '/Users/robert/Code/test/.modgit/cloud-backup/source'...
    remote: Counting objects: 101, done.
    remote: Compressing objects: 100% (52/52), done.
    remote: Total 101 (delta 36), reused 99 (delta 34)
    Receiving objects: 100% (101/101), 52.35 KiB, done.
    Resolving deltas: 100% (36/36), done.
    Clone of cloud-backup complete.
    
    $ tree
    .
    ├── app
    │   ├── code
    │   │   └── community
    │   │       └── Aschroder
    │   │           └── CloudBackup
    │   │               ├── Helper
    │   │               ├── README
    │   │               ├── ShakeDown.php
    │   │               ├── Test.php
    │   │               ├── controllers
    │   │               └── email
    │   │                   ├── failed_email.html
    │   │                   └── success_email.html
    │   └── etc
    │       └── modules
    ├── Block
    │   ├── Backup.php
    │   │   ├── Bucket
    │   │   │   └── Grid.php
    │   │   ├── Bucket.php
    │   │   └── Grid.php
    │   └── Backup.php.php
    ├── Model
    │   └── Collection.php
    ├── etc
    │   └── system.xml
    └── lib
        └── DevPay.php
            ├── Archive
            │   └── Tar.php
            └── docs
                └── Archive_Tar.txt
    
    16 directories, 16 files
    

    Expected output in tree format, as per modman:

    $ tree
    .
    └── app
        ├── code
        │   └── community
        │       └── Aschroder
        │           └── CloudBackup
        │               ├── Block
        │               │   ├── Backup
        │               │   │   ├── Bucket
        │               │   │   │   └── Grid.php
        │               │   │   ├── Bucket.php
        │               │   │   └── Grid.php
        │               │   └── Backup.php
        │               ├── Helper
        │               │   └── Data.php
        │               ├── Model
        │               │   ├── Backup.php
        │               │   ├── Collection.php
        │               │   └── Form
        │               │       └── Activation.php
        │               ├── README
        │               ├── ShakeDown.php
        │               ├── Test.php
        │               ├── controllers
        │               │   └── BackupController.php
        │               ├── email
        │               │   └── cloudbackup
        │               │       ├── failed_email.html
        │               │       └── success_email.html
        │               ├── etc
        │               │   ├── config.xml
        │               │   └── system.xml
        │               ├── lib
        │               │   ├── Archive_Tar-1.3.7
        │               │   │   ├── Archive
        │               │   │   │   └── Tar.php
        │               │   │   └── docs
        │               │   │       └── Archive_Tar.txt
        │               │   ├── DevPay.php
        │               │   └── S3.php
        │               └── modules
        │                   └── Aschroder_CloudBackup.xml
        └── etc
            └── modules
                └── Aschroder_CloudBackup.xml
    
    22 directories, 22 files
    
    opened by rjocoleman 3
  • is modgit gives update  changes from project-module during development to modgit-module-source?

    is modgit gives update changes from project-module during development to modgit-module-source?

    Why, when I modified ./.modgit/module/source/app/module/controller.php, and did modgit update-all It’s not updated in ./app/module/controller.php ?

    (and vice versa)

    opened by cryptomaniyac 2
  • modgit update

    modgit update

    try update a module and this error message

    modgit update module_category
    
    Already up-to-date.
    You need to run this command from the toplevel of the working tree.
    /usr/local/bin/modgit: line 280: [: -eq: unary operator expected
    Error updating module_category, operation cancelled.
    
    opened by oliver-montes 2
  • Feature/sync changelist

    Feature/sync changelist

    Hi jreinke, I use your script for deploying repos as part of a hand-rolled magento deployment system. The only downside is that when updating for a small fix that only affects a few files, all files are removed and then added back. When a repo has many thousands of files it can take a while and feels a bit heavy-handed for a minor patches.

    I thought that it might be possible to generate a 'changelist' of Add, Modify and Deletes and just work with those files instead - copying files marked with "M" or "A", after removing files marked with "D". This modification does that. Please forgive any awful bash mistakes - it is not something I know. I've tested this modification and it seems to work well. It certainly makes things quick! Please check it out.

    Thanks, Adrian.

    opened by adrian-green 1
  • modgit rm deleting changed files

    modgit rm deleting changed files

    modgit removes a changed file instead of reverting the changes on it. Is that an expected behavior?

    Example:

    Rafaels-MacBook-Pro:main kassner$ ls -la
    total 8
    drwxr-xr-x   4 kassner  wheel  136 Sep 27 12:39 .
    drwxr-xr-x   4 kassner  wheel  136 Sep 27 12:39 ..
    drwxr-xr-x  13 kassner  wheel  442 Sep 27 12:39 .git
    -rw-r--r--   1 kassner  wheel    4 Sep 27 12:39 test
    Rafaels-MacBook-Pro:main kassner$ modgit init
    Initialized modgit at /tmp/modgit/main/.modgit/
    Rafaels-MacBook-Pro:main kassner$ modgit add mod /tmp/modgit/mod/
    Cloning /tmp/modgit/mod/...
    Fetching submodules...
    Deploying:
    test
    Installation complete
    Rafaels-MacBook-Pro:main kassner$ git status
    # On branch master
    # Changes not staged for commit:
    #   (use "git add <file>..." to update what will be committed)
    #   (use "git checkout -- <file>..." to discard changes in working directory)
    #
    #   modified:   test
    #
    # Untracked files:
    #   (use "git add <file>..." to include in what will be committed)
    #
    #   .modgit/
    no changes added to commit (use "git add" and/or "git commit -a")
    Rafaels-MacBook-Pro:main kassner$ git diff test 
    diff --git a/test b/test
    index 8baef1b..24c5735 100644
    --- a/test
    +++ b/test
    @@ -1 +1 @@
    -abc
    +def
    Rafaels-MacBook-Pro:main kassner$ modgit rm mod
    Are you sure you want to remove 'mod' module? (y/n): y
    Removing 'mod' module...
    Removing files:
    test
    Rafaels-MacBook-Pro:main kassner$ ls -la
    total 0
    drwxr-xr-x   4 kassner  wheel  136 Sep 27 12:40 .
    drwxr-xr-x   4 kassner  wheel  136 Sep 27 12:39 ..
    drwxr-xr-x  13 kassner  wheel  442 Sep 27 12:40 .git
    drwxr-xr-x   2 kassner  wheel   68 Sep 27 12:40 .modgit
    Rafaels-MacBook-Pro:main kassner$ 
    
    opened by kassner 1
  • Files/Directories end in ?

    Files/Directories end in ?

    I installed modgit and then attempted to install a couple modules. Checking the backend, nothing is there. Looking at /app/etc/modules I see the module file listed at My_Module.xml?. Also, checking some of the paths under /app/community/ some of the directories also append a ? on the end of the name.

    Is this a known issue? I'm on a pretty standard Ubuntu/Trusty64 box.

    opened by pljspahn 1
  • Multi-Store issue

    Multi-Store issue

    This seems to work with a single website but not with multi-websites.

    website1.com -> website1.com/website1/ website2.com -> website2.com/website2/

    With your module everything redirects to website1.com

    it should be

    website1.com -> website1.com website2.com -> website2.com

    opened by phillbooth 0
  • thanks@!

    thanks@!

    I was reading a magento book when I found this

    Sounds simple - and even more simple than modman -

    Is this code still maintained? (before we make the change to this method)

    opened by seansan 1
  • Project title in README.md has incorrect phrase:

    Project title in README.md has incorrect phrase: "an unique"

    This is really just a minor detail, but it will reduce adoption of this great utility!

    "Deploy multiple Git repositories in an unique folder" should instead read: "Deploy multiple Git repositories in a unique folder"

    http://wordwhirled.blogspot.com/2005/12/unique-or-unique.html

    opened by jpitts 0
  • modman filters with chars following a '*' aren't parsed properly in move_files()

    modman filters with chars following a '*' aren't parsed properly in move_files()

    If a module contains a modman file containing filters like "*{something}", files that match that filter are not deployed in move_files().

    The problem happens when the modman file’s filter expression ends with “{something}”, like “app/etc/modules/.xml”.

    Line 337 of modgit is:

    line=”${line/*/}” # remove * char

    Which means the comparison on line 339 of:

    if [[ "$file" =~ ^$1 ]]

    will fail in these cases as it will evaluate to something like:

    if [[ "app/etc/local.xml.phpunit" =~ "app/etc/modules/.xml" ]]

    opened by jeffreyodum 0
Releases(v1.1.0)
Owner
Johann Reinké
PHP freelance developer
Johann Reinké
Need some filters? This package is based on the Repository Design Pattern to let you create specific queries easily.

DevMakerLab/Laravel-Filters Need some filters? This package is based on the Repository Design Pattern to let you create specific queries easily. Insta

DevMakerLab 19 Feb 20, 2022
Laravel basic Functions, eloquent cruds, query filters, constants

Emmanuelpcg laravel-basics Description Package with basic starter features for Laravel. Install If Builder Constants Install composer require emmanuel

Emmanuel Pereira Pires 3 Jan 1, 2022
🖖Repository Pattern in Laravel. The package allows to filter by request out-of-the-box, as well as to integrate customized criteria and any kind of filters.

Repository Repository Pattern in Laravel. The package allows to filter by request out-of-the-box, as well as to integrate customized criteria and any

Awes.io 160 Dec 26, 2022
A collection of easy-to-use filters with clause conditions to Filament

Filament Advanced Filter A collection of easy-to-use filters with clause conditions to Filament Installation Install the package via composer (require

Webbing Brasil 45 Jan 2, 2023
This package extends Laravel's FormBuilder to include some (soon all) HTML5 elements

HTML5 Forms for Laravel This package extends Laravel's FormBuilder to include some (soon all) HTML5 elements. How to Install Install the braunson/lara

Braunson Yager 89 Jun 17, 2022
🚀 Zero-downtime deployment out-of-the-box

?? Laravel Deployer Looking for the old Laravel Deployer? Click here. Laravel Deployer is no longer the package it used to be. Since that package was

Loris Leiva 1.6k Dec 31, 2022
Bash/Shell autocompletion for Composer

Bash/Shell Autocompletion for Composer composer-autocomplete provides Bash/Shell autocompletion for Composer. Built by Bram(us) Van Damme (https://www

Bramus! 92 Sep 19, 2022
A Laravel package to speed up deployment by skipping asset compilation whenever possible.

Airdrop for Laravel Read the full docs at hammerstone.dev/airdrop/docs. Hammerstone Airdrop for Laravel is a package that speeds up your deploys by sk

Hammerstone 160 Nov 24, 2022
A package for Laravel to perform basic git commands on locally integrated packages.

A package for Laravel to perform basic git commands on locally integrated development packages. If working within multiple local development packages or repositories at once this package is meant to ease the burden of navigating to each individual repository to perform basic git commands.

null 3 Jul 26, 2022
Git pre-commit hook for Laravel Pint

Laravel Pint githook Git pre-commit hook for Laravel Pint Automatically formats and saves code on commit You no longer need to run the ./vendor/bin/pi

dsoloview 7 Dec 10, 2022
A Composer script to lint a Travis CI configuration file.

composer-travis-lint composer-travis-lint is a Composer script that lints a project/micro-package its Travis CI configuration aka its .travis.yml file

Raphael Stolt 6 Jan 31, 2020
Script em PHP que gera uma chamada 'click-to-call' quando preenchemos um formulário na web, utilizando o asterisk.

;----------------------------------------------------------------------------------------------------------------------------; ; Scrip em PHP que gera

Leonardo Rocha 0 Dec 27, 2021
Effortlessly create a PHP preload script for your Laravel project.

This package has been superseeded by Laragear/Preload. Please migrate to the new package. Laraload Effortlessly create a PHP Preload Script for your L

Italo 209 Dec 7, 2022
CSS Exfil helper script to generate injected CSS and corresponding HTML (inspired by mike gualtieri)

The PoC-CSS Exfill Basic Keylogger First of all i was developing bot stuff and i seen attribute=value] [target=_blank] in source code of website. This

Ahsen 6 Apr 2, 2022
Module Management In Laravel

Laravel-Modules Laravel laravel-modules 5.4 ^1.0 5.5 ^2.0 5.6 ^3.0 5.7 ^4.0 5.8 ^5.0 6.0 ^6.0 7.0 ^7.0 8.0 ^8.0 nwidart/laravel-modules is a Laravel p

Nicolas Widart 4.6k Dec 29, 2022
Le module PrestaShop Dronic© permet très facilement d'ajouter à votre site Prestashop un configurateur de drone FPV !

Description Le module PrestaShop Dronic© permet très facilement d'ajouter à votre site Prestashop un configurateur de drone FPV ! Ce module utilise de

Theo 3 Nov 19, 2021
Module for PageBuilder Support for M2.4.3 and future versions.

Magento 2 DataPatchCreator Page Builder Compatibility Plugin Plugin for PageBuilder to remove encoding of HTML special characters done by Magento\Page

eCommerce Nanobots 4 Dec 27, 2022
Simple project to send bulk comma-separated emails using laravel and messenger module from quick admin panel generator.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Novath Thomas 1 Dec 1, 2021
webtrees module: enhanced clippings cart with more functions to add records to the clippings cart and to start actions on these records

webtrees module hh_clippings_cart_enhanced !!! This is an alpha version! Do not use it in a productive webtrees system! !!! This webtrees custom modul

Hermann Hartenthaler 1 Sep 18, 2022