Modularize extensions using symlinks. Voted #1 Magento tool by @WebShopApps!

Related tags

Miscellaneous modman
Overview

modman (Module Manager)

Developing extensions for software that doesn't allow you to separate your files from core files, and keeping that extension under version control and making it easy to deploy is now much, much easier. Development of this script was inspired by Magento which forces you to mix your extension files all throughout the core code directories. With modman, you can specify in a text file where you want your directories and files to be mapped to, and it will maintain symlinks for you so that your code is easy to hack and deploy.

All of your cloned/checked-out modules will be kept in a directory named .modman in the location where you run modman init.

Requirements

  • Linux/Unix or OSX (not cygwin, see Windows Users below)
  • bash
  • Common utilities available in your PATH: grep (POSIX), find, ln, cp, basename, dirname
  • Web server must follow symlinks
  • git and/or subversion are optional (not required for "deploy" command)

Magento Users

If using template files in a modman module, you must either:

Option 1:

Use a patched version of Mage/Core/Block/Template.php. This gist is itself a modman module so you can install it by cloning it directly or you can integrate it into your environment some other way.

$ modman clone template-patch https://gist.github.com/35c0d32dd651c4c8c840.git

NOTE: I provide no warranties for using this patch. Use at your own risk!

Option 2:

Enable "Allow Symlinks" (found under System > Configuration > Advanced > Developer).

Allow Symlinks

NOTE: Disabling this security protection does decrease security as it allows template files to be loaded from any location. However, the risk is not so much symlinks as it is specially crafted template paths. The patched Template.php file (Option 1) allows the use of symlinks but should still prevent templates from being loaded from directories other than the app/design directory.

Windows Users

Windows (including cygwin) is not supported by this script, but there is a PHP-port of modman which works on Windows. I am not affiliated with the authors and do not provide support for the PHP port, only a link here for reference.

Installation

To install Modman, you can either install the library in your user's root folder, or you can install Modman globally. Regardless of which option you choose, first run one of these two scripts to download the Modman repo.

