Skip to content

circleitdev/cum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

build-status project-version build-status

Cum - composer version manager

~•~• ~• ~• ~•
█▀▀ █░█ █▀▄▀█
█▄▄ █▄█ █░▀░█
~• ~• ~• ~•~•

Cum stands for composer version manager, manage multiple composer versions with ease and written in rust for speed and reliability.

Features

  • 🚀 Fast and lightweight
  • 📦 Install multiple composer versions
  • 🔄 Switch between versions seamlessly
  • 💾 Per-project version management with .cumrc
  • 🗑️ Easy version removal
  • 📋 List installed and available versions

Compatibility

  • ✅ Linux
  • ✅ Mac
  • ⌛ Windows

Requirements

  • Rust 1.70+ (for building)
  • Internet connection (for downloading composer versions)

Installation

Manual installation

# clone the project
git clone https://github.com/circleitdev/cum.git

# enter the project
cd cum/

# build the project
cargo build --release

# copy to a directory in your PATH for all users
sudo cp target/release/cum /usr/local/bin/

# or current user
cp target/release/cum ~/.local/bin/

Update

Manual update

# check the existing version
cum --version

# enter the project
cd cum/

# pull the project
git pull

# build the project
cargo build --release

# copy to a directory in your PATH for all users
sudo cp target/release/cum /usr/local/bin/

# or current user
cp target/release/cum ~/.local/bin/

# certain the updated version
cum --version

Post-installation setup

Add the following to your shell config:

# Add path to ~/.bashrc or ~/.zshrc or other shell
export PATH="$HOME/.cum/current:$PATH"

Then reload your shell:

# bash
source ~/.bashrc

# or if you use zsh
source ~/.zshrc

Usage

Install a composer version

# install
cum install v2.9.3

# or use shorthand
cum i v2.9.3

Switch to a version

# use
cum use v2.9.3

# or use shorthand
cum u v2.9.3

Use with .cumrc file

# create a `.cumrc` file in your project
echo "v2.9.3" > .cumrc

# run use
cum use

List installed versions

# list
cum list

# or use shorthand
cum ls

Output example:

# list installed
Installed versions:
  v2.5.8
  v2.7.0
* v2.9.3 (active)

List available remote versions

# list remote
cum list-remote

# or use shorthand
cum ls-remote

Show current version

# current
cum current

Remove a version

# remove
cum remove v2.9.3

# or use shorthand
cum rm v2.9.3

Show help

# help
cum help

# or another version
cum --help
cum -h

Show version

# version
cum --version

# or use shorthand
cum -v

Commands

Command Alias Description
use <composer-version> u detect .cumrc and automatically switch valid composer version
install <composer-version> i install a specific composer version
remove <composer-version> rm remove an installed composer version
list ls list all installed composer version(s)
list-remote ls-remote list available composer version(s) from github
current - show current active composer version
help -h, --help print this help message
--version -v print cum version

How it works

CUM manages composer versions in ~/.cum/versions/ and creates a symlink at ~/.cum/current pointing to the active version.

~/.cum/
├── current -> versions/2.9.3
└── versions/
    ├── 2.7.9/
    │   └── composer
    │   └── composer.phar
    ├── 2.8.12/
    │   └── composer
    │   └── composer.phar
    └── 2.9.3/
        └── composer
        └── composer.phar

When you run composer, it executes from ~/.cum/current/composer.phar.

Per-project version management

  1. Create .cumrc in your project root:

    # generate
    echo "v2.9.3" > .cumrc
  2. When entering the project, run:

    # use
    cum use
  3. Add .cumrc to your .gitignore if it's personal preference, or commit it if your team should use the same version.

Uninstallation

# Remove the binary for all users
sudo rm /usr/local/bin/cum

# or current user
rm ~/.local/bin/cum

# Remove data directory (optional)
rm -rf ~/.cum

# Remove PATH export from your shell config
# Edit ~/.bashrc or ~/.zshrc or other shell and remove:
# export PATH="$HOME/.cum/current:$PATH"

Troubleshooting

composer: command not found

Make sure ~/.cum/current is in your PATH:

# detect cum
echo $PATH | grep ".cum/current"

If not found, add this to your shell config:

# export composer
export PATH="$HOME/.cum/current:$PATH"

# then reload
source ~/.bashrc

# or if you use zsh
source ~/.zshrc

Permission denied

On Unix systems, ensure composer.phar is executable:

# add executable permission
chmod +x ~/.cum/current/composer.phar

version not found when installing

Check if the version exists:

# list remote
cum list-remote

Visit https://github.com/composer/composer/releases/ or https://getcomposer.org/download/ to see all available versions.

Inspired by

  • CVM - composer version manager (Node.js)
  • NVM - Node version manager
  • BUM - Bun version manager

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Not yet implemented

  • [-] Automatic installation script
  • [-] Unit test
  • [-] Windows support
  • [-] Publish release build in packages
  • [-] Include executable in releases
  • [-] NPM release
  • [-] Cargo release
  • [-] Many more

About

Composer version manager

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors