Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/f3ath/pubspec-version

A CLI tool to get/set/bump the `version` key in pubspec.yaml.
https://github.com/f3ath/pubspec-version

dart dart-library dart2 dartlang flutter pubspec pubspec-maintenance

Last synced: 25 days ago
JSON representation

A CLI tool to get/set/bump the `version` key in pubspec.yaml.

Awesome Lists containing this project

README

        

# The project has moved to [cider](https://pub.dev/packages/cider). This package is archived.
---
---
---
---
---

CLI tool to set/bump the `version` key in pubspec.yaml. Semver-compliant (Almost.
It uses [pub_semver](https://pub.dartlang.org/packages/pub_semver) which is a bit different.)

## Installing
Install the package from the command line:
```
pub global activate pubspec_version
```

This will add the **pubver** binary to your `~/.pub-cache/bin`.
## Usage
### Bumping the version
```
pubver bump
```
where `` can be either **breaking**, **major**, **minor**, **patch** or **build**.

#### Examples
Before | Command | After
--- | --- | ---
1.2.3 | `pubver bump breaking` | 2.0.0
0.2.1 | `pubver bump breaking` | 0.3.0
0.2.1 | `pubver bump major` | 1.0.0
0.2.1 | `pubver bump minor` | 0.3.0
0.2.1 | `pubver bump patch` | 0.2.2
0.2.1 | `pubver bump build` | 0.2.1+1
0.2.1+42 | `pubver bump build` | 0.2.1+43
0.2.1+foo | `pubver bump build` | 0.2.1+foo.1
0.2.1+42.foo | `pubver bump build` | 0.2.1+43.foo
0.2.1+foo.bar.1.2 | `pubver bump build` | 0.2.1+foo.bar.2.0

The `bump build` command is a bit tricky. It either increments the first numeric part of the build (if there is a
numeric part) setting other numeric parts to zeroes, or appends `.1` to the build (otherwise).

### Retaining the build number
When bumping either **major**, **minor**, or **patch** versions, it is possible to retain the existing build number (if any).
To do so, pass `--retain-build` (`-b`) flag.

Before | Command | After
--- | --- | ---
1.2.3+42 | `pubver bump breaking` | 2.0.0
0.2.1+42 | `pubver bump breaking -b` | 0.3.0+42
0.2.1+42 | `pubver bump patch` | 0.2.2
0.2.1+42 | `pubver bump patch -b` | 0.2.2+42

### Setting the version
```
pubver set
```
where `` can be any arbitrary version.

### Getting the version
```
pubver get
```

### Output
The tool prints the new version to stdout. This allows post processing, e.g. making a git commit.
```bash
git ci . -m "Release $(pubver bump breaking)"
```