bash < <(wget -q --no-check-certificate -O - https://raw.github.com/colinmollenhour/modman/master/modman-installer)

or

bash < <(curl -s -L https://raw.github.com/colinmollenhour/modman/master/modman-installer)

1. Root Folder

If you'd like to keep the script in its native location at ~/bin/, just reload your Bash profile.

source ~/.profile

2. Installing Modman Globally

To make the script global after downloading, move the Modman script to an appropriate script folder, (e.g. /usr/local/bin/ or something similar within /usr/*). Moving it to one of the paths already loaded in your $PATH variable will automatically pick it up without a ~/.profile reload.

mv ~/bin/modman /usr/local/{{ preferred folder }}

And then finally, alias Modman with a symlink if you want something shorter to type (optional)

ln -s /usr/local/{{ preferred folder }}/modman /usr/local/{{ preferred folder }}/{{ symlink }}

Note: modman is simply a bash script, so to use it you just need to place it in your $PATH and change its mode to executable.

Getting Started

Run modman --help to get the basic usage summary or modman --tutorial to see a brief tutorial. For more in-depth information please see the Modman Wiki

Version Control Systems

Modman currently supports subversion and git. Other VCSs could be used by manually checking out the source code into the proper directory and using the "deploy" command.

Author

License

Copyright 2009 Colin Mollenhour

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Comments
  • where is modman

    where is modman

    iMac-di-Raffaele-Filomena:magento raffaele$ curl -s -L https://raw.github.com/colinmollenhour/modman/master/modman-installer

    !/usr/bin/env bash

    if [ ! -d "$HOME/bin" ] ; then mkdir $HOME/bin

    if [ -f $HOME/.profile ]; then
        tty -s && . $HOME/.profile
    
        if [[ ":$PATH:" != *":$HOME/bin:"* ]]; then
            echo -e '\nPATH="$HOME/bin:$PATH"' >> $HOME/.profile
        fi
    fi
    

    fi

    SRC="https://raw.githubusercontent.com/colinmollenhour/modman/master/modman" DEST="$HOME/bin/modman"

    test if curl/wget is installed

    if hash curl 2>&- ; then CMD="curl -s -L $SRC -o $DEST" elif hash wget 2>&- ; then CMD="wget -q --no-check-certificate -O $DEST $SRC" else echo "You need to have curl or wget installed." exit 1 fi

    $CMD

    chmod +x $DEST

    echo "Done. Modman installed in $HOME/bin/modman"

    where is dir installation? thanks

    opened by farmaworld 19
  • Store a list of modules installed using modman

    Store a list of modules installed using modman

    After applying this commit, modules will be added and removed from a newly-created .repos file inside the .modman directory. This file is intended to be committed to the super-repository, and is roughly equivalent to the lock file in Composer.

    This is only really relevant if you're working on a site from more than one location, which is often the case when you're working in a multi-user environment.

    opened by mwgamble 18
  • Magento patch SUPEE-9767 and Symlinks setting

    Magento patch SUPEE-9767 and Symlinks setting

    A new Magento patch (SUPEE-9767 released yesterday, May 31 2017) suggests that you should disable Symlinks setting before applying the patch:

    Before applying the patch or upgrading to the latest release, make sure to disable Symlinks setting [...] The setting, if enabled, will override configuration file setting and changing it will require direct database modification.

    If you are managing modules by modman that use template files, these will not work as described in modman's README. I guess the reason for the suggestion of disabling Symlinks setting is the APPSEC-1281: Remote code execution through symlinks fix included in the patch.

    How will this affect modman? If you need to have Symlinks setting enabled to use modman (if you do not want to patch Mage/Core/Block/Template.php as suggested in modman's README), this means your Magento shop is opened for at least one known security threat...

    opened by ehannes 16
  • Support for --modman-dir

    Support for --modman-dir

    I've recently been reading a lot of articles about using .modman alongside composer to manage project dependencies. One thing that grates on me slightly is the fact that in these workflows the "vendor" modules sit in the same directory as the "project specific" code. This leaves you in a situation where you have committed code in the same directory as vendor code, which is not ideal. To draw a parallel this feels like having the src directory sitting in the vendor directory in a Symfony 2 project.

    The only way I can think of getting around this would require modman supporting the ability to install from (at least 2) different directories. This would allow project specific code to be committed / tracked in .modman and composer to deploy magento modules to .modman-vendor (or perhaps vice-versa as this may be simpler to achieve without modification to current tools such as AOEpeople/composer-installers).

    I'm thinking we could add a --modman-dir option, allowing the developer to optionally specify from which directory they wish to modman commands to operate. I've not thought about this in too much depth as I wanted to check your receptiveness to the idea first, however I believe implementation will largely be replacing any reference to .modman with a variable set at the top of the script. If the option is specified, current behaviour is completely unmodified, if it is, all commands are based against the specified directory.

    opened by pocallaghan 16
  • .gitmodules is not created / updated

    .gitmodules is not created / updated

    Modman does not create an entry in the .gitmodules file when installing a module. As a result you can no longer update other git submodules in the parent repo.

    When executing the git submodule update command: > git submodule update --init --recursive You get the following error: No submodule mapping found in .gitmodules for path '.modman/Cm_Cache_Backend_Redis'

    When installing the Cm_Cache_Backend_Redis module: > modman clone git://github.com/colinmollenhour/Cm_Cache_Backend_Redis.git

    I would expect to find the following entry in the .gitmodules file of the parent repo:

    [submodule "Cm_Cache_Backend_Redis"]
    path = .modman/Cm_Cache_Backend_Redis
    url = git://github.com/colinmollenhour/Cm_Cache_Backend_Redis.git
    

    I have added these lines manually for now but I am not sure if this will cause problems further down the track.

    opened by nocturnalfrog 12
  • Toggle Link and Unlink

    Toggle Link and Unlink

    @colinmollenhour

    Great way to manage my Magento code ! :100: I just couldn't find how to use modeman to link and unlink the modules.

    I mean like install and remove them using modman :)

    Thanks,

    @gayanhewa

    opened by gayanhewa 12
  • Add --modmandir option.

    Add --modmandir option.

    Specifying --modmandir allows control over where modman will place / source code from. Effectively allowing multiple modman directories for a single install. Refs #87.

    opened by pocallaghan 10
  • modman undeploy-all and remove-all

    modman undeploy-all and remove-all

    Is it possible to provide a functionality like "undeploy-all" and "remove-all" in regards to the existing function deploy-all?

    Thanks!

    opened by jhoelzl 10
  • Installation is not working

    Installation is not working

    Installer as mentioned in modman page is not working. Both wget and curl commands say modman is installed, but the created directory is emply. I also used source command.

    Now I used a sh file copy & paste from here https://github.com/zerium/modman/blob/c52bde6c341e7bec59ab187a92d98ffa40862802/modman-installer

    It is not working too. How can I install modman???

    opened by ADDISON74 9
  • modman without access to /proc?

    modman without access to /proc?

    Hi,

    I would really like to use modman on a Mittwald Managed Server. Unfortunately, I get the following error when running deploy-all: ./module-manager/modman: Zeile 631: /dev/fd/62: Datei oder Verzeichnis nicht gefunden ("File or Directory not found")

    Mittwald told me that modman only works with access to /proc and that this access is not available on their systems. Is it possible to use modman without it?

    Thanks a lot for all your work! Cheers, Simon

    opened by sprankhub 9
  • Symlinks 1 level too deep.

    Symlinks 1 level too deep.

    It seems the relative symbolic links that are made are one level too deep.

    Instead of ../../../../.modman/my/files/here (four levels up), it should be ../../../.modman/my/files/here.

    I tried the version @Caprico85 has and I was able to get the right amount. However, my symlinks still aren't working. For some reason, even though the path in the symlink is good, it doesn't work.

    I tried to figure out if the path was wrong by going to the symlink's folder and manually creating the symlink but not even autocompletion allows me to pull up my module's folder under the .modman folder. I'm able to use tab completion up to that point. The name of my module doesn't contain any special characters. I looked to see if maybe it was a folder permission error but it doesn't appear to be. Anyone else having these issues?

    opened by cobhimself 8
  • Use set -eu, fix all unbound variables and properly catch exit codes.

    Use set -eu, fix all unbound variables and properly catch exit codes.

    Modman is relying on a lot of loose behaviors in bash, which appears to be the source of many bugs.

    Using potentially unbound variables in a script that alters the filesystem is dangerous and unacceptable.

    The script needs to be put into strict mode to protect against this.

    Furthermore, if a subcommand fails with an unexpected non-zero exit code, the entire script needs to halt.

    At the top of the script:

    set -eu
    
    opened by yoosefi 2
  • Options ordering and relevant documentation broken

    Options ordering and relevant documentation broken

    Modman parsing of command line arguments and options is contrived in inextricable ways and documentation is of no help. Two cases:

    1. For the 'deploy' command, --modmandir option works if and only if it is put between 'deploy' and module name, it won't have any effects otherwise. The right syntax is modman deploy --modmandir <path> <module> <options>
    2. For the 'link' command, help states the syntax link <path> so one is induced in thinking that module source path should be put before immediately after the command and before all the following arguments, as per the module command syntax: modman <command> [<module>] [<options>] [[--] <VCS options>], but again no: path is actually an additional argument to be put after the module name and before options, and help does not give any hint for this. Here we are with modman link <module> <path> <options>

    Tried on version 1.12 and using options --force and --copy.

    opened by shb 1
  • Autocomplete does not work when parameters are used before

    Autocomplete does not work when parameters are used before

    So if I start typing:

    modman update Vend

    I can get the autocomplete to give me:

    modman update Vendor_Module

    However if I type:

    modman update --copy --force Vend

    The autocomplete doesn't work anymore.

    opened by digitalpianism 0
  • Feature request: global config file

    Feature request: global config file

    It would be nice to have a configuration file where you could set default behavior for: no-local, no-clean, no-shell, basedir, copy for all or only specific modules.

    opened by jarocks 1
  • Too many levels of symbolic links

    Too many levels of symbolic links

    Hi, when working with modman we often see this for every country/locale subdirectory that we have. They are symlinked dirs to a different folder. Is there any way of preventing the below?

    Can we change something? Or learn modman to exclude thesse dirs?

    [server]$ modman remove package find: ./nl/nl': Too many levels of symbolic links find:./nl/errors/errors': Too many levels of symbolic links find: `./nl/lib/lib': Too many levels of symbolic links

    opened by shirtsofholl 3
Releases(1.14)
Owner
Colin Mollenhour
Colin Mollenhour
A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2

Simple Import / Export tool A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2. Table data

EcomDev B.V. 51 Dec 5, 2022
A Magento 2 dashboard to display installed extensions. Read the blog post on some of the thinking behind it:

Extension Dashboard for Magento 2 This module adds a dashboard to review all installed extensions in the Magento admin (Magento 2.3.0+ for now only).

ExtDN 36 Dec 24, 2022
GitHub Actions for Magento 2 Extensions

GitHub Actions for Magento 2 Extensions This repository's aim is to provide a set of open sourced GitHub actions to write better tested Magento 2 exte

ExtDN 104 Jan 1, 2023
List of Magento extensions with known security issues.

Magento Vulnerability Database List of Magento 1 and 2 integrations with known security issues. Objective: easily identify insecure 3rd party software

Sansec 184 Dec 7, 2022
Migration Tool for Magento Commerce (EE) to Magento OpenSource (CE)

Migration Tool for Magento Commerce to Magento OpenSource Also known as Magento Enterprise (EE) to Magento Community (CE). This migrating tool allows

OpenGento 38 Dec 28, 2022
Helper to automatically load various Kirby extensions in a plugin

Autoloader for Kirby Helper to automatically load various Kirby extensions in a plugin Commerical Usage This package is free but if you use it in a co

Bruno Meilick 13 Nov 9, 2022
Zephir is a compiled high level language aimed to the creation of C-extensions for PHP.

Zephir - is a high level programming language that eases the creation and maintainability of extensions for PHP. Zephir extensions are exported to C c

Zephir Language 3.2k Jan 2, 2023
GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.

GitHub action to set up PHP with extensions, php.ini configuration, coverage drivers, and various tools.

Shivam Mathur 2.4k Jan 6, 2023
Custom code snippets and examples for SkyVerge-built WooCommerce extensions

SkyVerge WooCommerce Plugins Welcome to the wc-plugins-snippets repository! This repository stores code snippets related to SkyVerge WooCommerce plugi

SkyVerge 255 Nov 16, 2022
Library to build PHP extensions with C++

PHP-CPP The PHP-CPP library is a C++ library for developing PHP extensions. It offers a collection of well documented and easy-to-use classes that can

Copernica 1.3k Dec 24, 2022
PhpCodeAnalyzer scans codebase and analyzes which non-built-in php extensions used

PhpCodeAnalyzer PhpCodeAnalyzer finds usage of different non-built-in extensions in your php code. This tool helps you understand how transportable yo

Sergey 92 Oct 19, 2022
Silverstripe-ideannotator - Generate docblocks for DataObjects, Page, PageControllers and (Data)Extensions

silverstripe-ideannotator This module generates @property, @method and @mixin tags for DataObjects, PageControllers and (Data)Extensions, so ide's lik

SilverLeague 44 Dec 21, 2022
A simple script to convert extensions from Magento1 to Magento2

ConvertM1M2 Background The purpose of this script is to automate as much as possible the initial conversion of a Magento 1 extension, and allow develo

Boris Gurvich 144 Dec 14, 2022
Dubbox now means Dubbo eXtensions, and it adds features like RESTful remoting, Kyro/FST serialization, etc to the Dubbo service framework.

Dubbox now means Dubbo eXtensions. If you know java, javax and dubbo, you know what dubbox is :) Dubbox adds features like RESTful remoting, Kyro/FST

当当 4.9k Dec 27, 2022
This library uses GD and EXIF (optional) PHP extensions so make sure you have them installed.

simple and fast image processing class that can downscale, compress and convert images using php-gd native functions

Leon 8 Jul 15, 2022
PhpCodeAnalyzer scans codebase and analyzes which non-built-in php extensions used

PhpCodeAnalyzer PhpCodeAnalyzer finds usage of different non-built-in extensions in your php code. This tool helps you understand how transportable yo

Sergey 89 Jan 14, 2022
Doctrine extensions for PHPStan

Doctrine extensions for PHPStan PHPStan Doctrine This extension provides following features: DQL validation for parse errors, unknown entity classes a

PHPStan 478 Jan 3, 2023