Giter VIP home page Giter VIP logo

modman-php's Introduction

modman-php

PHP implementation for modman, to use it on every operating system with PHP support (also Windows).

Currently implemented:

  • init (creates .modman directory)
  • link (creates symlinks)
  • deploy (update symlinks)
  • deploy-all (updates all modules)
  • repair (repairs all symlinks)
  • clean (removes all dead symlinks)
  • create (creates a modman file for an existing module)
  • clone (clones a git repository)

--force is available for link, deploy, deploy-all and clone, if not set script aborts when conflicts are found --copy is available for deploy and deploy-all, will copy the files and folders instead of symlinking them

Usage examples:

php modman.php init
php modman.php link ..\B2BProfessional
php modman.php deploy B2BProfessional

Or directly clone which does also init and deploy:

php modman.php clone https://github.com/sitewards/B2BProfessional

Currently supported in modman files:

  • symlinks (incl. wildcards)
  • @import
  • @shell

For Windows users there's also a batch file available, so instead of typing php and directory to modman.php you could just use modman.bat everywhere if you add it to your %PATH%-variable:

modman link c:\B2BProfessional

Started at Magento Hackathon in Zürich 2013-03-09

Influenced by the original modman at https://github.com/colinmollenhour/modman/

init

Creates the .modman directory, which is used for all other operations.

cd $PROJECT
modman init

or

cd $PROJECT
modman init <basedir>

If you don't specify a basedir (aka magento directory) the current working directory will be used. The basedir functionality is supposed to be used to move the .modman directory outside of the magento main directory.

  • That first of all helps to structure your projects better
  • But is also a security feature as modman might link sensitive data like docs into your magento magento main directory.

link

Creates symlink from a modman file

cd $PROJOECT
modman link /path/to/myMageModule

Optional parameter --force to automatically remove conflicted files

deploy

Updates the symlinks of a linked module

cd $PROJECT
modman deploy myMageModule

Optional parameter --force to automatically remove conflicted files

Optional parameter --copy to copy files instead of creating symlinks

deploy-all

Updates all symlinks of linked modules

cd $PROJECT
modman deploy-all

Optional parameter --force to automatically remove conflicted files

Optional parameter --copy to copy files instead of creating symlinks

repair

Repairs all symlinks of all linked modules

cd $PROJECT
modman repair

clean

Scans directory for dead symlinks and deletes them. Useful if a module was deleted and not removed in the project

cd $PROJECT
modman clean

remove

Removes links of a project

cd $PROJECT
modman remove myMageModule

create

Scans through the current directory and creates a modman file containing all files and folders

cd $MODULE
modman create

Optional parameter --force to automatically overwrite existing modman-file. Optional parameter --include-hidden to list hidden files and directories in modman-file. Optional parameter --include <include_file> to include a template file at the end of the new modman-file. If the current directory is recognized as a magento module, only the path to the module's code directory is added to the modman file.

clone

Clones a git repository

cd $PROJECT
modman clone https://git.url

Optional parameter --force to overwrite existing folder. Optional parameter --create-modman to create a new modman file in the cloned folder if there is no modman file yet.

Feature ideas

  • Check if "allow symlinks" is activated in Magento when linking template files

modman-php's People

Contributors

dmanners avatar homecoded avatar mryvlin avatar schmengler avatar vinai avatar vovayatsyuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modman-php's Issues

PHP Warning: Missing argument 1 for Modman_Command_Init::doInit()

command I used:

./vendor/bin/modman.sh clone [email protected]:Cotya/magento_performance_fixes.git --create-modman
PHP Warning:  Missing argument 1 for Modman_Command_Init::doInit(), called in /work/magento/common/vendor/sitewards/modman-php/modman.php on line 1079 and defined in /work/magento/common/vendor/sitewards/modman-php/modman.php on line 210
PHP Stack trace:
PHP   1. {main}() /work/magento/common/vendor/sitewards/modman-php/modman.php:0
PHP   2. Modman->run() /work/magento/common/vendor/sitewards/modman-php/modman.php:1152
PHP   3. Modman_Command_Clone->doClone() /work/magento/common/vendor/sitewards/modman-php/modman.php:92
PHP   4. Modman_Command_Init->doInit() /work/magento/common/vendor/sitewards/modman-php/modman.php:1079
PHP Notice:  Undefined variable: sDirectory in /work/magento/common/vendor/sitewards/modman-php/modman.php on line 211
PHP Stack trace:
PHP   1. {main}() /work/magento/common/vendor/sitewards/modman-php/modman.php:0
PHP   2. Modman->run() /work/magento/common/vendor/sitewards/modman-php/modman.php:1152
PHP   3. Modman_Command_Clone->doClone() /work/magento/common/vendor/sitewards/modman-php/modman.php:92
PHP   4. Modman_Command_Init->doInit() /work/magento/common/vendor/sitewards/modman-php/modman.php:1079

@import duplicate basedir added

I've a modman file with this content:

@import Project_Base

The function "doImport" uses the same method as "doDeploy" "$sSymlink = $oLine->getSymlink();" .. in this method the basedir is added. So both "doImport" and "doDeploy" add the basedir.

When i force the doImport not to add the basedir everything is working as it should.

Bug or wrong configuration?

503 magento onepoage checkout

Hello,
I am currently setting up modman for one of our projects. I already converted most of the classes in modman but I am having some problems. I am not able to finish an order in our store, when I go trough the steps in the checkout its automatically redirecting me to my cart.
The strange thing is that this sometimes is happening before even putting the shipping address sometimes after i select shipping method.
The error that I am getiing in the console is 503. When I check the logs I it saying:

Module "XXX" requires module "YYY". - I converted successfully both modules and multiple times checked if they are correct. I can see that module "XXX" depends from module "YYY" - I can see that from the xml file of module "XXX". (also sometimes the names of the modules are not XXX or YYY, some another modules.).

Also for more information this code is working correctly in another Linux instaltion again using modman.

I thank you for your time I will appreciate your help.

doImport investigation

Currently we do some magic to get the correct paths for modman files that use the import command.

We should compare how this is done in the real modman and decide if what we are doing is the best process for this.

Error with "--copy --force" command

I can confirm this in PowerShell and bash. When you re-deploy with the --copy --force command you get an error "A resource must be a file, an empty folder or a symlink".

I did a little debugging and found that the doRemoveFolderRecursively method is calling the RecursiveDirectoryIterator. When the files are iterated through, the dot symlinks are being passed through to doRemoveResource and if the current folder has files in it that error will be thrown.

Strict standard errors

When running modman deploy-all with PHP 5.5 I get a bunch of errors like the following thrown for each symlink being created (running on windows):

Strict standards: Only variables should be passed by reference in C:\wamp\www\new-project\tools\modman.php on line 291

Call Stack:
   0.0012     508296   1. {main}() C:\wamp\www\new-project\tools\modman.php:0
   0.0012     508936   2. Modman->run() C:\wamp\www\new-project\tools\modman.php:1238
   0.0012     509448   3. Modman_Command_All->doDeploy() C:\wamp\www\new-project\tools\modman.php:65
   0.0012     509920   4. Modman_Command_All->__call() C:\wamp\www\new-project\tools\modman.php:65
   0.3154     514368   5. call_user_func_array:{C:\wamp\www\new-project\tools\modman.php:190}() C:\wamp\www\new-project
\tools\modman.php:190
   0.3154     514768   6. Modman_Command_Deploy->doDeploy() C:\wamp\www\new-project\tools\modman.php:190
   0.5059     528312   7. Modman_Command_Link_Line->getSymlink() C:\wamp\www\new-project\tools\modman.php:591

bin/modman

Please make it compatible and replaceable by adding symlink bin/modman

Is this project abandoned?

No commits in 18 months.

Unmerged 2 years old PRs.

Should someone pick up the mantle to keep it alive?

Too many files when using modman create

When using modman create it would be nice if it would detect the usual Magento structure and only link the main folder app/code/community/myModule instead of each individual file.

Modman Clean not working - Result too large

Hi,
when I run modman clean I get the following error message:
Warning: scandir(C:\projects\XXXXXXXXXXXXXXXX): failed
to open dir: Result too large in C:...\modman-php\modman.php on line 617

