refactor(installer): return function instead of M
This commit is contained in:
parent
bc235b7cd3
commit
932c0aa0c3
2 changed files with 7 additions and 11 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
local tags = require "gopher.struct_tags"
|
local tags = require "gopher.struct_tags"
|
||||||
local gopher = {}
|
local gopher = {}
|
||||||
|
|
||||||
gopher.install_deps = require("gopher.installer").install_all
|
gopher.install_deps = require "gopher.installer"
|
||||||
gopher.tags_add = tags.add
|
gopher.tags_add = tags.add
|
||||||
gopher.tags_rm = tags.remove
|
gopher.tags_rm = tags.remove
|
||||||
gopher.mod = require "gopher.gomod"
|
gopher.mod = require "gopher.gomod"
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
local Job = require "plenary.job"
|
local Job = require "plenary.job"
|
||||||
local M = {
|
local urls = {
|
||||||
urls = {
|
gomodifytags = "github.com/fatih/gomodifytags",
|
||||||
gomodifytags = "github.com/fatih/gomodifytags",
|
impl = "github.com/josharian/impl",
|
||||||
impl = "github.com/josharian/impl",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
local function install(pkg)
|
local function install(pkg)
|
||||||
local url = M.urls[pkg] .. "@latest"
|
local url = urls[pkg] .. "@latest"
|
||||||
|
|
||||||
Job
|
Job
|
||||||
:new({
|
:new({
|
||||||
|
|
@ -26,10 +24,8 @@ local function install(pkg)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Install required go deps
|
---Install required go deps
|
||||||
function M.install_all()
|
return function()
|
||||||
for pkg, _ in pairs(M.urls) do
|
for pkg, _ in pairs(urls) do
|
||||||
install(pkg)
|
install(pkg)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue