diff options
author | icebaker <icebaker@proton.me> | 2024-01-09 22:00:00 -0300 |
---|---|---|
committer | icebaker <icebaker@proton.me> | 2024-01-09 22:00:00 -0300 |
commit | 262fd30d28c030cb42b4583c0a6bb394dea12067 (patch) | |
tree | 0c61dfe9c7a5e72b6bbe166103a87e725620783b /controllers | |
parent | 309e529759f9a6e9c8538dd5595518897caecfa5 (diff) |
migrating to PATH
Diffstat (limited to 'controllers')
-rw-r--r-- | controllers/cartridges.rb | 16 |
1 files changed, 9 insertions, 7 deletions
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 = [] |