Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add doc on using s package. Add GitHub source location #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,12 @@ Combining semver 1 + common extensions and semver 2 can be tricky. The case with
Install
-------

Manually: put semver.el file in your load-path and (require 'semver).
Manually:

El-get: Evaluate the following snippet and install with el-get-install.
1. If you do not have `s.el`, use the Emacs package manager or download it manually from [magnars/s.el](https://github.com/magnars/s.el) and install it in your `load-path`.
1. Put `semver.el` in your `load-path` and `(require 'semver)`.

`el-get`: Evaluate the following snippet and install with `el-get-install`.

(setq el-get-sources
(cons '(:name semver
Expand Down
15 changes: 9 additions & 6 deletions semver.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
;; Author: Hendrik van Antwerpen <[email protected]>
;; Version: 0.2.0
;; Package-Requires: ((s "1.3.1"))
;; Source: https://github.com/hendrikvanantwerpen/semver.el

;; This file is not part of GNU Emacs.

;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at
;;
;;
;; http://www.apache.org/licenses/LICENSE-2.0
;;
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -22,6 +23,8 @@

;;; Code:

; To install "The long lost Emacs string manipulation library" s package,
; use el-get (see above) or download s.el from https://github.com/magnars/s.el
(require 's)

(let* ((g< "\\(")
Expand Down Expand Up @@ -130,7 +133,7 @@
(mapconcat 'identity
(mapcar 'number-to-string
version) "."))

;; Access version, major, minor, patch, build and prerelease

(defun semver-version (semver)
Expand Down Expand Up @@ -220,7 +223,7 @@
(setq semver (semver-parse semver))
(setq with-respect-to (semver-parse with-respect-to))
(< (semver-compare semver with-respect-to) 0))

(defun semver>= (semver with-respect-to)
(not (semver< semver with-respect-to)))

Expand Down Expand Up @@ -356,7 +359,7 @@
(list '<= end))))
(t
(error "Unknown comparator")))))))

(defun semver--pred-satisfied (pred semver)
(cond ((eq '| (nth 0 pred))
(let ((result nil))
Expand Down Expand Up @@ -400,4 +403,4 @@

(provide 'semver)

;;; s.el ends here
;;; semver.el ends here