mirror of
https://github.com/TangentFoxy/semver.lua.git
synced 2025-07-29 11:32:20 +00:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
32679b1947 |
@@ -66,6 +66,8 @@ local v = require 'semver'
|
|||||||
|
|
||||||
Using `v` allows for the nice string syntax: `v'1.2.3-alpha'`.
|
Using `v` allows for the nice string syntax: `v'1.2.3-alpha'`.
|
||||||
|
|
||||||
|
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).
|
Please make sure that you read the license, too (for your convenience it's now included at the beginning of the semver.lua file).
|
||||||
|
|
||||||
# Notes about version comparison
|
# Notes about version comparison
|
||||||
@@ -84,7 +86,7 @@ Builds are ignored when calculating precedence: version 1.2.3 and 1.2.3+build5 a
|
|||||||
|
|
||||||
# Specs
|
# Specs
|
||||||
|
|
||||||
This project uses [`busted`](https://lunarmodules.github.io/busted/) 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:
|
This project uses "busted":http://olivinelabs.com/busted/ 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:
|
||||||
|
|
||||||
```
|
```
|
||||||
busted
|
busted
|
||||||
@@ -102,6 +104,3 @@ busted
|
|||||||
* Fix several errors and inconsistencies in the way the comparisons where implemented.
|
* Fix several errors and inconsistencies in the way the comparisons where implemented.
|
||||||
* Added a lot more tests to cover more edge cases when comparing versions
|
* Added a lot more tests to cover more edge cases when comparing versions
|
||||||
|
|
||||||
## v.1.2.1
|
|
||||||
* Fix error on pessimistic update operator when applied to a 0.x.x version
|
|
||||||
|
|
||||||
|
@@ -1,25 +0,0 @@
|
|||||||
package = "semver"
|
|
||||||
version = "1.2.1-1"
|
|
||||||
source = {
|
|
||||||
url = "git://github.com/kikito/semver.lua.git",
|
|
||||||
}
|
|
||||||
description = {
|
|
||||||
summary = "An implementation of semantic versioning (semver.org 2.0.0) in Lua",
|
|
||||||
detailed = [[
|
|
||||||
See details in http://semver.org
|
|
||||||
]],
|
|
||||||
license = "MIT",
|
|
||||||
homepage = "https://github.com/kikito/semver.lua"
|
|
||||||
}
|
|
||||||
dependencies = {
|
|
||||||
"lua >= 5.1"
|
|
||||||
}
|
|
||||||
|
|
||||||
build = {
|
|
||||||
type = "none",
|
|
||||||
install = {
|
|
||||||
lua = {
|
|
||||||
"semver.lua"
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,5 +1,5 @@
|
|||||||
local semver = {
|
local semver = {
|
||||||
_VERSION = '1.2.1',
|
_VERSION = '1.2.0',
|
||||||
_DESCRIPTION = 'semver for Lua',
|
_DESCRIPTION = 'semver for Lua',
|
||||||
_URL = 'https://github.com/kikito/semver.lua',
|
_URL = 'https://github.com/kikito/semver.lua',
|
||||||
_LICENSE = [[
|
_LICENSE = [[
|
||||||
@@ -15,7 +15,7 @@ local semver = {
|
|||||||
permit persons to whom the Software is furnished to do so, subject to
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
the following conditions:
|
the following conditions:
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included
|
The above copyright notice and tother permission notice shall be included
|
||||||
in all copies or substantial portions of the Software.
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
@@ -173,9 +173,7 @@ end
|
|||||||
-- if a and b are versions, a ^ b means "b is backwards-compatible with a"
|
-- if a and b are versions, a ^ b means "b is backwards-compatible with a"
|
||||||
-- in other words, "it's safe to upgrade from a to b"
|
-- in other words, "it's safe to upgrade from a to b"
|
||||||
function mt:__pow(other)
|
function mt:__pow(other)
|
||||||
if self.major == 0 then
|
if self.major == 0 then return false end
|
||||||
return self == other
|
|
||||||
end
|
|
||||||
return self.major == other.major and
|
return self.major == other.major and
|
||||||
self.minor <= other.minor
|
self.minor <= other.minor
|
||||||
end
|
end
|
||||||
|
@@ -254,8 +254,6 @@ describe('semver', function()
|
|||||||
describe("^", function()
|
describe("^", function()
|
||||||
it("true for self", function()
|
it("true for self", function()
|
||||||
assert.is_true(v(1,2,3) ^ v(1,2,3))
|
assert.is_true(v(1,2,3) ^ v(1,2,3))
|
||||||
assert.is_true(v(0,1,0) ^ v(0,1,0))
|
|
||||||
assert.is_true(v("0.1.1+build0") ^ v(0,1,1))
|
|
||||||
end)
|
end)
|
||||||
it("different major versions mean it's always unsafe", function()
|
it("different major versions mean it's always unsafe", function()
|
||||||
assert.is_false(v(2,0,0) ^ v(3,0,0))
|
assert.is_false(v(2,0,0) ^ v(3,0,0))
|
||||||
@@ -275,15 +273,6 @@ describe('semver', function()
|
|||||||
it("is unsafe to downgrade to an earlier minor version", function()
|
it("is unsafe to downgrade to an earlier minor version", function()
|
||||||
assert.is_false(v(1,5,0) ^ v(1,2,0))
|
assert.is_false(v(1,5,0) ^ v(1,2,0))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it("is unsafe to upgrade any pre-1.0 versions", function()
|
|
||||||
assert.is_false(v("0.0.1-alpha") ^ v(0,0,1))
|
|
||||||
assert.is_false(v("0.0.1") ^ v(0,0,2))
|
|
||||||
assert.is_false(v("0.0.1+build0") ^ v(0,0,2))
|
|
||||||
assert.is_false(v(0,0,1) ^ v(0,1,0))
|
|
||||||
assert.is_false(v(0,0,1) ^ v(1,0,0))
|
|
||||||
assert.is_false(v(0,0,1) ^ v("1.0.0-alpha"))
|
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
describe("_VERSION", function()
|
describe("_VERSION", function()
|
||||||
|
Reference in New Issue
Block a user