Code Monkey home page Code Monkey logo

cvm's Introduction

Composer Version Manager

Composer 2 is here. It's time for a one stop shop for switching between major (and minor ๐Ÿ‘ถ) composer versions. Erase "using the right composer version" from your workflow.

But wait, what about composer self-update --1 and --2?

Well I'm glad you've asked!

There are some added benefits this CLI and shell hook will bring to you:

  1. Cached composer.phar for faster version toggling.
  2. Per-directory smart composer environments. It's as simple as cd my-project and the right composer version will be used.

Installation

Choose one of the options below to install cvm.

Homebrew (MacOS)

brew update
brew install composer-version-manager/cvm/cvm

Note: Watch for symlink errors. If you already have an existing Python3 installation you may be required to run the following command:

brew link --overwrite cvm

Chocolatey (Windows)

TODO

Download binary and update PATH

TODO

Hook onto your shell

Hooking onto your shell enables cvm Smart usage for per-directory automated composer verrsioning.

Find the instructions for your shell below. If your shell is not listed please feel free to submit a feature request issue and we will try and make it happen.

BASH

Add the following line to the end of your ~/.bashrc

eval "$(cvm hook bash)"

ZSH

Add the following line to the end of your ~/.zshrc

eval "$(cvm hook zsh)"

Smart usage

Create a .cvm_config in any directory specifying the composer version you would like to use. Navigating to that directory or any nested directory will automatically enable that composer version in your current workspace.

cd my-project
echo '{"requires":"2.0.11"}' > .cvm_config

This file can be committed to your source control.

Global composer version

You can configure a global composer version. Which will be the default when no parent directory has a .cvm_config.

cvm list        # List available tags
cvm use 2.0.11  # Globally use a specific composer version

Authors

Morgan Wowk

Morgan is a Software Developer from the wintery lands of Canada ๐Ÿ‡จ๐Ÿ‡ฆ๐Ÿ. You can primarily find him on LinkedIn, writing open source or building apps to help tens of thousands of ecommerce stores.

Bhavek Budhia

Likewise, Bhavek resides in the frosty country of Canada โ˜ƒ๏ธ. An avid developer ๐Ÿ‘จโ€๐Ÿ’ป with fortified experience in Python that has helped us develop a clean and extendable codebase.

cvm's People

Contributors

boldbhavek avatar boldmorgan avatar morgan-wowk avatar ubaniak avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pombredanne

cvm's Issues

Current version should be tracked on a per-tty basis

Problem

If you are working in multiple TTYs then the current version from the ~/.cvm/config.json will conflict. When the current version changes in one TTY, and you perform an action in a different TTY, the current version will not match and this will cause unnecessary stdout logging and PATH updates.

Steps to reproduce

  1. Open TTY 1
  2. Set a global composer version
  3. Navigate somewhere within the global scope (no cvm_config)
  4. Notice the TTY will output "Using composer version ..."
  5. The next time to run ls or any command, it should not output Using composer version ... every time. It should only do this when the current version changes.
  6. Open TTY 2
  7. Navigate to a non-global scope. Somewhere that has a cvm_config with another version.
  8. Notice it will output "Using composer version ..." as expected
  9. Go back to TTY 1 and run any command
  10. Notice it will output "Using composer version ..." even though nothing has changed in the current TTY. This is because both TTYs are looking at and updating the same current field in the ~/.cvm/config.json

Solution

Come up with a way of tracking the current version on a per-tty basis. Not for the application as a whole.

Broken brew installation

Installation using Brew is broken, see steps below:

~
โฏ brew --version
Homebrew 4.2.3

~
โฏ brew install composer-version-manager/cvm/cvm
Error: composer-version-manager/cvm/cvm: wrong number of arguments (given 1, expected 0)

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.