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:
parent
135dfa6f03
commit
5cef643e02
|
@ -589,18 +589,6 @@ function core.restart()
|
||||||
end
|
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 function check_plugin_version(filename)
|
||||||
local info = system.get_file_info(filename)
|
local info = system.get_file_info(filename)
|
||||||
if info ~= nil and info.type == "dir" then
|
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
|
if not f then return false end
|
||||||
local version_match = false
|
local version_match = false
|
||||||
for line in f:lines() do
|
for line in f:lines() do
|
||||||
local version = line:match('%-%-%s*lite%-xl%s*(%d+%.%d+)%s*$')
|
local mod_version = line:match('%-%-.*%f[%a]mod%-version%s*:%s*(%d+)')
|
||||||
if not version then break end
|
if mod_version then
|
||||||
local ver_major, ver_minor = version_components(version)
|
version_match = (mod_version == MOD_VERSION)
|
||||||
local ref_major, ref_minor = version_components(VERSION)
|
break
|
||||||
version_match = (ver_major == ref_major and ver_minor == ref_minor)
|
end
|
||||||
break
|
-- 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
|
end
|
||||||
f:close()
|
f:close()
|
||||||
return version_match
|
return version_match
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
-- this file is used by lite-xl to setup the Lua environment
|
-- this file is used by lite-xl to setup the Lua environment
|
||||||
-- when starting
|
-- when starting
|
||||||
VERSION = "1.16.7"
|
VERSION = "1.16.8"
|
||||||
|
MOD_VERSION = "1"
|
||||||
|
|
||||||
SCALE = tonumber(os.getenv("LITE_SCALE")) or SCALE
|
SCALE = tonumber(os.getenv("LITE_SCALE")) or SCALE
|
||||||
PATHSEP = package.config:sub(1, 1)
|
PATHSEP = package.config:sub(1, 1)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local common = require "core.common"
|
local common = require "core.common"
|
||||||
local config = require "core.config"
|
local config = require "core.config"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local config = require "core.config"
|
local config = require "core.config"
|
||||||
local Doc = require "core.doc"
|
local Doc = require "core.doc"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local command = require "core.command"
|
local command = require "core.command"
|
||||||
local common = require "core.common"
|
local common = require "core.common"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local syntax = require "core.syntax"
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
syntax.add {
|
syntax.add {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local syntax = require "core.syntax"
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
syntax.add {
|
syntax.add {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local syntax = require "core.syntax"
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
syntax.add {
|
syntax.add {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local syntax = require "core.syntax"
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
syntax.add {
|
syntax.add {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local syntax = require "core.syntax"
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
syntax.add {
|
syntax.add {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local syntax = require "core.syntax"
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
syntax.add {
|
syntax.add {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local syntax = require "core.syntax"
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
syntax.add {
|
syntax.add {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local syntax = require "core.syntax"
|
local syntax = require "core.syntax"
|
||||||
|
|
||||||
syntax.add {
|
syntax.add {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local command = require "core.command"
|
local command = require "core.command"
|
||||||
local keymap = require "core.keymap"
|
local keymap = require "core.keymap"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local common = require "core.common"
|
local common = require "core.common"
|
||||||
local keymap = require "core.keymap"
|
local keymap = require "core.keymap"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local command = require "core.command"
|
local command = require "core.command"
|
||||||
local keymap = require "core.keymap"
|
local keymap = require "core.keymap"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local config = require "core.config"
|
local config = require "core.config"
|
||||||
local command = require "core.command"
|
local command = require "core.command"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local command = require "core.command"
|
local command = require "core.command"
|
||||||
local translate = require "core.doc.translate"
|
local translate = require "core.doc.translate"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local common = require "core.common"
|
local common = require "core.common"
|
||||||
local command = require "core.command"
|
local command = require "core.command"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local common = require "core.common"
|
local common = require "core.common"
|
||||||
local command = require "core.command"
|
local command = require "core.command"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local command = require "core.command"
|
local command = require "core.command"
|
||||||
local Doc = require "core.doc"
|
local Doc = require "core.doc"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
-- lite-xl 1.16
|
-- mod-version:1 -- lite-xl 1.16
|
||||||
local core = require "core"
|
local core = require "core"
|
||||||
local common = require "core.common"
|
local common = require "core.common"
|
||||||
local DocView = require "core.docview"
|
local DocView = require "core.docview"
|
||||||
|
|
Loading…
Reference in New Issue