bmp
Semver bumper for Emacs. Run bmp
inside a project to choose the type of update
required.
For bmp to read and write versions, you need to specify where and how to get the version string(s). There are two ways of specifying this.
.bmpfile
For projects where you can point to the places where semver is written using
filepaths and regexes within, you can just put a .bmpfile
in the repository root
with the following content:
;; The group 1 constraint doesn't feel nice but it works for me as of now.
(("./relative-file-path" . "regex for version string in group 1")
("./another-file-with-version" . "regex in second file"))
A sample .bmpfile
is present in this repository here.
Custom project detectors
Using bmpfile is recommended as the following mechanism is old and useless unless you have something other than regex patterns in mind.
A detector function might look at the current default-directory
and return an
instance of the new project class. For example, the node detector is the
following:
(defun bmp-node-get-project ()
(let ((json-file "package.json"))
(when (file-exists-p (concat default-directory json-file))
(bmp-node-project :root-dir default-directory
:json-file json-file))))
Once the detector is defined, add it to the list bmp-project-fns
which is walked
over by bmp sequentially.
The class for a project needs to define the following methods:
bmp-get-version-str
: Provide the current semver in the form of a string.bmp-set-version-str
: Writes the given semver string wherever needed in the project.bmp-changed-files
: Return a list of relative file paths which will be affected by the change ofset-version
, used for git committing.
Take a look at one of the existing project type files to see what’s happening.