mirror of
https://github.com/kikito/semver.lua.git
synced 2024-10-10 04:24:18 +00:00
43 lines
1.2 KiB
Plaintext
43 lines
1.2 KiB
Plaintext
h1. semver.lua
|
|
|
|
Semantic versioning for Lua.
|
|
|
|
See http://semver.org/ for details about semantic versioning.
|
|
|
|
h1. Documentation
|
|
|
|
local v = require 'semver'
|
|
|
|
-- accepts integers and numbers
|
|
v1 = v(1,0,0)
|
|
v2_5_1 = v('2.5.1')
|
|
|
|
-- major, minor and patch attributes
|
|
v2_5_1.major -- 2
|
|
v2_5_1.minor -- 5
|
|
v2_5_1.patch -- 1
|
|
|
|
--
|
|
|
|
|
|
h1. Installation
|
|
|
|
Just copy the semver.lua file wherever you want it (for example on a lib/ folder). Then write this in any Lua file where you want to use it. You must assign the require to a global or local variable (I use a local @v@):
|
|
|
|
<pre>local v = require 'semver'</pre>
|
|
|
|
Using @v@ allows for the following nice syntax: @v'1.2.3'@.
|
|
|
|
The @package.path@ variable must be configured so that the folder in which middleclass.lua is copied is available, of course.
|
|
|
|
Please make sure that you read the license, too (for your convenience it's now included at the beginning of the semver.lua file).
|
|
|
|
h1. Specs
|
|
|
|
This project uses "telescope":https://github.com/norman/telescope for its specs. If you want to run the specs, you will have to install telescope first. Then just execute the following from the root inspect folder:
|
|
|
|
<pre>
|
|
tsc -f spec/*
|
|
</pre>
|
|
|