From 262fd30d28c030cb42b4583c0a6bb394dea12067 Mon Sep 17 00:00:00 2001 From: icebaker Date: Tue, 9 Jan 2024 22:00:00 -0300 Subject: migrating to PATH --- controllers/cartridges.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'controllers') diff --git a/controllers/cartridges.rb b/controllers/cartridges.rb index ca1e8f0..3be8d53 100644 --- a/controllers/cartridges.rb +++ b/controllers/cartridges.rb @@ -12,16 +12,18 @@ module NanoBot Logic::Cartridge::Parser.parse(File.read(path), format: File.extname(path)) end - def self.all + def self.all(components: {}) files = {} - path = Components::Storage.cartridges_path + paths = Components::Storage.cartridges_path(components:) - Dir.glob("#{path}/**/*.{yml,yaml,markdown,mdown,mkdn,md}").each do |file| - files[Pathname.new(file).realpath] = { - base: path, - path: Pathname.new(file).realpath - } + paths.split(':').each do |path| + Dir.glob("#{path}/**/*.{yml,yaml,markdown,mdown,mkdn,md}").each do |file| + files[Pathname.new(file).realpath] = { + base: path, + path: Pathname.new(file).realpath + } + end end cartridges = [] -- cgit v1.2.3