aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Harrison <adamdharrison@gmail.com>2022-11-03 20:26:54 -0400
committerAdam Harrison <adamdharrison@gmail.com>2022-11-03 20:26:54 -0400
commit086cbe2a095b52bf44f2ac5e361152cb8e77dc1b (patch)
tree7883767123bdc5826b61ac1912a293699d2e7ad8
parentc40793df85f402f26efab64c96387318a9c8c514 (diff)
downloadlite-xl-plugin-manager-086cbe2a095b52bf44f2ac5e361152cb8e77dc1b.tar.gz
lite-xl-plugin-manager-086cbe2a095b52bf44f2ac5e361152cb8e77dc1b.zip
Added conflicts.
-rw-r--r--SPEC.md4
-rw-r--r--src/lpm.lua6
2 files changed, 9 insertions, 1 deletions
diff --git a/SPEC.md b/SPEC.md
index e48991d..70f7531 100644
--- a/SPEC.md
+++ b/SPEC.md
@@ -46,7 +46,11 @@ The vast majority of plugins are `singleton` plugins.
this plugin provides. Can be used as a dependency.
* `dependencies`: Optionally a hash of dependencies required, or optional
for this plugin.
+* `conflicts`: An optional hash of plugins which conflict with this one, in the same
+ format as `dependencies`.
* `tags`: Optional freeform tags that may describe attributes of the plugin.
+* `path`: Optional path to the plugin. If omitted, will only pull the files in
+ `files`. To pull the whole repository, use `"."`.
### Dependencies
diff --git a/src/lpm.lua b/src/lpm.lua
index 4dc1c01..8dfc8d8 100644
--- a/src/lpm.lua
+++ b/src/lpm.lua
@@ -508,6 +508,7 @@ function Plugin.new(repository, metadata)
remote = nil,
version = "1.0",
dependencies = {},
+ conflicts = {},
local_path = repository and (repository.local_path .. PATHSEP .. (repository.commit or repository.branch) .. (metadata.path and (PATHSEP .. metadata.path:gsub("^/", "")) or "")),
}, metadata), Plugin)
self.type = type
@@ -526,7 +527,10 @@ end
function Plugin:is_core(bottle) return self.type == "core" end
function Plugin:is_bundled(bottle) return self.type == "bundled" end
function Plugin:is_installed(bottle) return self:is_core(bottle) or (bottle.lite_xl:is_compatible(self) and system.stat(self:get_install_path(bottle))) end
-function Plugin:is_incompatible(plugin) return self.dependencies[plugin.name] and not match_version(plugin.version, self.dependencies[plugin.name]) end
+function Plugin:is_incompatible(plugin)
+ return (self.dependencies[plugin.name] and not match_version(plugin.version, self.dependencies[plugin.name] and self.dependencies[plugin.name].version)) or
+ (self.conflicts[plugin.name] and match_version(plugin.version, self.conflicts[plugin.name] and self.conflicts[plugin.name].version))
+end
function Plugin:get_path(bottle)
return self:is_installed(bottle) and self:get_install_path(bottle) or self.local_path