(X and ... replaced for security reasons)

basedir adds trailing space on OSX

While testing modman-php for use by a cross platform team I found that the basedir function does not properly trim trailing characters on OSX.

call to undefined function symlink()

Hi, i get the above error. No symlinking is working.

Windows
Magento 1.9.2.1
php 5.3.13
Wampserver 2.2

Error occurs on modman.php line 249

How can i resolve this please. as anyone else had this issue?
Magento symlinks enabled.

thanks
Shaun

Magento configurable modules.

Hello,
I wrote before about a problem that I am having under my Windows installation with modman, I finally found what is the problem.

So the problem is that sometimes (90% of the times) in the Windows server that we have we are receiving 503 Network Error saying that ""XXX" requires module "YYY"" - both modules are there and in Linux this is working.
What I discovered is that this is because Windows is not always finding the modman symlinks and is not folling to what they are pointing., especially the ones that depends from another one. I found also this is happening usually when there is a lot of request from the side of the website.

I don't know if this is relevant issue for modamn, I made a question in stackoverflow asking for eventual ideas and maybe solutions.
So if you can help me I will be very grateful

Thank you in advance.

P.S. I found that when I put the real files in app/etc/ then there is no problem, but this is not an elegant solution because is destroying the purpose of modman,

$PROJECT replacement in @shell ignoring basedir

On line 628 basedir is not being taken into account. The script is assuming modman is being run from the basedir itself and the .basedir configuration is ignored

$sShell = str_replace('$PROJECT', getcwd(), $sShell);

For Newbies

Hello There i followed following way but unable to use it properly can some one guide me how to use

  1. copied modman.php to magento root and run comman
    php modman.php init - it has created .modman directory

  2. then i want to create modman file automatically so what i did is in root i run following command
    php modman.php create
    it did create modman file but with all the magento folders and files

so i thought let me try to run same command by navigating to module itself

so i go to app/code/local/MyCompany/MyModule and copy modman.php over there just for initial learning and then run same above command php modman.php create and it did only added files with folder name not with full path including app/code/local ....
-can u guys help me to make proper modman file as u guys have in b2b professional?
-also can u give some better example and explaination about whats is purpose of link and how to use it?

you guys mentioned php modman.php link ..\B2BProfessional
what does that mean ..\ in windows? do i need to give full path? like

php modman.php link app/code/local/community/sitewards/B2BProfessional ?

or do i need to run link command under .modman directory?

Need help ASAP

add a composer.json

I would use this as part of a project of mine, would make it easier for me, if I can install it via composer

if you are very nice, you add the modman.php as "bin" in the composer.json

xxx is not initialized

anyone know what I am doing wrong?

This is on Windows 10

First in the module folder ran
php modman.php create

This created the modman file

Then in the Magento root
php modman.php init

and
php modman.php link ..\xxxx

Then get the error

xxxx is not initialized,
please clone or link it

removing symlinks

Is there a reason that symlink-directories are not removed by unlink in Modman_Resource_Remover::doRemoveResource?

Currently the following code

        if (is_dir($sElementPath)){
            if (is_link($sElementPath) OR $this->isFolderEmpty($sElementPath)){
                rmdir($sElementPath);
            }
                 }

does not remove my module completely (seems rmdir does not work on symlinks that point to a non-empty directory).

Suggestion:

      if (is_dir($sElementPath)){
            if (is_link($sElementPath)) {
                unlink($sElementPath);
            } elseif ($this->isFolderEmpty($sElementPath)){
            rmdir($sElementPath);
             }
      }

.. but I'm not sure if that would break some other functionality...

.basedir check in getAllModules

In your getAllModules method you try to remove the .basedir file.

$iBaseDir = array_search(Modman_Command_Init::getBaseDirFile(), $aDirEntries);

Modman_Command_Init::getBaseDirFile() returns ".modman/.basedir" .. but $aDirEntries only contains ".basedir".

It only works when I change this line to

$iBaseDir = array_search(Modman_Command_Init::MODMAN_BASEDIR_FILE, $aDirEntries);

Is it a bug or do I something wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.