jreinke / modgit Goto Github PK
View Code? Open in Web Editor NEWShell script for Git module deployment with include/exclude filters.
Shell script for Git module deployment with include/exclude filters.
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.
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$
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
When using modgit on a Magento installation that's SCM'd by git any existing submodules break.
e.g.
$ cd /path/to/project/
$ modgit init
$ modgit clone module-name git://repo.git
$ git submodule init
No submodule mapping found in .gitmodules for path '.modgit/module-name/source'
One solution is to add .modgit to your gitignore, this means that it won't be tracked. I think this is mostly okay as any module updates will be tracked in the magento working directory. However this does limit portability.
Another solution is not to use submodule, making the problem moot, but that's not always practical.
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.
π Just found this repo does not have any license, it would be good to add OSI-approved one, https://spdx.org/licenses/
it would be ideal to be able to do modgit -f remove-all
would be useful. I'm thinking about adding it in the fork I have. Would this be something that would be considered?
Also a -q for quite would be good too but -f is needed for a projects I'm working on.
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
Not download the script from here https://raw.github.com/jreinke/modgit/master/modgit download the file with the size 0.
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)
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)
When a module has a modman file with a glob source pattern (such as one/*
), the directory structure inside is not copied to the target correctly.
Please refer to this demo project I've setup: https://github.com/thizzle/modgit-copyissue-demo
The modman file in that module has a single line:
one/* one/
I would expect the file one/two/file.txt
to be copied to one/two/file.txt
in my project after cloning this module with modgit.
Instead, the directory structure inside the one
directory is flattened so that the file is copied to one/file.txt
.
Tharsan
Is it magento2 compatible?
Building on #1.
For context here's my desired workflow:
To do this I do not ignore .modgit/
, I want it to be portable between team members.
Currently I'm seeing untracked files when switching between branches, specifically .modgit/module/source
. I think this is due to the .git
folder up the tree.
I had breifly flirted with submodules for this task, but in addition to #1 they bring with them a lot of pain in other areas.
git subtree
looks like it'd be ideal for this task.
I've hacked together a working git subtree
implimentation of modgit
over at https://github.com/rjocoleman/modgit/tree/subtree
Please note, it's not battle tested - a prototype at best. Several things are broken such as modgit update-all
.
However switching branches etc does perform as I'd expect (i.e. no untracked files)
modgit clone
and modgit update
have been implimented (albeit with a slightly changed syntax for update
).
I'm going to continue testing and refining this as I go, I'm keen to hear feedback on this direction. With subtree
living in the git's contrib
folder I don't see this as being much more than a runtime option at this point.
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
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" ]]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.