2017 © Pedro Peláez
 

project semver-cli

CLI app for managing semantic versioning within a project

image

phlak/semver-cli

CLI app for managing semantic versioning within a project

  • Sunday, September 11, 2016
  • by PHLAK
  • Repository
  • 1 Watchers
  • 1 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

SemVer CLI , (*1)

Join our Community Become a Sponsor One-time Donation
Latest Stable Version Total Downloads License Build Status StyleCI , (*2)

Command line tool for managing semantic versioning for a project
Created by Chris Kankiewicz (@PHLAK) , (*3)


Requirements

Installation

The SemVer CLI can be installed via Composer per-project or globally., (*4)

Per-project

composer require phlak/semver-cli

When installed to a projcet the semver tool is installed to the project's vendor/bin directory., (*5)

ℹ️ It is recommended to add vendor/bin to your PATH environment variable when installing within a project. Otherwise you will have to call the command with a relative path (i.e. vendor/bin/semver [arguments]) every time., (*6)

Globally

composer global require phlak/semver-cli

When required globally the semver tool will be installed to the global ${COMOPSER_HOME}/vendor/bin directory., (*7)

ℹ️ You should add ${COMOPSER_HOME}/vendor/bin to your PATH environment variable when installing globally. If you don't you will have to specify the full installation path with every call call., (*8)

Usage

Initialization

To begin, you must initialize semantic versioning within a directory., (*9)

$ semver initialize

This initializes the version to 0.1.0 by creating a VERSION file containing the version in the current directory., (*10)

Initialize a Specific Version

To initialize to a specific version, pass the version as an argument to the initialize command., (*11)

$ semver initialize 1.3.37

Initializing Incomplete Versions

Sometimes you may need to initialize semantic versioning with an incomplete version. By default the initialize command requires a valid semantic version string. If you want to allow the command to make a "best guess" attempt you can do so with the --parse option., (*12)

$ semver initialize --parse 1.2

Setting Version Values

After initialization you can set (override) the complete version with the set:version command., (*13)

$ semver set:version 1.3.37

Alternately, you may set individual values., (*14)

$ semver set:major 1
$ semver set:minor 3
$ semver set:patch 37
$ semver set:pre-release beta.5
$ semver set:build 007

ℹ️ Setting certain values may affect other values - Setting the major value will reset the minor and patch values to 0. - Setting the minor value will only reset the patch value to 0 - Setting the the major, minor or patch value will also clear the pre-release and build values, (*15)

Clearing Values

You may clear the pre-release or build values with the clear commands., (*16)

$ semver clear:build
$ semver clear:pre-release

Retrieving Values

At any point after initialization you may get the full version., (*17)

$ semver get:version

To get the version prefixed with v (i.e. v1.3.37) use the --prefix option., (*18)

$ semver get:version --prefix

You may also retrieve individual values., (*19)

$ semver get:major
$ semver get:minor
$ semver get:patch
$ semver get:pre-release
$ semver get:build

If the pre-release and build values are unset they will return no output by default. To force output add the --verbose option., (*20)

$ semver get:pre-release --verbose
$ semver get:build --verbose

Incrementing the Version

You can increment the version values with the increment command., (*21)

$ semver increment:major
$ semver increment:minor
$ semver increment:patch

ℹ️ Incrementing certain values may affect other values - Incrementing the major value will reset the minor and patch values to 0 - Incrementing the minor value will only reset the patch value to 0 - Incrementing the major, minor or patch value will also clear the pre-release and build values, (*22)

Adapters

The method used for storing version information can be configured with the --adapter option. The following are the available adapters to choose from., (*23)

file
Stores the version in a regular file in the current directory (default)
composer
Stores the version in the composer.json file under the version property

When using the file adapter you can control the file to which commands read and write the version via the --file option. This option takes the name you'd like to use and will look for a file with that name in the current directory., (*24)

$ semver --file .version get:version

By default the composer adapter will look for your composer.json file in the current directory. If your composer.json file lives elsewhere you can specify the path with the --composer option., (*25)

$ semver --composer path/to/composer.json increment:major

ℹ️ Adapter options can be passed passed along with any command., (*26)

Configuration

Instead of passing adapter options with every command you can set these options in a persistent configuration file. To enable the config create a file in your project directory with a name of semver.config.php. This file MUST be a PHP file and return an array with with one or more of the followng configuration options., (*27)

adapter

The storage adapter in which version data will be stored., (*28)

Equivilent to the --adapter option., (*29)

file_name

Name of the version file when using the file adapter., (*30)

Equvilent to the --file option., (*31)

composer_file

Path to the composer file when using the composer adpater, (*32)

Equvilent to the --composer option., (*33)

Examples

<?php

return [
    'adapter' => 'composer',
    'composer_file' => 'some/path/composer.json',
];

Changelog

A list of changes can be found on the GitHub Releases page., (*34)

Troubleshooting

For general help and support join our GitHub Discussions or reach out on Twitter., (*35)

Please report bugs to the GitHub Issue Tracker., (*36)

This project is liscensed under the MIT License., (*37)

The Versions

11/09 2016

dev-master

9999999-dev

CLI app for managing semantic versioning within a project

  Sources   Download

MIT

The Requires

 

The Development Requires