Giter VIP home page Giter VIP logo

cvm's Introduction

CVM

Composer Version Manager - A script to manage multiple versions of Composer the easy way.

Compatibility

Developed and tested on macOS, should work on most Linux distributions, probably not functional on Windows.

Install

To install, clone the repository:

git clone [email protected]:mitchellnemitz/cvm.git "$HOME/.cvm"

Then update your ~/.bash_profile, ~/.zshrc, or shell equivalent:

if [ -f "$HOME/.cvm/cvm.sh" ]; then
    export CVM_DIR="$HOME/.cvm"
    source "$CVM_DIR/cvm.sh"
fi

Lastly, start a new shell, or source your updated shell config file:

# Bash
source "$HOME/.bash_profile"

# ZSH
source "$HOME/.zshrc"

Update

To update, pull the latest changes from master

cd "$HOME/.cvm"
git fetch origin master
git pull origin master

Usage

Run cvm --help for a summary of commands.

To install a new version of composer:

# by exact version
$ cvm install 1.20.22
$ cvm install 2.1.5

# by major version alias
$ cvm install 1.x
$ cvm install 2.x

# by stability alias
$ cvm install stable
$ cvm install preview
$ cvm install snapshot

To see installed versions of composer (arrows indicate exact versions for aliases):

$ cvm list
1.10.22
2.1.5
1.x -> 1.10.22
2.x -> 2.1.5

To use an installed version of composer:

# by exact version
$ cvm use 2.1.5
Using Composer version 2.1.5 1970-01-01 00:00:00

# by major version
$ cvm use 2.x
Using Composer version 2.1.5 1970-01-01 00:00:00

To switch back to the system version of composer:

$ cvm use system

To update the version of composer used by an alias:

$ cvm update 1.x
Updating Composer version 1.x
Using Composer version 1.10.22 1970-01-01 00:00:00

To remove an installed version of composer:

# by exact version (also removes related aliases)
$ cvm remove 1.10.22
Removed Composer version 1.10.22

# by alias (exact version remains installed)
$ cvm remove 2.x
Removed Composer version 2.x

.cvmrc

If you don't pass a version to cvm, it will attempt to locate a .cvmrc file in the current directory and treat the contents as the intended version instead. This is a convenient way to explicitly declare are share your composer version for a given project.

The simplest way to generate a .cvmrc for your project is to echo the chosen version and redirect the output to a file:

echo "1.x" > .cvmrc

Now whenever you open your project, run cvm use and the version declared in your .cvmrc file will be selected. If the correct version of composer isn't installed, run cvm install instead.

Development

Install the script as normal, make changes to $HOME/.cvm/cvm.sh, and run cvm --reload before testing.

Support

Bugs should be reported via Github Issues.

Feature requests are welcome, pull requests are preferred, but in all things please remember the human.

cvm's People

Contributors

mitchellnemitz avatar josuealcalde-medac avatar

Watchers

James Cloos avatar

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.