Introduce new plugin versioning tag mod-version

New plugins should use the version tag:

-- mod-version: 1

The old version tag "-- lite-xl 1.16" will be considerer equivalent
to mod-version 1.
This commit is contained in:
Francesco Abbate 2021-05-05 22:38:29 +02:00
parent 135dfa6f03
commit 5cef643e02
22 changed files with 35 additions and 39 deletions

View File

@ -589,18 +589,6 @@ function core.restart()
end
local function version_components(version)
local a, b, c = version:match('(%d+)%.(%d+)%.(%d+)')
if a then
return tonumber(a), tonumber(b), tonumber(c)
end
a, b = version:match('(%d+)%.(%d+)')
if a then
return tonumber(a), tonumber(b)
end
end
local function check_plugin_version(filename)
local info = system.get_file_info(filename)
if info ~= nil and info.type == "dir" then
@ -612,12 +600,19 @@ local function check_plugin_version(filename)
if not f then return false end
local version_match = false
for line in f:lines() do
local version = line:match('%-%-%s*lite%-xl%s*(%d+%.%d+)%s*$')
if not version then break end
local ver_major, ver_minor = version_components(version)
local ref_major, ref_minor = version_components(VERSION)
version_match = (ver_major == ref_major and ver_minor == ref_minor)
break
local mod_version = line:match('%-%-.*%f[%a]mod%-version%s*:%s*(%d+)')
if mod_version then
version_match = (mod_version == MOD_VERSION)
break
end
-- The following pattern is used for backward compatibility only
-- Future versions will look only at the mod-version tag.
local version = line:match('%-%-%s*lite%-xl%s*(%d+%.%d+)$')
if version then
-- we consider the version tag 1.16 equivalent to mod-version:1
version_match = (version == '1.16' and MOD_VERSION == "1")
break
end
end
f:close()
return version_match

View File

@ -1,6 +1,7 @@
-- this file is used by lite-xl to setup the Lua environment
-- when starting
VERSION = "1.16.7"
VERSION = "1.16.8"
MOD_VERSION = "1"
SCALE = tonumber(os.getenv("LITE_SCALE")) or SCALE
PATHSEP = package.config:sub(1, 1)

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local common = require "core.common"
local config = require "core.config"

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local config = require "core.config"
local Doc = require "core.doc"

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
local common = require "core.common"

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local syntax = require "core.syntax"
syntax.add {

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
local keymap = require "core.keymap"

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local common = require "core.common"
local keymap = require "core.keymap"

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
local keymap = require "core.keymap"

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local config = require "core.config"
local command = require "core.command"

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
local translate = require "core.doc.translate"

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local common = require "core.common"
local command = require "core.command"

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local common = require "core.common"
local command = require "core.command"

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local command = require "core.command"
local Doc = require "core.doc"

View File

@ -1,4 +1,4 @@
-- lite-xl 1.16
-- mod-version:1 -- lite-xl 1.16
local core = require "core"
local common = require "core.common"
local DocView = require "core.docview"