Skip to content

sirrobert/Semantic-Versioning

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
t
 
 
 
 
 
 
 
 

Semantic Versioning

Overview

Allows an object to take on versioning attributes in accordance with the Semantic Versioning specification (2.0.0). The module provides a class and a role.

Role: does Semantic::Versioning

The Semantic::Versioning role enables any object to be versioned. Four properties are added: .version, .major-version, .minor-version, and .patch-version.

Example use

class Document does Semantic::Versioning { }

my $doc = Document.new;
$doc.version = '1.6.23';
say $doc.major-version; #  1
say $doc.minor-version; #  6
say $doc.patch-version; # 23

$doc.minor-version = 7;
say $doc.version; # '1.7.23';

Class: has Semantic::Version

The class version allows for multiple versioning attributes in an object.

Example use

class Document {
  has Semantic::Version $.described-in;
  has Semantic::Version $.planned-for;
  has Semantic::Version $.implemented-in;
}

my $doc = Document.new;
$doc.described-in.version = '1.6.23';
say $doc.described-in.major-version; #  1
say $doc.described-in.minor-version; #  6
say $doc.described-in.patch-version; # 23

$doc.planned-for.version = '2.0.0';
$doc.implemented-in.version = '2.0.0';

# Woops, made a mistake-- got implemented in the next minor version;
$doc.implemented-in.minor-version++;
say $doc.implemented-in; # '2.1.0';

About

Empower objects with semantic versioning.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages