ctl.plugins.version

Plugin that allows you to handle repository versioning

Classes


VersionPlugin

VersionPlugin(ctl.plugins.ExecutablePlugin)

manage repository versioning

Class Attributes

  • ConfigSchema (ConfigSchema Class): Base plugin config schema

Instanced Attributes

These attributes / properties will be available on instances of the class

  • init_version (@property): True if a Ctl/VERSION file should be created if it's missing
  • no_auto_dev (@property): True if we do NOT want to automatically bump a dev version when a major minor or patch version is bumped

Class Methods

add_repo_argument

def add_repo_argument(cls, parser, plugin_config)

The repository cli parameter needs to be available on all operations. However since it is an optional positional parameter that cames at the end using shared parsers to implement it appears to be tricky.

So instead for now we do the next best thing and call this class method on all parsers that need to support the repo parameter

Arguments

  • parser (argparse.ArgParser)
  • plugin_config (dict)

Methods

bump

def bump(self, version, repo, **kwargs)

bump a version according to semantic version

Arguments

  • version (str): major, minor, patch or dev
  • repo (str): name of existing repository type plugin instance

Exposed to CLI

namespace: ctl.{plugin_name}.bump


execute

def execute(self, **kwargs)

Execute the plugin's main action

Will automatically call prepare

Keyword Arguments

Any keyword arguments passed to this function will be stored in the plugin's kwargs attribute


merge_release

def merge_release(self, repo, **kwargs)

Merge branch self.branch_dev into branch self.branch_release in the specified repo

Arguments

  • repo (str): name of existing repository type plugin instance

Exposed to CLI

namespace: ctl.{plugin_name}.merge_release


repository

def repository(self, target)

Return plugin instance for repository

Arguments

  • target (str): name of a configured repository type plugin or filepath to a repository checkout

Returns

git plugin instance (GitPlugin)


tag

def tag(self, version, repo, **kwargs)

tag a version according to version specified

Arguments

  • version (str): tag version (eg. 1.0.0)
  • repo (str): name of existing repository type plugin instance

Keyword Arguments

  • release (bool): if True also run merge_release

Exposed to CLI

namespace: ctl.{plugin_name}.tag


validate_changelog

def validate_changelog(self, repo, version, data_file=CHANGELOG.yaml)

Checks for the existance of a changelog data file like CHANGELOG.yaml or CHANGELOG.json and if found will validate that the specified version exists.

Will raise a KeyError on validation failure

Arrguments

  • version (str): tag version (eg. 1.0.0)
  • repo (str): name of existing repository type plugin instance

VersionPluginConfig

VersionPluginConfig(confu.schema.core.Schema)

Configuration schema for VersionPlugin

Class Attributes

  • branch_dev (Str): the branch to merge from when the --merge-release flag is present
  • branch_release (Str): the breanch to merge to when the --merge-release flag is present
  • changelog_validate (Bool): If a changelog data file (CHANGELOG.yaml) exists, validate before tagging
  • repository (Str): name of repository type plugin or path to a repository checkout