lepisma / bmp

Version bumper for Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  1. bmp-get-version-str: Provide the current semver in the form of a string.
  2. bmp-set-version-str: Writes the given semver string wherever needed in the project.
  3. bmp-changed-files: Return a list of relative file paths which will be affected by the change of set-version, used for git committing.

Take a look at one of the existing project type files to see what’s happening.

About

Version bumper for Emacs

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 100.0%