style(configz): run stylua on the modules and libraries

This commit is contained in:
Ade Attwood 2023-10-15 15:51:11 +01:00
parent ed39483c40
commit fde2a7ae78
8 changed files with 39 additions and 36 deletions

View file

@ -1,4 +1,4 @@
local fs = {};
local fs = {}
--- Read the content of a file and return the content
---@param file_path string

View file

@ -8,7 +8,7 @@ local git = {}
--- Tracks a git repo keeping it up to date with a revision. Will clone the
--- repo if its already cloned. Will then checkout the required revision.
---@param config GitRepoConfig
git.repo = function (config)
git.repo = function(config)
assert(config.src ~= nil, "Git repo must have a source")
assert(config.target ~= nil, "Git repo must have a target")
assert(config.version ~= nil, "Git repo must have a version")

View file

@ -1,19 +1,18 @@
local fs = require("lib.fs")
local fs = require "lib.fs"
local v_cache = {};
local v_cache = {}
-- Where all the infomation about what configz has installed is stored.
local configz_dir = os.getenv("HOME") .. "/.config/configz/installed/";
local configz_dir = os.getenv "HOME" .. "/.config/configz/installed/"
-- Check to see if we have the version of a package installed locally
---@param package string
---@param version string
v_cache.is_installed = function (package, version)
v_cache.is_installed = function(package, version)
configz.directory(configz_dir)
if not configz.is_file(configz_dir .. package) then
return false;
return false
end
local ok, installed_version = fs.read_file(configz_dir .. package)
@ -27,9 +26,9 @@ end
-- Sets a package to be installed.
---@param package string
---@param version string
v_cache.install = function (package, version)
v_cache.install = function(package, version)
configz.directory(configz_dir)
return fs.write_file(configz_dir .. package, version)
end
return v_cache;
return v_cache

View file

@ -1,5 +1,5 @@
-- Configz module for the clojure dev tools
local v_cache = require("lib.v-cache")
local v_cache = require "lib.v-cache"
if not v_cache.is_installed("closure-lsp", "2023.02.27-13.12.12") then
configz.download("/tmp/closure-lsp.zip", {

View file

@ -1,14 +1,14 @@
local v_cache = require('lib.v-cache')
local v_cache = require "lib.v-cache"
if v_cache.is_installed("gh-cli", "v2.29.0") then
return
end
configz.download( "/tmp/gh-cli.tar.gz", {
configz.download("/tmp/gh-cli.tar.gz", {
url = "https://github.com/cli/cli/releases/download/v2.29.0/gh_2.29.0_linux_amd64.tar.gz",
sha256 = "9fe05f43a11a7bf8eacf731422452d1997e6708d4160ef0efcb13c103320390e"
sha256 = "9fe05f43a11a7bf8eacf731422452d1997e6708d4160ef0efcb13c103320390e",
})
configz.run("cd /tmp; tar -xzf /tmp/gh-cli.tar.gz")
configz.file(os.getenv("HOME") .. "/.local/bin/gh", { source = "/tmp/gh_2.29.0_linux_amd64/bin/gh" })
configz.run "cd /tmp; tar -xzf /tmp/gh-cli.tar.gz"
configz.file(os.getenv "HOME" .. "/.local/bin/gh", { source = "/tmp/gh_2.29.0_linux_amd64/bin/gh" })
v_cache.install("gh-cli", "v2.29.0")

View file

@ -1,21 +1,23 @@
local v_cache = require('lib.v-cache')
local v_cache = require "lib.v-cache"
if v_cache.is_installed("lua-language-server", "3.6.21") then
configz.info "Skipping lua lsp install, its already installed!"
return;
return
end
configz.directory(os.getenv("HOME") .. "/.local/share/lua-lsp")
configz.directory(os.getenv "HOME" .. "/.local/share/lua-lsp")
configz.download(
os.getenv("HOME") .. "/.local/share/lua-lsp/language-server.tar.gz",
os.getenv "HOME" .. "/.local/share/lua-lsp/language-server.tar.gz",
-- TODO: Add sha to the download
{ url = "https://github.com/LuaLS/lua-language-server/releases/download/3.6.21/lua-language-server-3.6.21-linux-x64.tar.gz" }
{
url = "https://github.com/LuaLS/lua-language-server/releases/download/3.6.21/lua-language-server-3.6.21-linux-x64.tar.gz",
}
)
local ok = configz.run("cd /.local/share/lua-lsp && tar -xzf language-server.tar.gz")
local ok = configz.run "cd $HOME/.local/share/lua-lsp && tar -xzf language-server.tar.gz"
if not ok then
return false;
return false
end
v_cache.install("lua-language-server", "3.6.21")

View file

@ -1,14 +1,16 @@
local git = require('lib.git')
local git = require "lib.git"
local nvim_dir = os.getenv("HOME") .. "/.config/nvim"
local nvim_dir = os.getenv "HOME" .. "/.config/nvim"
local nvim_pluing_dir_start = nvim_dir .. "/pack/bundle/start"
configz.link(nvim_dir .. "/snippets", {
source = os.getenv("PWD") .. "/site-modules/core/files/vim/snippets/snippets"
})
if not configz.is_directory(nvim_dir .. "/snippets") then
configz.link(nvim_dir .. "/snippets", {
source = os.getenv "PWD" .. "/site-modules/core/files/vim/snippets/snippets",
})
end
git.repo({
git.repo {
src = "https://github.com/sbdchd/neoformat",
target = nvim_pluing_dir_start .. "/neoformat",
version = "master"
})
version = "master",
}

View file

@ -1,12 +1,12 @@
local is_installed = configz.is_directory(os.getenv("HOME") .. "/.nvm")
local is_installed = configz.is_directory(os.getenv "HOME" .. "/.nvm")
if is_installed then
configz.info("Skipping nvm install")
configz.info "Skipping nvm install"
return
end
configz.download('/tmp/nvm-install.sh', {
configz.download("/tmp/nvm-install.sh", {
url = "https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh",
sha256 = "2ed5e94ba12434370f0358800deb69f514e8bce90f13beb0e1b241d42c6abafd"
sha256 = "2ed5e94ba12434370f0358800deb69f514e8bce90f13beb0e1b241d42c6abafd",
})
configz.run("chmod +x /tmp/nvm-install.sh && /tmp/nvm-install.sh")
configz.run "chmod +x /tmp/nvm-install.sh && /tmp/nvm-install.sh"