From fde2a7ae7854f6e6f85338d21f07090d3246e788 Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Sun, 15 Oct 2023 15:51:11 +0100 Subject: [PATCH] style(configz): run stylua on the modules and libraries --- lib/fs.lua | 2 +- lib/git.lua | 2 +- lib/v-cache.lua | 15 +++++++-------- modules/clojure.lua | 2 +- modules/gh-cli.lua | 10 +++++----- modules/lua-lsp.lua | 16 +++++++++------- modules/nvim.lua | 18 ++++++++++-------- modules/nvm.lua | 10 +++++----- 8 files changed, 39 insertions(+), 36 deletions(-) diff --git a/lib/fs.lua b/lib/fs.lua index 1742efb..7acb996 100644 --- a/lib/fs.lua +++ b/lib/fs.lua @@ -1,4 +1,4 @@ -local fs = {}; +local fs = {} --- Read the content of a file and return the content ---@param file_path string diff --git a/lib/git.lua b/lib/git.lua index d2c04e4..f0e9d37 100644 --- a/lib/git.lua +++ b/lib/git.lua @@ -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") diff --git a/lib/v-cache.lua b/lib/v-cache.lua index 1802e66..f164952 100644 --- a/lib/v-cache.lua +++ b/lib/v-cache.lua @@ -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 diff --git a/modules/clojure.lua b/modules/clojure.lua index e4c6667..03bf463 100644 --- a/modules/clojure.lua +++ b/modules/clojure.lua @@ -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", { diff --git a/modules/gh-cli.lua b/modules/gh-cli.lua index 0ef273c..3c04460 100644 --- a/modules/gh-cli.lua +++ b/modules/gh-cli.lua @@ -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") diff --git a/modules/lua-lsp.lua b/modules/lua-lsp.lua index ae5b6cb..488e878 100644 --- a/modules/lua-lsp.lua +++ b/modules/lua-lsp.lua @@ -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") diff --git a/modules/nvim.lua b/modules/nvim.lua index ba14594..2611662 100644 --- a/modules/nvim.lua +++ b/modules/nvim.lua @@ -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", +} diff --git a/modules/nvm.lua b/modules/nvm.lua index e506137..f783920 100644 --- a/modules/nvm.lua +++ b/modules/nvm.lua @@ -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"